Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8294058: Early use of lambda introduced in JDK-8285263 cause startup …
…regressions in 20-b02

Reviewed-by: mullan
  • Loading branch information
cl4es committed Sep 20, 2022
1 parent bb422f5 commit 584de68
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/java.base/share/classes/java/security/SecureClassLoader.java
Expand Up @@ -30,6 +30,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;

/**
* This class extends {@code ClassLoader} with additional support for defining
Expand Down Expand Up @@ -218,16 +219,20 @@ private ProtectionDomain getProtectionDomain(CodeSource cs) {
// that no nameservice lookup is done on the hostname (String comparison
// only), and the fragment is not considered.
CodeSourceKey key = new CodeSourceKey(cs);
return pdcache.computeIfAbsent(key, unused -> {
PermissionCollection perms
= SecureClassLoader.this.getPermissions(cs);
ProtectionDomain pd = new ProtectionDomain(
cs, perms, SecureClassLoader.this, null);
if (DebugHolder.debug != null) {
DebugHolder.debug.println(" getPermissions " + pd);
DebugHolder.debug.println("");
return pdcache.computeIfAbsent(key, new Function<>() {
// Do not turn this into a lambda since it is executed during bootstrap
@Override
public ProtectionDomain apply(CodeSourceKey key) {
PermissionCollection perms
= SecureClassLoader.this.getPermissions(key.cs);
ProtectionDomain pd = new ProtectionDomain(
key.cs, perms, SecureClassLoader.this, null);
if (DebugHolder.debug != null) {
DebugHolder.debug.println(" getPermissions " + pd);
DebugHolder.debug.println("");
}
return pd;
}
return pd;
});
}

Expand Down

1 comment on commit 584de68

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.