Skip to content

Commit

Permalink
[EagerAppCDS] <One-line description of the patch>
Browse files Browse the repository at this point in the history
Summary: <detailed description of the change>

Testing: <how this patch has been tested>

Reviewers: <Github IDs of reviewers>

Issue: <full URL or #github_tag>
  • Loading branch information
jia-wei-tang committed Dec 8, 2023
1 parent 64e5be6 commit 508aaa9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
12 changes: 2 additions & 10 deletions jdk/src/share/classes/java/lang/ClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import java.security.cert.Certificate;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;

/**
* A class loader is an object that is responsible for loading classes. The
* class <tt>ClassLoader</tt> is an abstract class. Given the <a
Expand Down Expand Up @@ -1713,15 +1713,7 @@ protected Package definePackage(String name, String specTitle,
final Package new_pkg = new Package(name, specTitle, specVersion, specVendor,
implTitle, implVersion, implVendor,
sealBase, this);

Function getNewPkg = new Function<Object, Object>() {
@Override
public java.lang.Object apply(java.lang.Object t) {
return new_pkg;
}
};

if (packages.computeIfAbsent(name, getNewPkg) != new_pkg) {
if (packages.computeIfAbsent(name, key -> new_pkg) != new_pkg) {
throw new IllegalArgumentException(name);
}
return pkg;
Expand Down
6 changes: 4 additions & 2 deletions jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ public void testLogging() throws IOException {
"-Djava.security.manager",
"com.example.TestLambda");
// dump/com/example + 2 class files
assertEquals(Files.walk(Paths.get("dump")).count(), 5, "Two lambda captured");
// dump/java/lang + 1 class file
assertEquals(Files.walk(Paths.get("dump")).count(), 8, "Two lambda captured");
tr.assertZero("Should still return 0");
}

Expand Down Expand Up @@ -236,7 +237,8 @@ public void testLoggingException() throws IOException {
.count(),
2, "show error each capture");
// dumpLong/com/example/nosense/nosense
assertEquals(Files.walk(Paths.get("dumpLong")).count(), 5, "Two lambda captured failed to log");
// dumpLong/java/lang + 1 file
assertEquals(Files.walk(Paths.get("dumpLong")).count(), 8, "Two lambda captured failed to log");
tr.assertZero("Should still return 0");
}
}

0 comments on commit 508aaa9

Please sign in to comment.