google / google/error-prone

DateFormatConstant check should not warn for fields annotated by GuardedBy

Open
#906 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

Looks like the new DateFormatConstant check does not account for other thread safety annotations.

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

2.2.0

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

Yes

### What did you do?

Compiled code like this:
```java
@ThreadSafe
public class A {

@GuardedBy("A.class")
private static final DateFormat DATE_FORMAT =
new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.US);
}
```

### What did you expect to see?

No warning, since there are explicit `@ThreadSafe` and `@GuardedBy` annotations.

### What did you see instead?

A warning from the DateFormatConstant check.

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.