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

@@ -24,19 +24,16 @@ public final class Timestamped{{ TypeName }} {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final {{ java.ValueType }} value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedBoolean {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final boolean value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedBooleanArray {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final boolean[] value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedDouble {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final double value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedDoubleArray {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final double[] value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedFloat {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final float value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedFloatArray {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final float[] value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedInteger {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final long value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedIntegerArray {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final long[] value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedRaw {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final byte[] value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedString {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final String value;
}

View File

@@ -24,18 +24,15 @@ public final class TimestampedStringArray {
/**
* Timestamp in local time base.
*/
@SuppressWarnings("MemberName")
public final long timestamp;
/**
* Timestamp in server time base. May be 0 or 1 for locally set values.
*/
@SuppressWarnings("MemberName")
public final long serverTime;
/**
* Value.
*/
@SuppressWarnings("MemberName")
public final String[] value;
}

View File

@@ -5,31 +5,30 @@
package org.wpilib.networktables;
/** NetworkTables Connection information. */
@SuppressWarnings("MemberName")
public final class ConnectionInfo {
/**
* The remote identifier (as set on the remote node by {@link
* NetworkTableInstance#startClient(String)}).
*/
public final String remote_id;
public final String remoteId;
/** The IP address of the remote node. */
public final String remote_ip;
public final String remoteIp;
/** The port number of the remote node. */
public final int remote_port;
public final int remotePort;
/**
* The last time any update was received from the remote node (same scale as returned by {@link
* NetworkTablesJNI#now()}).
*/
public final long last_update;
public final long lastUpdate;
/**
* The protocol version being used for this connection. This is in protocol layer format, so
* 0x0200 = 2.0, 0x0300 = 3.0).
*/
public final int protocol_version;
public final int protocolVersion;
/**
* Constructor. This should generally only be used internally to NetworkTables.
@@ -42,10 +41,10 @@ public final class ConnectionInfo {
*/
public ConnectionInfo(
String remoteId, String remoteIp, int remotePort, long lastUpdate, int protocolVersion) {
remote_id = remoteId;
remote_ip = remoteIp;
remote_port = remotePort;
last_update = lastUpdate;
protocol_version = protocolVersion;
this.remoteId = remoteId;
this.remoteIp = remoteIp;
this.remotePort = remotePort;
this.lastUpdate = lastUpdate;
this.protocolVersion = protocolVersion;
}
}

View File

@@ -5,7 +5,6 @@
package org.wpilib.networktables;
/** NetworkTables log message. */
@SuppressWarnings("MemberName")
public final class LogMessage {
/** Critical logging level. */
public static final int CRITICAL = 50;

View File

@@ -10,7 +10,6 @@ package org.wpilib.networktables;
* <p>There are different kinds of events. When creating a listener, a combination of event kinds
* can be listened to by building an EnumSet of NetworkTableEvent.Kind.
*/
@SuppressWarnings("MemberName")
public final class NetworkTableEvent {
/** NetworkTable event kind. */
public enum Kind {

View File

@@ -5,7 +5,6 @@
package org.wpilib.networktables;
/** NetworkTables publish/subscribe options. */
@SuppressWarnings("MemberName")
public class PubSubOptions {
/**
* Construct from a list of options.

View File

@@ -5,7 +5,6 @@
package org.wpilib.networktables;
/** NetworkTables time sync event data. */
@SuppressWarnings("MemberName")
public final class TimeSyncEventData {
/**
* Offset between local time and server time, in microseconds. Add this value to local time to get

View File

@@ -24,14 +24,11 @@ public final class TimestampedObject<T> {
}
/** Timestamp in local time base. */
@SuppressWarnings("MemberName")
public final long timestamp;
/** Timestamp in server time base. May be 0 or 1 for locally set values. */
@SuppressWarnings("MemberName")
public final long serverTime;
/** Value. */
@SuppressWarnings("MemberName")
public final T value;
}

View File

@@ -5,7 +5,6 @@
package org.wpilib.networktables;
/** NetworkTables topic information. */
@SuppressWarnings("MemberName")
public final class TopicInfo {
/** Topic handle. */
public final int topic;

View File

@@ -5,7 +5,6 @@
package org.wpilib.networktables;
/** NetworkTables value event data. */
@SuppressWarnings("MemberName")
public final class ValueEventData {
/** Topic handle. Topic.getHandle() can be used to map this to the corresponding Topic object. */
public final int topic;