Don't force public variables to use Hungarian notation (#8774)

People generally have expressed a dislike for the Hungarian notation
used in member variables, especially in examples/templates, and our
styleguide shouldn't be forced on downstream consumers, so this removes
all Hungarian notation from the examples/templates.

There are _some_ benefits to Hungarian for private member variables
(like knowing what's a member vs. local in a PR review) so we'll keep
private member variables the same for now, but public variables should
no longer use Hungarian notation, since it looks much worse. A new PMD
XPath rule has been added to accomplish this goal. Some other
non-compliant variables were fixed for the new rule.
This commit is contained in:
Gold856
2026-04-25 14:32:08 -04:00
committed by GitHub
parent e7e51c9c05
commit 35e8abedeb
443 changed files with 4584 additions and 4789 deletions

View File

@@ -5,7 +5,6 @@
package org.wpilib.driverstation;
/** Represents a finger on a touchpad. */
@SuppressWarnings("MemberName")
public final class TouchpadFinger {
/** Whether the finger is touching the touchpad. */
public final boolean down;

View File

@@ -66,15 +66,15 @@ public final class DriverStationBackend {
}
private static final class HALJoystickTouchpadFinger {
public float m_x;
public float m_y;
public boolean m_down;
float m_x;
float m_y;
boolean m_down;
}
private static class HALJoystickTouchpad {
public final HALJoystickTouchpadFinger[] m_fingers =
final HALJoystickTouchpadFinger[] m_fingers =
new HALJoystickTouchpadFinger[DriverStationJNI.MAX_JOYSTICK_TOUCHPAD_FINGERS];
public int m_count;
int m_count;
HALJoystickTouchpad() {
for (int i = 0; i < m_fingers.length; i++) {
@@ -84,9 +84,9 @@ public final class DriverStationBackend {
}
private static class HALJoystickTouchpads {
public final HALJoystickTouchpad[] m_touchpads =
final HALJoystickTouchpad[] m_touchpads =
new HALJoystickTouchpad[DriverStationJNI.MAX_JOYSTICK_TOUCHPADS];
public int m_count;
int m_count;
HALJoystickTouchpads() {
for (int i = 0; i < m_touchpads.length; i++) {
@@ -96,13 +96,13 @@ public final class DriverStationBackend {
}
private static final class HALJoystickButtons {
public long m_buttons;
public long m_available;
long m_buttons;
long m_available;
}
private static class HALJoystickAxes {
public final float[] m_axes;
public int m_available;
final float[] m_axes;
int m_available;
HALJoystickAxes(int count) {
m_axes = new float[count];
@@ -110,10 +110,10 @@ public final class DriverStationBackend {
}
private static class HALJoystickAxesRaw {
public final short[] m_axes;
final short[] m_axes;
@SuppressWarnings("unused")
public int m_available;
int m_available;
HALJoystickAxesRaw(int count) {
m_axes = new short[count];
@@ -121,8 +121,8 @@ public final class DriverStationBackend {
}
private static class HALJoystickPOVs {
public final byte[] m_povs;
public int m_available;
final byte[] m_povs;
int m_available;
HALJoystickPOVs(int count) {
m_povs = new byte[count];
@@ -151,7 +151,6 @@ public final class DriverStationBackend {
return "<" + id + ">";
}
@SuppressWarnings("MemberName")
private static class MatchDataSender {
private static final String kSmartDashboardType = "FMSInfo";