google / google/error-prone

Consider splitting HidingField into two bugpatterns

Open
#979 4 comments 0 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?
2.2.0

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

### What did you do?

```java
class Configuration {
}

class FooConfiguration extends Configuration {
}

class Super {
protected Configuration foo;
}

class Sub extends Super {
protected FooConfiguration foo;
}
```
While it is true that users of the Sub class can't interact with the 'foo' from the Super class, it is often not an issue if the field's type is a subtype of superclass's field's type. Maybe HidingField could be split into two bugpatterns, one where the field's type is a subtype, and one where not.

### What did you expect to see?
No HidingField warning

### What did you see instead?
A HidingField warning

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.