Fix multiple Java warnings (#6201)

This commit is contained in:
Thad House
2024-01-12 08:46:21 -08:00
committed by GitHub
parent ba9c21cf38
commit 1981b8debd
15 changed files with 44 additions and 34 deletions

View File

@@ -25,7 +25,7 @@ import java.nio.ByteOrder;
* href="https://docs.wpilib.org/en/stable/docs/yearly-overview/known-issues.html#onboard-i2c-causing-system-lockups">
* WPILib Known Issues</a> page for details.
*/
@SuppressWarnings({"TypeName", "PMD.UnusedPrivateField"})
@SuppressWarnings("TypeName")
public class ADXL345_I2C implements NTSendable, AutoCloseable {
/** Default I2C device address. */
public static final byte kAddress = 0x1D;
@@ -34,16 +34,17 @@ public class ADXL345_I2C implements NTSendable, AutoCloseable {
private static final byte kDataFormatRegister = 0x31;
private static final byte kDataRegister = 0x32;
private static final double kGsPerLSB = 0.00390625;
private static final byte kPowerCtl_Link = 0x20;
private static final byte kPowerCtl_AutoSleep = 0x10;
// private static final byte kPowerCtl_Link = 0x20;
// private static final byte kPowerCtl_AutoSleep = 0x10;
private static final byte kPowerCtl_Measure = 0x08;
private static final byte kPowerCtl_Sleep = 0x04;
// private static final byte kPowerCtl_Sleep = 0x04;
private static final byte kDataFormat_SelfTest = (byte) 0x80;
private static final byte kDataFormat_SPI = 0x40;
private static final byte kDataFormat_IntInvert = 0x20;
// private static final byte kDataFormat_SelfTest = (byte) 0x80;
// private static final byte kDataFormat_SPI = 0x40;
// private static final byte kDataFormat_IntInvert = 0x20;
private static final byte kDataFormat_FullRes = 0x08;
private static final byte kDataFormat_Justify = 0x04;
// private static final byte kDataFormat_Justify = 0x04;
/** Accelerometer range. */
public enum Range {

View File

@@ -19,7 +19,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/** ADXL345 SPI Accelerometer. */
@SuppressWarnings({"TypeName", "PMD.UnusedPrivateField"})
@SuppressWarnings("TypeName")
public class ADXL345_SPI implements NTSendable, AutoCloseable {
private static final int kPowerCtlRegister = 0x2D;
private static final int kDataFormatRegister = 0x31;
@@ -29,16 +29,17 @@ public class ADXL345_SPI implements NTSendable, AutoCloseable {
private static final int kAddress_Read = 0x80;
private static final int kAddress_MultiByte = 0x40;
private static final int kPowerCtl_Link = 0x20;
private static final int kPowerCtl_AutoSleep = 0x10;
// private static final int kPowerCtl_Link = 0x20;
// private static final int kPowerCtl_AutoSleep = 0x10;
private static final int kPowerCtl_Measure = 0x08;
private static final int kPowerCtl_Sleep = 0x04;
// private static final int kPowerCtl_Sleep = 0x04;
private static final int kDataFormat_SelfTest = 0x80;
private static final int kDataFormat_SPI = 0x40;
private static final int kDataFormat_IntInvert = 0x20;
// private static final int kDataFormat_SelfTest = 0x80;
// private static final int kDataFormat_SPI = 0x40;
// private static final int kDataFormat_IntInvert = 0x20;
private static final int kDataFormat_FullRes = 0x08;
private static final int kDataFormat_Justify = 0x04;
// private static final int kDataFormat_Justify = 0x04;
/** Accelerometer range. */
public enum Range {

View File

@@ -38,8 +38,8 @@ public class ADXL362 implements NTSendable, AutoCloseable {
private static final byte kPowerCtl_UltraLowNoise = 0x20;
@SuppressWarnings("PMD.UnusedPrivateField")
private static final byte kPowerCtl_AutoSleep = 0x04;
// @SuppressWarnings("PMD.UnusedPrivateField")
// private static final byte kPowerCtl_AutoSleep = 0x04;
private static final byte kPowerCtl_Measure = 0x02;

View File

@@ -26,21 +26,21 @@ import java.nio.ByteOrder;
* <p>This class is for the digital ADXRS450 gyro sensor that connects via SPI. Only one instance of
* an ADXRS Gyro is supported.
*/
@SuppressWarnings({"TypeName", "PMD.UnusedPrivateField"})
@SuppressWarnings("TypeName")
public class ADXRS450_Gyro implements Sendable, AutoCloseable {
private static final double kSamplePeriod = 0.0005;
private static final double kCalibrationSampleTime = 5.0;
private static final double kDegreePerSecondPerLSB = 0.0125;
private static final int kRateRegister = 0x00;
private static final int kTemRegister = 0x02;
private static final int kLoCSTRegister = 0x04;
private static final int kHiCSTRegister = 0x06;
private static final int kQuadRegister = 0x08;
private static final int kFaultRegister = 0x0A;
// private static final int kRateRegister = 0x00;
// private static final int kTemRegister = 0x02;
// private static final int kLoCSTRegister = 0x04;
// private static final int kHiCSTRegister = 0x06;
// private static final int kQuadRegister = 0x08;
// private static final int kFaultRegister = 0x0A;
private static final int kPIDRegister = 0x0C;
private static final int kSNHighRegister = 0x0E;
private static final int kSNLowRegister = 0x10;
// private static final int kSNHighRegister = 0x0E;
// private static final int kSNLowRegister = 0x10;
private SPI m_spi;

View File

@@ -12,6 +12,7 @@ import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.util.sendable.SendableBuilder;
import edu.wpi.first.util.sendable.SendableRegistry;
import edu.wpi.first.wpilibj.AnalogTriggerOutput.AnalogTriggerType;
import java.lang.ref.Reference;
/** Class for creating and configuring Analog Triggers. */
public class AnalogTrigger implements Sendable, AutoCloseable {
@@ -20,7 +21,6 @@ public class AnalogTrigger implements Sendable, AutoCloseable {
private AnalogInput m_analogInput;
@SuppressWarnings({"PMD.SingularField", "PMD.UnusedPrivateField"})
private DutyCycle m_dutyCycle;
private boolean m_ownsAnalog;
@@ -80,6 +80,7 @@ public class AnalogTrigger implements Sendable, AutoCloseable {
if (m_ownsAnalog && m_analogInput != null) {
m_analogInput.close();
}
Reference.reachabilityFence(m_dutyCycle);
}
/**

View File

@@ -48,6 +48,8 @@ public final class DriverStation {
private static class HALJoystickAxesRaw {
public int[] m_axes;
@SuppressWarnings("unused")
public int m_count;
HALJoystickAxesRaw(int count) {

View File

@@ -208,6 +208,7 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
m_suppressTimeoutMessage = suppress;
}
@SuppressWarnings("resource")
private static void updateAlarm() {
if (m_watchdogs.isEmpty()) {
NotifierJNI.cancelNotifierAlarm(m_notifier);