RFR: 8351556: Optimize Location.locationFor/isModuleOrientedLocation [v2]
Aleksey Shipilev
shade at openjdk.org
Mon Mar 10 19:49:54 UTC 2025
On Mon, 10 Mar 2025 19:32:43 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/java.compiler/share/classes/javax/tools/StandardLocation.java line 119:
>>
>>> 117: private static final ConcurrentHashMap<String, Location> LOCATIONS = new ConcurrentHashMap<>();
>>> 118:
>>> 119: private static class LazyPatternHolder {
>>
>> Should we keep this as a local class in `computeIsModuleOrientedLocation` as it is only used in that method??
>
> Even better, we can move this static utility `computeIsModuleOrientedLocation` into the `new Location` anonymous class and convert it to a local class; that way we define one fewer class as well.
Problem is, I need to reach the compiled `Pattern` from `JavaFileManager.Location.isModuleOrientedLocation`. So I need to make sure there is no extra leakage within the package. A single package-private static method is the smallest hole I can drill. I can take a closer look tomorrow, but it feels more reliable this way.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23973#discussion_r1987922265
More information about the compiler-dev
mailing list