google / google/error-prone

InconsistentCapitalization warning for names in different scopes

Open
#1,033 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

### What version of Error Prone are you using?

Master

### Does this issue reproduce with the latest release?

Yes

### What did you do?

```java
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](http://errorprone.info/bugpattern/InconsistentCapitalization) 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.