From 2739de2d6a87842495258725ef5ee8216cc24006 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 13 Sep 2023 20:31:32 +0200 Subject: [PATCH] Look for AddExports in Suite.SuiteClasses --- .../oracle/mxtool/junit/ModuleSupport.java | 26 ++++++++++++++++++- mx.mx/suite.py | 3 +++ mx.py | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/java/com.oracle.mxtool.junit.jdk9/src/com/oracle/mxtool/junit/ModuleSupport.java b/java/com.oracle.mxtool.junit.jdk9/src/com/oracle/mxtool/junit/ModuleSupport.java index 2d4fc640..5b50a3ce 100644 --- a/java/com.oracle.mxtool.junit.jdk9/src/com/oracle/mxtool/junit/ModuleSupport.java +++ b/java/com.oracle.mxtool.junit.jdk9/src/com/oracle/mxtool/junit/ModuleSupport.java @@ -35,6 +35,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.junit.runners.Suite; + import jdk.internal.module.Modules; class ModuleSupport { @@ -45,7 +47,13 @@ class ModuleSupport { this.out = out; } - void processAddExportsAnnotations(Set> classes, Set opened, Set exported) { + void processAddExportsAnnotations(Set> requestClasses, Set opened, Set exported) { + Set> classes = new HashSet<>(); + + for (Class cls : requestClasses) { + gatherClasses(cls, classes); + } + Set> types = new HashSet<>(); for (Class cls : classes) { gatherSupertypes(cls, types); @@ -68,6 +76,22 @@ void processAddExportsAnnotations(Set> classes, Set opened, Set } } + /** + * Recursively looks through the given base class for {@code Suite.SuiteClasses} annotations and + * adds all classes to the set. + */ + private void gatherClasses(Class base, Set> classes) { + if (!classes.contains(base)) { + classes.add(base); + Suite.SuiteClasses annot = base.getDeclaredAnnotation(Suite.SuiteClasses.class); + if (annot != null) { + for (Class cls : annot.value()) { + gatherClasses(cls, classes); + } + } + } + } + void processAddModulesAnnotations(Set> classes) { Set> types = new HashSet<>(); for (Class cls : classes) { diff --git a/mx.mx/suite.py b/mx.mx/suite.py index 2329339e..af1cb4ff 100644 --- a/mx.mx/suite.py +++ b/mx.mx/suite.py @@ -880,6 +880,9 @@ "com.oracle.mxtool.junit.jdk9" : { "subDir" : "java", "sourceDirs" : ["src"], + "dependencies" : [ + "JUNIT", + ], "requiresConcealed" : { "java.base" : [ "jdk.internal.module", diff --git a/mx.py b/mx.py index 99779b92..4697ee17 100755 --- a/mx.py +++ b/mx.py @@ -18789,7 +18789,7 @@ def alarm_handler(signum, frame): abort(1, killsig=signal.SIGINT) # The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue -version = VersionSpec("6.49.1") # fetch-jdk labsjdk-ee-latest +version = VersionSpec("6.50.0") # GR-48667 Scan SuiteClasses for @AddExports _mx_start_datetime = datetime.utcnow() _last_timestamp = _mx_start_datetime