Skip to content

Commit

Permalink
Fix ImmutableField warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 committed Jun 6, 2024
1 parent 19c313f commit 41d8f05
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ public int hashCode() {
private static class FieldDimensions {
@SuppressWarnings("MemberName")
@JsonProperty(value = "length")
public double fieldLength;
public final double fieldLength;

@SuppressWarnings("MemberName")
@JsonProperty(value = "width")
public double fieldWidth;
public final double fieldWidth;

@JsonCreator()
FieldDimensions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,5 @@ public String[] getChoices() {
}

int m_handle;
private Kind m_kind;
private final Kind m_kind;
}
1 change: 0 additions & 1 deletion styleguide/pmd-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
<exclude name="ExcessiveParameterList" />
<exclude name="ExcessivePublicCount" />
<exclude name="GodClass" />
<exclude name="ImmutableField" />
<exclude name="LawOfDemeter" />
<exclude name="LoosePackageCoupling" />
<exclude name="NPathComplexity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void cleanup() {
new SwerveModuleState(0, Rotation2d.kZero)
};

private SwerveModulePosition[] m_modulePositions =
private final SwerveModulePosition[] m_modulePositions =
new SwerveModulePosition[] {
new SwerveModulePosition(0, Rotation2d.kZero),
new SwerveModulePosition(0, Rotation2d.kZero),
Expand Down
22 changes: 11 additions & 11 deletions wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private static final class HALJoystickButtons {
}

private static class HALJoystickAxes {
public float[] m_axes;
public final float[] m_axes;
public int m_count;

HALJoystickAxes(int count) {
Expand All @@ -46,7 +46,7 @@ private static class HALJoystickAxes {
}

private static class HALJoystickAxesRaw {
public int[] m_axes;
public final int[] m_axes;

@SuppressWarnings("unused")
public int m_count;
Expand All @@ -57,7 +57,7 @@ private static class HALJoystickAxesRaw {
}

private static class HALJoystickPOVs {
public short[] m_povs;
public final short[] m_povs;
public int m_count;

HALJoystickPOVs(int count) {
Expand Down Expand Up @@ -93,14 +93,14 @@ public enum MatchType {

@SuppressWarnings("MemberName")
private static class MatchDataSender {
StringPublisher gameSpecificMessage;
StringPublisher eventName;
IntegerPublisher matchNumber;
IntegerPublisher replayNumber;
IntegerPublisher matchType;
BooleanPublisher alliance;
IntegerPublisher station;
IntegerPublisher controlWord;
final StringPublisher gameSpecificMessage;
final StringPublisher eventName;
final IntegerPublisher matchNumber;
final IntegerPublisher replayNumber;
final IntegerPublisher matchType;
final BooleanPublisher alliance;
final IntegerPublisher station;
final IntegerPublisher controlWord;
boolean oldIsRedAlliance = true;
int oldStationNumber = 1;
String oldEventName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private static class DataStore implements AutoCloseable {
private int m_refCount;
private int m_reservedMask;
private boolean m_compressorReserved;
public int[] m_oneShotDurMs = new int[PortsJNI.getNumREVPHChannels()];
public final int[] m_oneShotDurMs = new int[PortsJNI.getNumREVPHChannels()];
private final Object m_reserveLock = new Object();

DataStore(int module) {
Expand Down
2 changes: 1 addition & 1 deletion wpilibj/src/main/java/edu/wpi/first/wpilibj/SPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public enum Mode {
}
}

private int m_port;
private final int m_port;

/**
* Constructor.
Expand Down

0 comments on commit 41d8f05

Please sign in to comment.