-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make a class initialization deadlock more impossible
The following field create a class initialization cycle, since `Base64Encoding` extends `BaseEncoding`: ``` private static final BaseEncoding BASE64_URL = new Base64Encoding(...); ``` In practice this example is probably harmless, because `Base64Encoding` is already package-private and there are no references outside this file. Making it explicitly private makes it more obviously correct (to Error Prone, and hopefully also to human readers), since it ensures the only way to get an instance of `Base64Encoding` is to first initialize `BaseEncoding`. See also https://errorprone.info/bugpattern/ClassInitializationDeadlock RELNOTES=N/A PiperOrigin-RevId: 616154233
- Loading branch information
Showing
2 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters