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

@@ -13,6 +13,7 @@ import java.util.List;
import org.junit.jupiter.api.Test;
class CleanupPoolTest {
@SuppressWarnings("PMD.PublicFieldNamingConvention")
static class AutoCloseableObject implements AutoCloseable {
public boolean m_closed;

View File

@@ -10,6 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
class ReflectionCleanupTest {
@SuppressWarnings("PMD.PublicFieldNamingConvention")
static class CleanupClass implements AutoCloseable {
public boolean m_closed;
@@ -19,7 +20,7 @@ class ReflectionCleanupTest {
}
}
@SuppressWarnings("PMD.TestClassWithoutTestCases")
@SuppressWarnings({"PMD.TestClassWithoutTestCases", "PMD.PublicFieldNamingConvention"})
static class CleanupTest implements ReflectionCleanup {
public CleanupClass m_class1 = new CleanupClass();
public CleanupClass m_class2 = new CleanupClass();
@@ -32,6 +33,7 @@ class ReflectionCleanupTest {
}
}
@SuppressWarnings("PMD.PublicFieldNamingConvention")
static class CleanupTest2 extends CleanupTest {
@SkipCleanup public CleanupClass m_class3 = new CleanupClass();
public CleanupClass m_class4 = new CleanupClass();

View File

@@ -20,7 +20,6 @@ import org.junit.jupiter.params.provider.MethodSource;
@SuppressWarnings("AvoidEscapedUnicodeCharacters")
class DynamicStructTest {
@SuppressWarnings("MemberName")
private StructDescriptorDatabase db;
@BeforeEach