From 7cf1e9c279b477c2e1ca8626624302cca0f92a5d Mon Sep 17 00:00:00 2001 From: Jade Turner Date: Fri, 13 Sep 2024 11:56:25 +0800 Subject: [PATCH] [commands] Add a warning to `schedule` javadocs --- .../java/edu/wpi/first/wpilibj2/command/CommandScheduler.java | 2 ++ .../src/main/native/include/frc2/command/CommandScheduler.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java index 7e634cf5c92..2669368ba62 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java @@ -180,6 +180,8 @@ private void initCommand(Command command, Set requirements) { * using those requirements have been scheduled as interruptible. If this is the case, they will * be interrupted and the command will be scheduled. * + * WARNING: using this function directly is often a footgun and should be avoided. + * * @param command the command to schedule. If null, no-op. */ private void schedule(Command command) { diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h index fde2c6d3e3f..120a61d6e0c 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h @@ -88,6 +88,8 @@ class CommandScheduler final : public wpi::Sendable, * interruptible. If this is the case, they will be interrupted and the * command will be scheduled. * + * WARNING: using this function directly is often a footgun and should be avoided. + * * @param command the command to schedule */ void Schedule(const CommandPtr& command);