Suggested Error Prone pattern: NumberFormatContstant (like existing DateFormatConstant)
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
> ATTENTION! Please read and follow:
> - if this is a _question_ about Error Prone, send it to error-prone-discuss@googlegroups.com
> - if this is a _bug_ or _feature request_, fill the form below as best as you can.
### Description of the problem / feature request:
The existing pattern for DateFormatConstant (along with its fix, adding a ThreadLocal initializer) should be adapted to also support NumberFormat and DecimalFormat. There may also be other common thread-unsafe Format classes that would make sense to treat similarly.
### Feature requests: what underlying problem are you trying to solve with this feature?
Similar to DateFormat, NumberFormat is not threadsafe.
### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
```java
class Foo {
public static NumberFormat FORMAT = NumberFormat.getInstance()
// call FORMAT.format() from multiple threads concurrently and wait for things to go wrong
}
```
### What version of Error Prone are you using?
2.3.3
### Have you found anything relevant by searching the web?
Here's a discussion on the java bugtracker https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4101500
Contributor guide
Assessment
This issue has not been assessed yet.