mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Update Java linters and fix new PMD errors (#4157)
PMD requires that variables only initialized in the constructor be final. The compiler errors if those final variables aren't guaranteed to be initialized, so extra else branches were added to ensure that. PMD also requires that classes with only private constructors be final. The equivalent C++ classes were finalized as well, except for TimeInterpolatableBuffer because it doesn't expose factory functions.
This commit is contained in:
@@ -24,7 +24,7 @@ import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/** Provide access to the network communication data to / from the Driver Station. */
|
||||
public class DriverStation {
|
||||
public final class DriverStation {
|
||||
/** Number of Joystick Ports. */
|
||||
public static final int kJoystickPorts = 6;
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.nio.ByteOrder;
|
||||
* digital input and down on an edge from another digital input.
|
||||
*/
|
||||
public class UpDownCounter implements Sendable, AutoCloseable {
|
||||
private DigitalSource m_upSource;
|
||||
private DigitalSource m_downSource;
|
||||
private final DigitalSource m_upSource;
|
||||
private final DigitalSource m_downSource;
|
||||
|
||||
private final int m_handle;
|
||||
|
||||
@@ -43,6 +43,8 @@ public class UpDownCounter implements Sendable, AutoCloseable {
|
||||
CounterJNI.setCounterUpSource(
|
||||
m_handle, upSource.getPortHandleForRouting(), upSource.getAnalogTriggerTypeForRouting());
|
||||
CounterJNI.setCounterUpSourceEdge(m_handle, true, false);
|
||||
} else {
|
||||
m_upSource = null;
|
||||
}
|
||||
|
||||
if (downSource != null) {
|
||||
@@ -52,6 +54,8 @@ public class UpDownCounter implements Sendable, AutoCloseable {
|
||||
downSource.getPortHandleForRouting(),
|
||||
downSource.getAnalogTriggerTypeForRouting());
|
||||
CounterJNI.setCounterDownSourceEdge(m_handle, true, false);
|
||||
} else {
|
||||
m_downSource = null;
|
||||
}
|
||||
|
||||
reset();
|
||||
|
||||
@@ -14,7 +14,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilderImpl;
|
||||
/**
|
||||
* The LiveWindow class is the public interface for putting sensors and actuators on the LiveWindow.
|
||||
*/
|
||||
public class LiveWindow {
|
||||
public final class LiveWindow {
|
||||
private static class Component {
|
||||
boolean m_firstTime = true;
|
||||
boolean m_telemetryEnabled = true;
|
||||
|
||||
Reference in New Issue
Block a user