-
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.
Initialize our
Charsets
constants using the fields in `StandardChar…
…sets`. (followup to cl/655152755, in which I explain why this is safe) (split off from kak's cl/655162746) On the JVM, `StandardCharsets` appears to [bypass](https://github.com/openjdk/jdk/blob/5a8861a3a1b436ce7414176c095c58c9a1e038d6/src/java.base/share/classes/java/nio/charset/StandardCharsets.java#L50) the usual [lookup logic](https://github.com/openjdk/jdk/blob/5a8861a3a1b436ce7414176c095c58c9a1e038d6/src/java.base/share/classes/java/nio/charset/Charset.java#L483), so that save a tiny bit of time (and avoid trashing the one-element cache). On Android, `StandardCharsets` [does the same thing as `Charsets` did up until now](https://cs.android.com/android/platform/superproject/main/+/main:libcore/ojluni/src/main/java/java/nio/charset/StandardCharsets.java;l=52;drc=1fe41f6f569bb17811d7b7ca13a0769ddead2046), but at least we'll now have only one class that does that work instead of doing it twice. RELNOTES=n/a PiperOrigin-RevId: 656144236
- Loading branch information
Showing
2 changed files
with
26 additions
and
24 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