google / google/error-prone

UnsynchronizedOverridesSynchronized is not restricted to immediate parent

Open
#455 0 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

The following code triggers UnsynchronizedOverridesSynchronized:

``` java
java.util.logging.ConsoleHandler stdout = new java.util.logging.ConsoleHandler() {
@Override
public void publish(java.util.logging.LogRecord record) {
if (!stderr.isLoggable(record)) {
super.publish(record);
}
}
};
```

But in this case the synchronized keyword has been already removed in the class we extend (java.util.logging.ConsoleHandler) and can only be found in grandparent class (java.util.logging.StreamHandler).

So we think this check should be restricted to immediate super class, and not the whole ancestry tree.

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.