From 508aaa94d67e4b165305ee28b9131ebf707cb672 Mon Sep 17 00:00:00 2001 From: Jiawei_Tang Date: Fri, 8 Dec 2023 17:48:07 +0800 Subject: [PATCH] [EagerAppCDS] Summary: Testing: Reviewers: Issue: --- jdk/src/share/classes/java/lang/ClassLoader.java | 12 ++---------- .../lang/invoke/lambda/LogGeneratedClassesTest.java | 6 ++++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/jdk/src/share/classes/java/lang/ClassLoader.java b/jdk/src/share/classes/java/lang/ClassLoader.java index 4fde2ba53a8..9aeb53e324e 100644 --- a/jdk/src/share/classes/java/lang/ClassLoader.java +++ b/jdk/src/share/classes/java/lang/ClassLoader.java @@ -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 ClassLoader is an abstract class. Given the () { - @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; diff --git a/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java index 33acc50d667..a169a3db283 100644 --- a/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java +++ b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java @@ -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"); } @@ -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"); } }