Skip to content

Commit 717f82e

Browse files
committed
[cmd] Deprecate Command.schedule()
It's a footgun and syntactic sugar over the CommandScheduler's schedule method. We don't need syntactic sugar for a footgun.
1 parent cea8684 commit 717f82e

File tree

2 files changed

+9
-1
lines changed
  • wpilibNewCommands/src/main

2 files changed

+9
-1
lines changed

wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,12 @@ public WrapperCommand handleInterrupt(Runnable handler) {
514514
});
515515
}
516516

517-
/** Schedules this command. */
517+
/**
518+
* Schedules this command.
519+
*
520+
* @deprecated Use CommandScheduler.getInstance().schedule(Command...) instead
521+
*/
522+
@Deprecated(since = "2025", forRemoval = true)
518523
public void schedule() {
519524
CommandScheduler.getInstance().schedule(this);
520525
}

wpilibNewCommands/src/main/native/include/frc2/command/Command.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,10 @@ class Command : public wpi::Sendable, public wpi::SendableHelper<Command> {
406406

407407
/**
408408
* Schedules this command.
409+
*
410+
* @deprecated Use CommandScheduler::GetInstance().Schedule() instead
409411
*/
412+
[[deprecated("Use CommandScheduler::GetInstance().Schedule() instead.")]]
410413
void Schedule();
411414

412415
/**

0 commit comments

Comments
 (0)