Skip to content

Commit

Permalink
Rename MemberName to SymbolName, given it's handling classes too now.
Browse files Browse the repository at this point in the history
SymbolName feels a bit cheesy: symbol is a very javac concept. I'd welcome better suggestions.

PiperOrigin-RevId: 686166562
  • Loading branch information
graememorgan authored and Error Prone Team committed Oct 15, 2024
1 parent 5828416 commit 4f630fc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@
@BugPattern(
severity = WARNING,
summary = "Methods and non-static variables should be named in lowerCamelCase",
altNames = {"MemberName"},
linkType = CUSTOM,
link = "https://google.github.io/styleguide/javaguide.html#s5.2-specific-identifier-names")
public final class MemberName extends BugChecker
public final class IdentifierName extends BugChecker
implements ClassTreeMatcher, MethodTreeMatcher, VariableTreeMatcher {
private static final Supplier<ImmutableSet<Name>> EXEMPTED_CLASS_ANNOTATIONS =
VisitorState.memoize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
import com.google.errorprone.bugpatterns.HashtableContains;
import com.google.errorprone.bugpatterns.HidingField;
import com.google.errorprone.bugpatterns.ICCProfileGetInstance;
import com.google.errorprone.bugpatterns.IdentifierName;
import com.google.errorprone.bugpatterns.IdentityBinaryExpression;
import com.google.errorprone.bugpatterns.IdentityHashMapBoxing;
import com.google.errorprone.bugpatterns.IdentityHashMapUsage;
Expand Down Expand Up @@ -232,7 +233,6 @@
import com.google.errorprone.bugpatterns.LossyPrimitiveCompare;
import com.google.errorprone.bugpatterns.MathAbsoluteNegative;
import com.google.errorprone.bugpatterns.MathRoundIntLong;
import com.google.errorprone.bugpatterns.MemberName;
import com.google.errorprone.bugpatterns.MemoizeConstantVisitorStateLookups;
import com.google.errorprone.bugpatterns.MethodCanBeStatic;
import com.google.errorprone.bugpatterns.MisformattedTestData;
Expand Down Expand Up @@ -1178,6 +1178,7 @@ public static ScannerSupplier warningChecks() {
ForEachIterable.class,
FunctionalInterfaceClash.class,
HardCodedSdCardPath.class,
IdentifierName.class,
ImmutableMemberCollection.class,
ImmutableRefactoring.class,
ImmutableSetForContains.class,
Expand All @@ -1193,7 +1194,6 @@ public static ScannerSupplier warningChecks() {
Java8ApiChecker.class,
LambdaFunctionalInterface.class,
LongLiteralLowerCaseSuffix.class,
MemberName.class,
MethodCanBeStatic.class,
MissingBraces.class,
MissingDefault.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Tests for {@link MemberName}. */
/** Tests for {@link IdentifierName}. */
@RunWith(JUnit4.class)
public class MemberNameTest {
public class IdentifierNameTest {
private final CompilationTestHelper helper =
CompilationTestHelper.newInstance(MemberName.class, getClass());
CompilationTestHelper.newInstance(IdentifierName.class, getClass());
private final BugCheckerRefactoringTestHelper refactoringHelper =
BugCheckerRefactoringTestHelper.newInstance(MemberName.class, getClass());
BugCheckerRefactoringTestHelper.newInstance(IdentifierName.class, getClass());

@Test
public void nameWithUnderscores() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The [Google Java Style Guide §5.2][style] provides rules for naming nembers.
The [Google Java Style Guide §5.2][style] provides rules for naming identifiers.

## Test methods

Expand Down

0 comments on commit 4f630fc

Please sign in to comment.