Skip to content

InconsistentCapitalization warning for names in different scopes #1033

@msridhar

Description

@msridhar

What version of Error Prone are you using?

Master

Does this issue reproduce with the latest release?

Yes

What did you do?

class Foo {
  private String testID;
  static final class Inner {
    Inner(String testId) {}
  }
}

What did you expect to see?

No warning.

What did you see instead?

Foo.java:4: warning: [InconsistentCapitalization] Found the field 'testID' with the same name as the parameter 'testId' but with different capitalization.
    Inner(String testId) {}
                 ^
    (see https://errorprone.info/bugpattern/InconsistentCapitalization.md)
  Did you mean 'Inner(String testID) {}'?

According to the docs the check is supposed to find "two or more variables under the same scope that differ only in capitalization." The word "under" is a bit ambiguous. If it means "in the same scope," then the above may be a bug as the names are not in the same scope. If "under" means something else, might be good to clarify.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions