From e849b75d05deefaf718eba85f84ee421c295588d Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Tue, 16 Jul 2024 20:53:43 +0300 Subject: [PATCH] Handle new format of used_classes_* reports in GraalVM for JDK 24 Starting with GraalVM for JDK 24 the format of the report has changed prefixing each line with the class loader name and a colon, e.g.: GraalVM for JDK 22 (and 23 which is not released yet): ``` org.postgresql.jdbc.PgSQLXML ``` GraalVM for JDK 24: ``` com.oracle.svm.hosted.NativeImageClassLoader:org.postgresql.jdbc.PgSQLXML ``` Closes https://github.com/quarkusio/quarkus/issues/41917 --- .../quarkus/test/junit/nativeimage/ClassInclusionReport.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/nativeimage/ClassInclusionReport.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/nativeimage/ClassInclusionReport.java index c571d86f8f99a..78da8657e4afd 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/nativeimage/ClassInclusionReport.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/nativeimage/ClassInclusionReport.java @@ -37,7 +37,10 @@ public static ClassInclusionReport load() { TreeSet set = new TreeSet<>(); try (Scanner scanner = new Scanner(usedClassesReport.toFile())) { while (scanner.hasNextLine()) { - set.add(scanner.nextLine()); + // Starting with GraalVM for JDK 24 the format of the report has changed prefixing each line with + // the class loader name and a colon. We need to strip that part. + String[] line = scanner.nextLine().split(":"); + set.add(line[line.length - 1]); } } catch (FileNotFoundException e) { throw new RuntimeException("Could not load used classes report", e);