mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
Add javac plugin for detecting common error cases at compile time (#8196)
Adds a `@NoDiscard` annotation that can be placed on methods to guarantee their return values are used and on types to guarantee that any method returning that type uses the return value.
Methods that call `@NoDiscard`-annotated functions can add a `@SuppressWarnings("NoDiscard")` or `@SuppressWarnings("all")` annotation (or annotation on the class declaring that method) to silence the compiler error warnings.
This commit is contained in:
@@ -16,6 +16,7 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import org.wpilib.annotation.NoDiscard;
|
||||
|
||||
/**
|
||||
* A state machine representing a complete action to be performed by the robot. Commands are run by
|
||||
@@ -27,6 +28,7 @@ import java.util.function.BooleanSupplier;
|
||||
*
|
||||
* <p>This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
@NoDiscard("Commands must be used! Did you mean to bind it to a trigger?")
|
||||
public abstract class Command implements Sendable {
|
||||
/** Requirements set. */
|
||||
private final Set<Subsystem> m_requirements = new HashSet<>();
|
||||
|
||||
Reference in New Issue
Block a user