mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Upgrade maven deps to latest versions and fix new linter errors (#3772)
This also makes the Gradle build work with JDK 17. The extra JVM args in gradle.properties works around a bug with spotless and JDK 17: https://github.com/diffplug/spotless/issues/834 PMD.CloseResource was ignored because it's almost always a false positive, and there are many of them.
This commit is contained in:
@@ -33,30 +33,16 @@ public class Compressor implements Sendable, AutoCloseable {
|
||||
*/
|
||||
public Compressor(int module, PneumaticsModuleType moduleType) {
|
||||
m_module = PneumaticsBase.getForType(module, moduleType);
|
||||
boolean allocatedCompressor = false;
|
||||
boolean successfulCompletion = false;
|
||||
|
||||
try {
|
||||
if (!m_module.reserveCompressor()) {
|
||||
throw new AllocationException("Compressor already allocated");
|
||||
}
|
||||
|
||||
allocatedCompressor = true;
|
||||
|
||||
m_module.enableCompressorDigital();
|
||||
|
||||
HAL.report(tResourceType.kResourceType_Compressor, module + 1);
|
||||
SendableRegistry.addLW(this, "Compressor", module);
|
||||
successfulCompletion = true;
|
||||
|
||||
} finally {
|
||||
if (!successfulCompletion) {
|
||||
if (allocatedCompressor) {
|
||||
m_module.unreserveCompressor();
|
||||
}
|
||||
m_module.close();
|
||||
}
|
||||
if (!m_module.reserveCompressor()) {
|
||||
m_module.close();
|
||||
throw new AllocationException("Compressor already allocated");
|
||||
}
|
||||
|
||||
m_module.enableCompressorDigital();
|
||||
|
||||
HAL.report(tResourceType.kResourceType_Compressor, module + 1);
|
||||
SendableRegistry.addLW(this, "Compressor", module);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,6 +53,7 @@ public class DoubleSolenoid implements Sendable, AutoCloseable {
|
||||
* @param forwardChannel The forward channel on the module to control.
|
||||
* @param reverseChannel The reverse channel on the module to control.
|
||||
*/
|
||||
@SuppressWarnings("PMD.UseTryWithResources")
|
||||
public DoubleSolenoid(
|
||||
final int module,
|
||||
final PneumaticsModuleType moduleType,
|
||||
|
||||
@@ -99,7 +99,7 @@ public class Notifier implements AutoCloseable {
|
||||
break;
|
||||
}
|
||||
|
||||
Runnable handler = null;
|
||||
Runnable handler;
|
||||
m_processLock.lock();
|
||||
try {
|
||||
handler = m_handler;
|
||||
|
||||
@@ -313,7 +313,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
private static boolean m_suppressExitWarning;
|
||||
|
||||
/** Run the robot main loop. */
|
||||
@SuppressWarnings("PMD.AvoidCatchingThrowable")
|
||||
@SuppressWarnings({"PMD.AvoidCatchingThrowable", "PMD.AvoidReassigningCatchVariables"})
|
||||
private static <T extends RobotBase> void runRobot(Supplier<T> robotSupplier) {
|
||||
System.out.println("********** Robot program starting **********");
|
||||
|
||||
|
||||
@@ -41,35 +41,22 @@ public class Solenoid implements Sendable, AutoCloseable {
|
||||
*/
|
||||
public Solenoid(final int module, final PneumaticsModuleType moduleType, final int channel) {
|
||||
m_module = PneumaticsBase.getForType(module, moduleType);
|
||||
boolean allocatedSolenoids = false;
|
||||
boolean successfulCompletion = false;
|
||||
|
||||
m_mask = 1 << channel;
|
||||
m_channel = channel;
|
||||
|
||||
try {
|
||||
if (!m_module.checkSolenoidChannel(channel)) {
|
||||
throw new IllegalArgumentException("Channel " + channel + " out of range");
|
||||
}
|
||||
|
||||
if (m_module.checkAndReserveSolenoids(m_mask) != 0) {
|
||||
throw new AllocationException("Solenoid already allocated");
|
||||
}
|
||||
|
||||
allocatedSolenoids = true;
|
||||
|
||||
HAL.report(tResourceType.kResourceType_Solenoid, channel + 1, m_module.getModuleNumber() + 1);
|
||||
SendableRegistry.addLW(this, "Solenoid", m_module.getModuleNumber(), channel);
|
||||
successfulCompletion = true;
|
||||
|
||||
} finally {
|
||||
if (!successfulCompletion) {
|
||||
if (allocatedSolenoids) {
|
||||
m_module.unreserveSolenoids(m_mask);
|
||||
}
|
||||
m_module.close();
|
||||
}
|
||||
if (!m_module.checkSolenoidChannel(channel)) {
|
||||
m_module.close();
|
||||
throw new IllegalArgumentException("Channel " + channel + " out of range");
|
||||
}
|
||||
|
||||
if (m_module.checkAndReserveSolenoids(m_mask) != 0) {
|
||||
m_module.close();
|
||||
throw new AllocationException("Solenoid already allocated");
|
||||
}
|
||||
|
||||
HAL.report(tResourceType.kResourceType_Solenoid, channel + 1, m_module.getModuleNumber() + 1);
|
||||
SendableRegistry.addLW(this, "Solenoid", m_module.getModuleNumber(), channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -325,8 +325,8 @@ public class DifferentialDrive extends RobotDriveBase implements Sendable, AutoC
|
||||
xSpeed = MathUtil.clamp(xSpeed, -1.0, 1.0);
|
||||
zRotation = MathUtil.clamp(zRotation, -1.0, 1.0);
|
||||
|
||||
double leftSpeed = 0.0;
|
||||
double rightSpeed = 0.0;
|
||||
double leftSpeed;
|
||||
double rightSpeed;
|
||||
|
||||
if (allowTurnInPlace) {
|
||||
leftSpeed = xSpeed + zRotation;
|
||||
|
||||
@@ -59,7 +59,7 @@ final class ContainerHelper {
|
||||
return widget;
|
||||
}
|
||||
|
||||
ComplexWidget add(Sendable sendable) throws IllegalArgumentException {
|
||||
ComplexWidget add(Sendable sendable) {
|
||||
String name = SendableRegistry.getName(sendable);
|
||||
if (name.isEmpty()) {
|
||||
throw new IllegalArgumentException("Sendable must have a name");
|
||||
|
||||
@@ -62,7 +62,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @return the layout with the given title
|
||||
* @throws NoSuchElementException if no layout has yet been defined with the given title
|
||||
*/
|
||||
ShuffleboardLayout getLayout(String title) throws NoSuchElementException;
|
||||
ShuffleboardLayout getLayout(String title);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given sendable.
|
||||
@@ -73,7 +73,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this container with the given
|
||||
* title
|
||||
*/
|
||||
ComplexWidget add(String title, Sendable sendable) throws IllegalArgumentException;
|
||||
ComplexWidget add(String title, Sendable sendable);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given video stream.
|
||||
@@ -84,7 +84,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this container with the given
|
||||
* title
|
||||
*/
|
||||
default ComplexWidget add(String title, VideoSource video) throws IllegalArgumentException {
|
||||
default ComplexWidget add(String title, VideoSource video) {
|
||||
return add(title, SendableCameraWrapper.wrap(video));
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget add(String title, Object defaultValue) throws IllegalArgumentException;
|
||||
SimpleWidget add(String title, Object defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided by the value
|
||||
@@ -133,8 +133,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this container with the given
|
||||
* title
|
||||
*/
|
||||
SuppliedValueWidget<String> addString(String title, Supplier<String> valueSupplier)
|
||||
throws IllegalArgumentException;
|
||||
SuppliedValueWidget<String> addString(String title, Supplier<String> valueSupplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided by the value
|
||||
@@ -147,8 +146,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this container with the given
|
||||
* title
|
||||
*/
|
||||
SuppliedValueWidget<Double> addNumber(String title, DoubleSupplier valueSupplier)
|
||||
throws IllegalArgumentException;
|
||||
SuppliedValueWidget<Double> addNumber(String title, DoubleSupplier valueSupplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided by the value
|
||||
@@ -161,8 +159,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this container with the given
|
||||
* title
|
||||
*/
|
||||
SuppliedValueWidget<Boolean> addBoolean(String title, BooleanSupplier valueSupplier)
|
||||
throws IllegalArgumentException;
|
||||
SuppliedValueWidget<Boolean> addBoolean(String title, BooleanSupplier valueSupplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided by the value
|
||||
@@ -175,8 +172,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this container with the given
|
||||
* title
|
||||
*/
|
||||
SuppliedValueWidget<String[]> addStringArray(String title, Supplier<String[]> valueSupplier)
|
||||
throws IllegalArgumentException;
|
||||
SuppliedValueWidget<String[]> addStringArray(String title, Supplier<String[]> valueSupplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided by the value
|
||||
@@ -189,8 +185,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this container with the given
|
||||
* title
|
||||
*/
|
||||
SuppliedValueWidget<double[]> addDoubleArray(String title, Supplier<double[]> valueSupplier)
|
||||
throws IllegalArgumentException;
|
||||
SuppliedValueWidget<double[]> addDoubleArray(String title, Supplier<double[]> valueSupplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided by the value
|
||||
@@ -203,8 +198,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this container with the given
|
||||
* title
|
||||
*/
|
||||
SuppliedValueWidget<boolean[]> addBooleanArray(String title, Supplier<boolean[]> valueSupplier)
|
||||
throws IllegalArgumentException;
|
||||
SuppliedValueWidget<boolean[]> addBooleanArray(String title, Supplier<boolean[]> valueSupplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided by the value
|
||||
@@ -217,8 +211,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this container with the given
|
||||
* title
|
||||
*/
|
||||
SuppliedValueWidget<byte[]> addRaw(String title, Supplier<byte[]> valueSupplier)
|
||||
throws IllegalArgumentException;
|
||||
SuppliedValueWidget<byte[]> addRaw(String title, Supplier<byte[]> valueSupplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display a simple piece of data. Unlike {@link #add(String,
|
||||
@@ -232,8 +225,7 @@ public interface ShuffleboardContainer extends ShuffleboardValue {
|
||||
* title
|
||||
* @see #add(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
default SimpleWidget addPersistent(String title, Object defaultValue)
|
||||
throws IllegalArgumentException {
|
||||
default SimpleWidget addPersistent(String title, Object defaultValue) {
|
||||
SimpleWidget widget = add(title, defaultValue);
|
||||
widget.getEntry().setPersistent();
|
||||
return widget;
|
||||
|
||||
@@ -9,7 +9,6 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.DoubleSupplier;
|
||||
import java.util.function.Supplier;
|
||||
@@ -34,64 +33,60 @@ public class ShuffleboardLayout extends ShuffleboardComponent<ShuffleboardLayout
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShuffleboardLayout getLayout(String title) throws NoSuchElementException {
|
||||
public ShuffleboardLayout getLayout(String title) {
|
||||
return m_helper.getLayout(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComplexWidget add(String title, Sendable sendable) throws IllegalArgumentException {
|
||||
public ComplexWidget add(String title, Sendable sendable) {
|
||||
return m_helper.add(title, sendable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComplexWidget add(Sendable sendable) throws IllegalArgumentException {
|
||||
public ComplexWidget add(Sendable sendable) {
|
||||
return m_helper.add(sendable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleWidget add(String title, Object defaultValue) throws IllegalArgumentException {
|
||||
public SimpleWidget add(String title, Object defaultValue) {
|
||||
return m_helper.add(title, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<String> addString(String title, Supplier<String> valueSupplier)
|
||||
throws IllegalArgumentException {
|
||||
public SuppliedValueWidget<String> addString(String title, Supplier<String> valueSupplier) {
|
||||
return m_helper.addString(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<Double> addNumber(String title, DoubleSupplier valueSupplier)
|
||||
throws IllegalArgumentException {
|
||||
public SuppliedValueWidget<Double> addNumber(String title, DoubleSupplier valueSupplier) {
|
||||
return m_helper.addNumber(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<Boolean> addBoolean(String title, BooleanSupplier valueSupplier)
|
||||
throws IllegalArgumentException {
|
||||
public SuppliedValueWidget<Boolean> addBoolean(String title, BooleanSupplier valueSupplier) {
|
||||
return m_helper.addBoolean(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<String[]> addStringArray(
|
||||
String title, Supplier<String[]> valueSupplier) throws IllegalArgumentException {
|
||||
String title, Supplier<String[]> valueSupplier) {
|
||||
return m_helper.addStringArray(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<double[]> addDoubleArray(
|
||||
String title, Supplier<double[]> valueSupplier) throws IllegalArgumentException {
|
||||
String title, Supplier<double[]> valueSupplier) {
|
||||
return m_helper.addDoubleArray(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<boolean[]> addBooleanArray(
|
||||
String title, Supplier<boolean[]> valueSupplier) throws IllegalArgumentException {
|
||||
String title, Supplier<boolean[]> valueSupplier) {
|
||||
return m_helper.addBooleanArray(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<byte[]> addRaw(String title, Supplier<byte[]> valueSupplier)
|
||||
throws IllegalArgumentException {
|
||||
public SuppliedValueWidget<byte[]> addRaw(String title, Supplier<byte[]> valueSupplier) {
|
||||
return m_helper.addRaw(title, valueSupplier);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ package edu.wpi.first.wpilibj.shuffleboard;
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.DoubleSupplier;
|
||||
import java.util.function.Supplier;
|
||||
@@ -48,7 +47,7 @@ public final class ShuffleboardTab implements ShuffleboardContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShuffleboardLayout getLayout(String title) throws NoSuchElementException {
|
||||
public ShuffleboardLayout getLayout(String title) {
|
||||
return m_helper.getLayout(title);
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ public final class ShuffleboardTab implements ShuffleboardContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComplexWidget add(Sendable sendable) throws IllegalArgumentException {
|
||||
public ComplexWidget add(Sendable sendable) {
|
||||
return m_helper.add(sendable);
|
||||
}
|
||||
|
||||
@@ -68,44 +67,40 @@ public final class ShuffleboardTab implements ShuffleboardContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<String> addString(String title, Supplier<String> valueSupplier)
|
||||
throws IllegalArgumentException {
|
||||
public SuppliedValueWidget<String> addString(String title, Supplier<String> valueSupplier) {
|
||||
return m_helper.addString(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<Double> addNumber(String title, DoubleSupplier valueSupplier)
|
||||
throws IllegalArgumentException {
|
||||
public SuppliedValueWidget<Double> addNumber(String title, DoubleSupplier valueSupplier) {
|
||||
return m_helper.addNumber(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<Boolean> addBoolean(String title, BooleanSupplier valueSupplier)
|
||||
throws IllegalArgumentException {
|
||||
public SuppliedValueWidget<Boolean> addBoolean(String title, BooleanSupplier valueSupplier) {
|
||||
return m_helper.addBoolean(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<String[]> addStringArray(
|
||||
String title, Supplier<String[]> valueSupplier) throws IllegalArgumentException {
|
||||
String title, Supplier<String[]> valueSupplier) {
|
||||
return m_helper.addStringArray(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<double[]> addDoubleArray(
|
||||
String title, Supplier<double[]> valueSupplier) throws IllegalArgumentException {
|
||||
String title, Supplier<double[]> valueSupplier) {
|
||||
return m_helper.addDoubleArray(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<boolean[]> addBooleanArray(
|
||||
String title, Supplier<boolean[]> valueSupplier) throws IllegalArgumentException {
|
||||
String title, Supplier<boolean[]> valueSupplier) {
|
||||
return m_helper.addBooleanArray(title, valueSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuppliedValueWidget<byte[]> addRaw(String title, Supplier<byte[]> valueSupplier)
|
||||
throws IllegalArgumentException {
|
||||
public SuppliedValueWidget<byte[]> addRaw(String title, Supplier<byte[]> valueSupplier) {
|
||||
return m_helper.addRaw(title, valueSupplier);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@ public class SendableChooser<V> implements NTSendable, AutoCloseable {
|
||||
/**
|
||||
* Adds the given object to the list of options.
|
||||
*
|
||||
* @deprecated Use {@link #addOption(String, Object)} instead.
|
||||
* @param name the name of the option
|
||||
* @param object the option
|
||||
* @deprecated Use {@link #addOption(String, Object)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void addObject(String name, V object) {
|
||||
@@ -99,9 +99,9 @@ public class SendableChooser<V> implements NTSendable, AutoCloseable {
|
||||
/**
|
||||
* Adds the given object to the list of options and marks it as the default.
|
||||
*
|
||||
* @deprecated Use {@link #setDefaultOption(String, Object)} instead.
|
||||
* @param name the name of the option
|
||||
* @param object the option
|
||||
* @deprecated Use {@link #setDefaultOption(String, Object)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void addDefault(String name, V object) {
|
||||
|
||||
Reference in New Issue
Block a user