RFR: 8366040: Change URL.lookupViaProviders to use ScopedValue to detect recursive lookup [v2]

Volkan Yazici vyazici at openjdk.org
Tue Oct 7 08:15:48 UTC 2025


On Fri, 3 Oct 2025 17:12:49 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> src/java.base/share/classes/java/net/URL.java line 1402:
>> 
>>> 1400:             throw new Error("Circular loading of URL stream handler providers detected");
>>> 1401:         }
>>> 1402:         return ScopedValue.where(IN_LOOKUP, true).call(() -> {
>> 
>> We should never reach here if the VM is not booted, or if the protocol is `file:` or `jrt:` - so it may be safe to use a lambda. The alternative would be to use an anonymous class and create a `new Runnable() { ... }` but it's probably not needed.
>
> The changes to URL look okay but good to run any startup benchmarks to check startup performance.

Run benchmarks comparing 2e783963d21 (of `master`) with 97d012eac25 on several platforms, and did not notice any noteworthy regressions.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27623#discussion_r2409781269


More information about the net-dev mailing list