diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandBase.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandBase.java index fa9b26da48..8c1e8b10de 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandBase.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandBase.java @@ -45,7 +45,6 @@ public abstract class CommandBase implements Sendable, Command { * * @param name name */ - @Override public void setName(String name) { SendableRegistry.setName(this, name); } @@ -66,7 +65,6 @@ public abstract class CommandBase implements Sendable, Command { * * @return Subsystem name */ - @Override public String getSubsystem() { return SendableRegistry.getSubsystem(this); } @@ -76,7 +74,6 @@ public abstract class CommandBase implements Sendable, Command { * * @param subsystem subsystem name */ - @Override public void setSubsystem(String subsystem) { SendableRegistry.setSubsystem(this, subsystem); } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SubsystemBase.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SubsystemBase.java index d61ed5baba..f0a0fae6d5 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SubsystemBase.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/SubsystemBase.java @@ -27,7 +27,6 @@ public abstract class SubsystemBase implements Subsystem, Sendable { * * @return Name */ - @Override public String getName() { return SendableRegistry.getName(this); } @@ -37,7 +36,6 @@ public abstract class SubsystemBase implements Subsystem, Sendable { * * @param name name */ - @Override public void setName(String name) { SendableRegistry.setName(this, name); } @@ -47,7 +45,6 @@ public abstract class SubsystemBase implements Subsystem, Sendable { * * @return Subsystem name */ - @Override public String getSubsystem() { return SendableRegistry.getSubsystem(this); } @@ -57,7 +54,6 @@ public abstract class SubsystemBase implements Subsystem, Sendable { * * @param subsystem subsystem name */ - @Override public void setSubsystem(String subsystem) { SendableRegistry.setSubsystem(this, subsystem); } diff --git a/wpilibOldCommands/src/main/java/edu/wpi/first/wpilibj/command/Command.java b/wpilibOldCommands/src/main/java/edu/wpi/first/wpilibj/command/Command.java index 5bb49a3800..9b8c41cf4c 100644 --- a/wpilibOldCommands/src/main/java/edu/wpi/first/wpilibj/command/Command.java +++ b/wpilibOldCommands/src/main/java/edu/wpi/first/wpilibj/command/Command.java @@ -36,6 +36,7 @@ import java.util.Enumeration; * @see CommandGroup * @see IllegalUseOfCommandException */ +@SuppressWarnings("PMD.GodClass") public abstract class Command implements Sendable, AutoCloseable { /** The time since this command was initialized. */ private double m_startTime = -1; @@ -561,7 +562,6 @@ public abstract class Command implements Sendable, AutoCloseable { * * @return Name */ - @Override public String getName() { return SendableRegistry.getName(this); } @@ -571,7 +571,6 @@ public abstract class Command implements Sendable, AutoCloseable { * * @param name name */ - @Override public void setName(String name) { SendableRegistry.setName(this, name); } @@ -581,7 +580,6 @@ public abstract class Command implements Sendable, AutoCloseable { * * @return Subsystem name */ - @Override public String getSubsystem() { return SendableRegistry.getSubsystem(this); } @@ -591,7 +589,6 @@ public abstract class Command implements Sendable, AutoCloseable { * * @param subsystem subsystem name */ - @Override public void setSubsystem(String subsystem) { SendableRegistry.setSubsystem(this, subsystem); } diff --git a/wpilibOldCommands/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java b/wpilibOldCommands/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java index 8f61663293..f596ed68f4 100644 --- a/wpilibOldCommands/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java +++ b/wpilibOldCommands/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java @@ -187,7 +187,6 @@ public abstract class Subsystem implements Sendable, AutoCloseable { * * @return Name */ - @Override public String getName() { return SendableRegistry.getName(this); } @@ -197,7 +196,6 @@ public abstract class Subsystem implements Sendable, AutoCloseable { * * @param name name */ - @Override public void setName(String name) { SendableRegistry.setName(this, name); } @@ -207,7 +205,6 @@ public abstract class Subsystem implements Sendable, AutoCloseable { * * @return Subsystem name */ - @Override public String getSubsystem() { return SendableRegistry.getSubsystem(this); } @@ -217,7 +214,6 @@ public abstract class Subsystem implements Sendable, AutoCloseable { * * @param subsystem subsystem name */ - @Override public void setSubsystem(String subsystem) { SendableRegistry.setSubsystem(this, subsystem); } diff --git a/wpilibc/src/main/native/cpp/smartdashboard/SendableBase.cpp b/wpilibc/src/main/native/cpp/smartdashboard/SendableBase.cpp deleted file mode 100644 index 2b92c0f531..0000000000 --- a/wpilibc/src/main/native/cpp/smartdashboard/SendableBase.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -#include "frc/smartdashboard/SendableBase.h" - -#include "frc/smartdashboard/SendableRegistry.h" - -using namespace frc; - -SendableBase::SendableBase(bool addLiveWindow) { - if (addLiveWindow) { - SendableRegistry::GetInstance().AddLW(this, ""); - } else { - SendableRegistry::GetInstance().Add(this, ""); - } -} diff --git a/wpilibc/src/main/native/include/frc/smartdashboard/SendableBase.h b/wpilibc/src/main/native/include/frc/smartdashboard/SendableBase.h deleted file mode 100644 index 7f50d0ad07..0000000000 --- a/wpilibc/src/main/native/include/frc/smartdashboard/SendableBase.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -#pragma once - -#include - -#include "frc/smartdashboard/Sendable.h" -#include "frc/smartdashboard/SendableHelper.h" - -namespace frc { - -class SendableBase : public Sendable, public SendableHelper { - public: - /** - * Creates an instance of the sensor base - * - * @deprecated use Sendable and SendableHelper - * - * @param addLiveWindow if true, add this Sendable to LiveWindow - */ - WPI_DEPRECATED("use Sendable and SendableHelper") - explicit SendableBase(bool addLiveWindow = true); -}; - -} // namespace frc diff --git a/wpilibcIntegrationTests/src/main/native/include/shuffleboard/MockActuatorSendable.h b/wpilibcIntegrationTests/src/main/native/include/shuffleboard/MockActuatorSendable.h index 76f7c7cf40..f59cc956bd 100644 --- a/wpilibcIntegrationTests/src/main/native/include/shuffleboard/MockActuatorSendable.h +++ b/wpilibcIntegrationTests/src/main/native/include/shuffleboard/MockActuatorSendable.h @@ -6,7 +6,7 @@ #include -#include "frc/smartdashboard/SendableBase.h" +#include "frc/smartdashboard/Sendable.h" #include "frc/smartdashboard/SendableBuilder.h" namespace frc { @@ -14,7 +14,7 @@ namespace frc { /** * A mock sendable that marks itself as an actuator. */ -class MockActuatorSendable : public SendableBase { +class MockActuatorSendable : public Sendable { public: explicit MockActuatorSendable(wpi::StringRef name); diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java index 84484ff8c5..eb57341c35 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java @@ -5,102 +5,9 @@ package edu.wpi.first.wpilibj; import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder; -import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry; /** The base interface for objects that can be sent over the network through network tables. */ public interface Sendable { - /** - * Gets the name of this {@link Sendable} object. - * - * @return Name - * @deprecated Use SendableRegistry.getName() - */ - @Deprecated(since = "2020", forRemoval = true) - default String getName() { - return SendableRegistry.getName(this); - } - - /** - * Sets the name of this {@link Sendable} object. - * - * @param name name - * @deprecated Use SendableRegistry.setName() - */ - @Deprecated(since = "2020", forRemoval = true) - default void setName(String name) { - SendableRegistry.setName(this, name); - } - - /** - * Sets both the subsystem name and device name of this {@link Sendable} object. - * - * @param subsystem subsystem name - * @param name device name - * @deprecated Use SendableRegistry.setName() - */ - @Deprecated(since = "2020", forRemoval = true) - default void setName(String subsystem, String name) { - SendableRegistry.setName(this, subsystem, name); - } - - /** - * Sets the name of the sensor with a channel number. - * - * @param moduleType A string that defines the module name in the label for the value - * @param channel The channel number the device is plugged into - * @deprecated Use SendableRegistry.setName() - */ - @Deprecated(since = "2020", forRemoval = true) - default void setName(String moduleType, int channel) { - SendableRegistry.setName(this, moduleType, channel); - } - - /** - * Sets the name of the sensor with a module and channel number. - * - * @param moduleType A string that defines the module name in the label for the value - * @param moduleNumber The number of the particular module type - * @param channel The channel number the device is plugged into (usually PWM) - * @deprecated Use SendableRegistry.setName() - */ - @Deprecated(since = "2020", forRemoval = true) - default void setName(String moduleType, int moduleNumber, int channel) { - SendableRegistry.setName(this, moduleType, moduleNumber, channel); - } - - /** - * Gets the subsystem name of this {@link Sendable} object. - * - * @return Subsystem name - * @deprecated Use SendableRegistry.getSubsystem() - */ - @Deprecated(since = "2020", forRemoval = true) - default String getSubsystem() { - return SendableRegistry.getSubsystem(this); - } - - /** - * Sets the subsystem name of this {@link Sendable} object. - * - * @param subsystem subsystem name - * @deprecated Use SendableRegistry.setSubsystem() - */ - @Deprecated(since = "2020", forRemoval = true) - default void setSubsystem(String subsystem) { - SendableRegistry.setSubsystem(this, subsystem); - } - - /** - * Add a child component. - * - * @param child child component - * @deprecated Use SendableRegistry.addChild() - */ - @Deprecated(since = "2020", forRemoval = true) - default void addChild(Object child) { - SendableRegistry.addChild(this, child); - } - /** * Initializes this {@link Sendable} object. * diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SendableBase.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/SendableBase.java deleted file mode 100644 index 44b1d5080e..0000000000 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SendableBase.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package edu.wpi.first.wpilibj; - -import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry; - -/** - * Base class for all sensors. Stores most recent status information as well as containing utility - * functions for checking channels and error processing. - * - * @deprecated Use Sendable and SendableRegistry - */ -@Deprecated(since = "2020", forRemoval = true) -public abstract class SendableBase implements Sendable, AutoCloseable { - /** Creates an instance of the sensor base. */ - public SendableBase() { - this(true); - } - - /** - * Creates an instance of the sensor base. - * - * @param addLiveWindow if true, add this Sendable to LiveWindow - */ - public SendableBase(boolean addLiveWindow) { - if (addLiveWindow) { - SendableRegistry.addLW(this, ""); - } else { - SendableRegistry.add(this, ""); - } - } - - @Override - public void close() { - SendableRegistry.remove(this); - } -}