diff options
6 files changed, 53 insertions, 2 deletions
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; @@ -152,6 +153,16 @@ public class StatefulNameEnvironment implements IModuleAwareNameEnvironment { } @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 @@ </run> </ajc-test> + <ajc-test dir="bugs199/add_exports" title="use --add-exports" vm="9"> + <compile files="Application.java" options="-11 --add-exports java.base/sun.security.x509=ALL-UNNAMED" /> + <run class="Application" vmargs="--add-exports java.base/sun.security.x509=ALL-UNNAMED"> + <stdout> + <line text="java.security.cert.CertificateParsingException: java.io.IOException"/> + </stdout> + </run> + </ajc-test> + </suite> |