From: Alexander Kriegisch Date: Sun, 27 Mar 2022 05:57:19 +0000 (+0700) Subject: Add test case + experimental fix for AJC option '--add-exports' X-Git-Tag: V1_9_9_1~5^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8a933427ec77859a40c5cd9c55226bbe6f9d736a;p=aspectj.git Add test case + experimental fix for AJC option '--add-exports' I am expecting the test case to pass, but other tests to fail. This temporary commit is meant to create feedback from GitHub CI test runs. Signed-off-by: Alexander Kriegisch --- diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 08bf00d54..c1bc570cc 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -1044,7 +1044,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour for (int i = 0; i < cps.size(); i++) { classpaths[i] = cps.get(i); } - FileSystem fileSystem = getLibraryAccess(classpaths, filenames); + //FileSystem fileSystem = getLibraryAccess(classpaths, filenames); + // TODO: This will probably fail other tests, it is just an experiment + FileSystem fileSystem = buildConfig.getBuildArgParser().getLibraryAccess(); environment = new StatefulNameEnvironment(fileSystem, state.getClassNameToFileMap(), state); state.setFileSystem(fileSystem); state.setNameEnvironment(environment); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java index 0af411be3..dad61e7b2 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java @@ -27,6 +27,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFormatExcepti import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IModule; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment; +import org.aspectj.org.eclipse.jdt.internal.compiler.env.IUpdatableModule; import org.aspectj.org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; import org.aspectj.util.FileUtil; @@ -151,6 +152,16 @@ public class StatefulNameEnvironment implements IModuleAwareNameEnvironment { return baseEnvironment.getModule(moduleName); } + @Override + public void applyModuleUpdates(IUpdatableModule module, IUpdatableModule.UpdateKind kind) { + baseEnvironment.applyModuleUpdates(module, kind); + } + + @Override + public char[][] getUniqueModulesDeclaringPackage(char[][] packageName, char[] moduleName) { + return baseEnvironment.getUniqueModulesDeclaringPackage(packageName, moduleName); + } + @Override public char[][] getAllAutomaticModules() { return baseEnvironment.getAllAutomaticModules(); diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java index 7a1ad855b..0aa9a81db 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java @@ -699,7 +699,15 @@ public abstract class AjcTestCase extends TestCase { e.printStackTrace(); } return lastRunResult; - } else if (vmargs!=null && (vmargs.contains("--enable-preview") || vmargs.contains("--add-modules") || vmargs.contains("--limit-modules") || vmargs.contains("--add-reads"))) { + } else if ( + vmargs != null && ( + vmargs.contains("--enable-preview") || + vmargs.contains("--add-modules") || + vmargs.contains("--limit-modules") || + vmargs.contains("--add-reads") || + vmargs.contains("--add-exports") + ) + ) { // If --add-modules supplied, need to fork the test try { // if (mp.indexOf("$runtime") != -1) { diff --git a/tests/bugs199/add_exports/Application.java b/tests/bugs199/add_exports/Application.java new file mode 100644 index 000000000..88bd177aa --- /dev/null +++ b/tests/bugs199/add_exports/Application.java @@ -0,0 +1,17 @@ +import sun.security.x509.X509CertInfo; + +import java.security.cert.CertificateParsingException; + +/** + * https://github.com/mojohaus/aspectj-maven-plugin/issues/139 + */ +public class Application { + public static void main(String[] args) { + try { + new X509CertInfo(new byte[0]); + } + catch (CertificateParsingException e) { + System.out.println(e); + } + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java index b83448935..a9f7f3023 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java @@ -61,6 +61,10 @@ public class Bugs199Tests extends XMLBasedAjcTestCase { runTest("asynchronous proceed for nested around-advice (native, thread pool)"); } + public void testAddExports() { + runTest("use --add-exports"); + } + public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Bugs199Tests.class); } diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml index 7baeea086..9a9ac2d47 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml @@ -515,4 +515,13 @@ + + + + + + + + +