google / google/error-prone

GuardedByChecker - should it take in to account assert Thread.holdsLock()?

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

Description

Question: should this code:

```
int getValue() {
assert Thread.holdsLock(this);
return this.value;
}
```

ever generate this error:

```
error: [GuardedByChecker] This access should be guarded by 'this', which is not currently held
```

In other words:
- Does error-prone "believe" assertions in the code?
- Does it understand the meaning of `Thread.holdsLock()`?

FYI I filed a [similar issue](https://sourceforge.net/p/findbugs/feature-requests/360/) against FindBugs.

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.