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

@@ -11,7 +11,6 @@ import java.util.Objects;
*
* <p>Limited to 12 bits of precision.
*/
@SuppressWarnings("MemberName")
public class Color {
/** Red component (0-1). */
public final double red;

View File

@@ -7,7 +7,6 @@ package org.wpilib.util;
import java.util.Objects;
/** Represents colors with 8 bits of precision. */
@SuppressWarnings("MemberName")
public class Color8Bit {
/** Red component (0-255). */
public final int red;

View File

@@ -34,19 +34,15 @@ public enum StructFieldType {
STRUCT("struct", false, false, 0);
/** The name of the data type. */
@SuppressWarnings("MemberName")
public final String name;
/** Indicates if the data type is a signed integer. */
@SuppressWarnings("MemberName")
public final boolean isInt;
/** Indicates if the data type is an unsigned integer. */
@SuppressWarnings("MemberName")
public final boolean isUint;
/** The size (in bytes) of the data type. */
@SuppressWarnings("MemberName")
public final int size;
StructFieldType(String name, boolean isInt, boolean isUint, int size) {

View File

@@ -9,23 +9,18 @@ import java.util.Map;
/** Raw struct schema declaration. */
public class ParsedDeclaration {
/** Type string. */
@SuppressWarnings("MemberName")
public String typeString;
/** Name. */
@SuppressWarnings("MemberName")
public String name;
/** Enum values. */
@SuppressWarnings("MemberName")
public Map<String, Long> enumValues;
/** Array size. */
@SuppressWarnings("MemberName")
public int arraySize = 1;
/** Bit width. */
@SuppressWarnings("MemberName")
public int bitWidth;
/** Default constructor. */

View File

@@ -10,7 +10,6 @@ import java.util.List;
/** Raw struct schema. */
public class ParsedSchema {
/** Declarations. */
@SuppressWarnings("MemberName")
public List<ParsedDeclaration> declarations = new ArrayList<>();
/** Default constructor. */