]> source.dussan.org Git - aspectj.git/commitdiff
Updated with Java12 support
authorAndy Clement <aclement@pivotal.io>
Wed, 3 Apr 2019 17:23:44 +0000 (10:23 -0700)
committerAndy Clement <aclement@pivotal.io>
Wed, 3 Apr 2019 17:23:44 +0000 (10:23 -0700)
35 files changed:
.gitignore
ajdoc/src/test/java/org/aspectj/tools/ajdoc/AJDocConstants.java [new file with mode: 0644]
ajdoc/src/test/java/org/aspectj/tools/ajdoc/BugTest.java
ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java
ajdoc/src/test/java/org/aspectj/tools/ajdoc/DeclareFormsTest.java
bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java
bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java
docs/dist/doc/README-193.html
org.aspectj.ajdt.core/src/main/resources/org/aspectj/ajdt/ajc/messages.properties
org.aspectj.ajdt.core/src/test/java/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java
org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
org.eclipse.jdt.core/jdtcore-for-aspectj.jar
taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java
testing/src/test/java/org/aspectj/testing/AjcTest.java
testing/src/test/java/org/aspectj/testing/AntSpec.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java
testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java [new file with mode: 0644]
tests/bugs190/modules/ggg/foo2.jar [new file with mode: 0644]
tests/features193/Switch1.java [new file with mode: 0644]
tests/features193/Switch2.java [new file with mode: 0644]
tests/features193/Switch3.java [new file with mode: 0644]
tests/java5/ataspectj/ajc-ant.xml
tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java
tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java
tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java
tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java
tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java
tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java
tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java [new file with mode: 0644]
tests/src/test/resources/org/aspectj/systemtest/ajc190/ajc190.xml
tests/src/test/resources/org/aspectj/systemtest/ajc193/ajc193.xml
util/src/main/java/org/aspectj/util/LangUtil.java
weaver/src/test/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java

index 741abf18ba8b3d7734b6315fede2d820f9dcf94f..1129188461defbdc1723708955d703b32c41d8d7 100644 (file)
@@ -1,4 +1,5 @@
 */bin
+*/pom.xml.versionsBackup
 log.txt
 .vscode
 .DS_Store
diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AJDocConstants.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AJDocConstants.java
new file mode 100644 (file)
index 0000000..50bddfb
--- /dev/null
@@ -0,0 +1,18 @@
+/* *******************************************************************
+ * Copyright (c) 2019 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ * ******************************************************************/
+package org.aspectj.tools.ajdoc;
+
+/**
+ * @author Andy Clement
+ */
+public class AJDocConstants {
+
+       public final static String VERSION = "1.7";
+       
+}
index 6caf5d79db4346f8d067167a340708c89332bb66..6cbec3ebeba9774a533bb06f8333756b3e8e8462 100644 (file)
@@ -69,7 +69,7 @@ public class BugTest extends AjdocTestCase {
                initialiseProject("pr148906");
                File[] files = {new File(getAbsoluteProjectDir() + "/C.java")};
                String[] ajOptions = {new String("-aspectpath"), new String(getAbsoluteProjectDir() + File.separator + "simple.jar")};
-               runAjdoc(files,"1.6",ajOptions);
+               runAjdoc(files,AJDocConstants.VERSION,ajOptions);
                assertFalse("expected clean build of project but found that build aborted",Main.hasAborted());
                File html = new File(getAbsolutePathOutdir() + File.separator + "C.html");
                if (!html.exists()) {
@@ -90,7 +90,7 @@ public class BugTest extends AjdocTestCase {
                initialiseProject("pr148906");
                File[] files = {new File(getAbsoluteProjectDir() + "/C.java")};
                String[] ajOptions = {new String("-outxml"),new String("-aspectpath"), new String(getAbsoluteProjectDir() + File.separator + "simple.jar")};
-               runAjdoc(files,"1.6",ajOptions);
+               runAjdoc(files,AJDocConstants.VERSION,ajOptions);
                assertFalse("expected clean build of project but found that build aborted",Main.hasAborted());
                File html = new File(getAbsolutePathOutdir() + File.separator + "C.html");
                if (!html.exists()) {
index 70aaa8b35311d71482c6c7e8778d1e61e72ec30e..c92e96d2e510000adf72ad84a5d0dd76ad75734d 100644 (file)
@@ -87,7 +87,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
        public void testAJdocHasAspectTitle() throws Exception {
                File[] files = {new File(getAbsoluteProjectDir() + "/pkg/A.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
         File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/A.html");
                if (!htmlFile.exists()) {
                        fail("couldn't find " + htmlFile.getAbsolutePath()+ " - were there compilation errors?");
@@ -101,7 +101,7 @@ public class CoverageTestCase extends AjdocTestCase {
         */
        public void testAJdocHasClassTitle() throws Exception {
                File[] files = {new File(getAbsoluteProjectDir() + "/pkg/C.java")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
         File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/C.html");
                if (!htmlFile.exists()) {
                        fail("couldn't find " + htmlFile.getAbsolutePath()+ " - were there compilation errors?");
@@ -117,7 +117,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testInnerAspect() throws Exception {
        File[] files = {file1, file2};
-        runAjdoc("private","1.6",files);
+        runAjdoc("private",AJDocConstants.VERSION,files);
             
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/ClassA.InnerAspect.html");
                if (!htmlFile.exists()) {
@@ -205,7 +205,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdviceNamingCoverage() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/AdviceNamingCoverage.html");
                if (!htmlFile.exists()) {
@@ -237,7 +237,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisesRelationshipCoverage() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/AdvisesRelationshipCoverage.html");
                if (!htmlFile.exists()) {
@@ -290,7 +290,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisedByMethodExecution() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html");
                if (!htmlFile.exists()) {
@@ -321,7 +321,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisedByConstructorExecution() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html");
                if (!htmlFile.exists()) {
@@ -358,7 +358,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisedByMethodCall() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html");
                if (!htmlFile.exists()) {
@@ -389,7 +389,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisedByConstructorCall() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html");
                if (!htmlFile.exists()) {
@@ -420,7 +420,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisedByGet() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html");
                if (!htmlFile.exists()) {
@@ -451,7 +451,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisedBySet() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html");
                if (!htmlFile.exists()) {
@@ -500,7 +500,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisedByInitialization() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html");
                if (!htmlFile.exists()) {
@@ -532,7 +532,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisedByStaticInitialization() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html");
                if (!htmlFile.exists()) {
@@ -553,7 +553,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testAdvisedByHandler() throws Exception {
        File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point.html");
                if (!htmlFile.exists()) {
@@ -591,7 +591,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testTwoBeforeAdvice() throws Exception {
        File[] files = {new File(getAbsoluteProjectDir() + "/pkg/A2.aj")};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/C2.html");
                if (!htmlFile.exists()) {
@@ -637,7 +637,7 @@ public class CoverageTestCase extends AjdocTestCase {
      */
     public void testNoSpuriousAdvisedByRels() throws Exception {
                File[] files = {file4};
-       runAjdoc("private","1.6",files);
+       runAjdoc("private",AJDocConstants.VERSION,files);
        
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/AdvisesRelationshipCoverage.html");
                if (!htmlFile.exists()) {
@@ -666,7 +666,7 @@ public class CoverageTestCase extends AjdocTestCase {
         */
        public void testNestedAspect() throws Exception {
                File[] files = {file9};
-               runAjdoc("private","1.6",files);        
+               runAjdoc("private",AJDocConstants.VERSION,files);       
                
               File htmlFile = new File(getAbsolutePathOutdir() + "/PkgVisibleClass.NestedAspect.html");
                        if (!htmlFile.exists()) {
@@ -748,7 +748,7 @@ public class CoverageTestCase extends AjdocTestCase {
         */
        public void testNestedAspectWithSimilarName() throws Exception {
        File[] files = {new File(getAbsoluteProjectDir() + "/pkg/ClassWithNestedAspect.java")};
-        runAjdoc("private","1.6",files);
+        runAjdoc("private",AJDocConstants.VERSION,files);
             
         File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/ClassWithNestedAspect.NestedAspect.html");
                if (!htmlFile.exists()) {
@@ -829,7 +829,7 @@ public class CoverageTestCase extends AjdocTestCase {
         */
        public void testAdviceInNestedAspect() throws Exception {
        File[] files = {new File(getAbsoluteProjectDir() + "/pkg/ClassWithNestedAspect.java")};
-        runAjdoc("private","1.6",files);
+        runAjdoc("private",AJDocConstants.VERSION,files);
             
         File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/ClassWithNestedAspect.NestedAspect.html");
                if (!htmlFile.exists()) {
@@ -860,7 +860,7 @@ public class CoverageTestCase extends AjdocTestCase {
         */
        public void testAdvisedByInNestedAspect() throws Exception {
        File[] files = {new File(getAbsoluteProjectDir() + "/pkg/ClassWithNestedAspect.java")};
-        runAjdoc("private","1.6",files);
+        runAjdoc("private",AJDocConstants.VERSION,files);
             
         File htmlFile = new File(getAbsolutePathOutdir() + "/pkg/ClassWithNestedAspect.html");
                if (!htmlFile.exists()) {
index 8dc4c24fe65ee45e04464169af8e894358b401e8..ea477d6994bb63b33918a6a6700a2bf180331415 100644 (file)
@@ -49,7 +49,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testDeclareStatments() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareCoverage2.html");
                if (!htmlFile.exists()) {
@@ -84,7 +84,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testDeclareWarning() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareCoverage2.html");
                if (!htmlFile.exists()) {
@@ -116,7 +116,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testMatchesDeclareCall() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Main2.html");
                if (!htmlFile.exists()) {
@@ -148,7 +148,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testMatchesDeclareExecution() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point2.html");
                if (!htmlFile.exists()) {
@@ -181,7 +181,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testDeclareParents() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareCoverage2.html");
                if (!htmlFile.exists()) {
@@ -212,7 +212,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testAspectDeclarations() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Point2.html");
                if (!htmlFile.exists()) {
@@ -235,7 +235,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testDeclareSoft() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareCoverage2.html");
                if (!htmlFile.exists()) {
@@ -266,7 +266,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testSoftenedBy() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareCoverage2.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/Main2.html");
                if (!htmlFile.exists()) {
@@ -305,7 +305,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testDeclareAnnotation() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtType.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                        
                // Aspect AnnotationTest should contain within it's declare
            // detail and summary the declare annotation statement.
@@ -351,7 +351,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testMethodAnnotatedBy() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtMethod.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html");
                if (!htmlFile.exists()) {
@@ -384,7 +384,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testConstructorAnnotatedBy() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtConstructor.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html");
                if (!htmlFile.exists()) {
@@ -418,7 +418,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testFieldAnnotatedBy() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtField.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html");
                if (!htmlFile.exists()) {
@@ -452,7 +452,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testTypeAnnotatedBy() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareAtType.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
 
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html");
                if (!htmlFile.exists()) {
@@ -475,7 +475,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testMatchesDeclareAndAdvisedBy() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "A.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/C.html");
                if (!htmlFile.exists()) {
@@ -521,7 +521,7 @@ public class DeclareFormsTest extends AjdocTestCase {
        public void testTwoDeclareParents() throws Exception {
                initialiseProject("declareForms");
                File[] files = {new File(getAbsoluteProjectDir() + File.separatorChar + "DeclareParents.aj")};
-               runAjdoc("private","1.6",files);
+               runAjdoc("private",AJDocConstants.VERSION,files);
                
         File htmlFile = new File(getAbsolutePathOutdir() + "/foo/DeclareParents.html");
                if (!htmlFile.exists()) {
index c75496527bdad0bb528821f34dea070073219e5f..c0c0930b095346f9c22887852985df69295ada22 100644 (file)
@@ -86,6 +86,11 @@ public interface Constants {
        public final static short MINOR_10 = 0;
        public final static short MAJOR_11 = 55;
        public final static short MINOR_11 = 0;
+       public final static short MAJOR_12 = 56;
+       public final static short MINOR_12 = 0;
+       
+       public final static int PREVIEW_MINOR_VERSION = 65535;
+       
        // Defaults
        public final static short MAJOR = MAJOR_1_1;
        public final static short MINOR = MINOR_1_1;
index a66e9c58a0d0a3d617e27f504402018f1de023b6..9d15e81f401ea74b3e2dda37cad894ac2f2e74bc 100644 (file)
@@ -226,7 +226,8 @@ public class ClassPath implements Serializable {
                }
 
                // On Java9 the sun.boot.class.path won't be set. System classes accessible through JRT filesystem 
-        if (vm_version.startsWith("9") || vm_version.startsWith("10") || vm_version.startsWith("11")) {
+        if (vm_version.startsWith("9") || vm_version.startsWith("10")
+               || vm_version.startsWith("11") || vm_version.startsWith("12")) {
                        buf.insert(0, File.pathSeparatorChar);
                        buf.insert(0, System.getProperty("java.home") + File.separator + "lib" + File.separator + JRT_FS);                      
         }
index 6bcf89e7541f42e09cff79279cd52ed8bd509990..f9cc4d0cf474f75a228177bde8452f176881825d 100644 (file)
@@ -20,6 +20,72 @@ All rights reserved.
 <p>The full list of resolved issues in 1.9.3 is available 
 <a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&f0=OP&f1=OP&f3=CP&f4=CP&j1=OR&list_id=16866879&product=AspectJ&query_format=advanced&target_milestone=1.9.3">here</a></h2>.</p>
 
+<p>AspectJ 1.9.3 supports Java12. Java12 introduces the new switch expression syntax, but you must activate support for that via 
+an <tt>--enable-preview</tt> flag when using the compiler and attempting to run the resultant classes:
+
+Here is <tt>Switch3.java</tt>:
+<pre><code>
+=========8<=========
+public class Switch3 {
+       public static void main(String[] argv) {
+               System.out.println(one(Color.R));
+               System.out.println(one(Color.G));
+               System.out.println(one(Color.B));
+               System.out.println(one(Color.Y));
+       }
+
+       public static int one(Color color) {
+               int result = switch(color) {
+                case R -> foo(0);
+                case G -> foo(1);
+                case B -> foo(2);
+                default -> foo(3);
+               };
+               return result;
+       }
+       
+       public static final int foo(int i) {
+               return i+1;
+       }
+}
+
+enum Color {
+       R, G, B, Y;
+}
+
+aspect X {
+       int around(): call(* foo(..)) {
+               return proceed()*3;
+       }
+}
+=========8<=========
+</code></pre>
+
+Compile it with:
+<pre><code>
+$ ajc --enable-preview -showWeaveInfo -12 Switch3.java
+
+Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:12) advised by around advice from 'X' (Switch3.java:30)
+
+Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:13) advised by around advice from 'X' (Switch3.java:30)
+
+Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:14) advised by around advice from 'X' (Switch3.java:30)
+
+Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:15) advised by around advice from 'X' (Switch3.java:30)
+
+</code></pre>
+
+Now run it:
+<pre><code>
+$ java --enable-preview Switch3
+3
+6
+9
+12
+</code></pre>
+
+
+
 <p>Available: 1.9.3.RC1 available 7-Mar-2019</p>
 
 <br><br>
index e9f6b6d650d1b8add08e54f143f340ca069e2522..b6de28ebb3abd1b511d746cfd5124da6a52f2c38 100644 (file)
@@ -5,7 +5,7 @@
      org/aspectj/weaver/XlintDefault.properties for the default behavior and a template to copy. 
 ### AspectJ-specific messages 
 compiler.name = AspectJ Compiler
-compiler.version = Eclipse Compiler #6373b82afa49b(1-Oct-2018), 3.16
+compiler.version = Eclipse Compiler #a9ab0710a01b2b(28-Mar-2019), 3.18
 compiler.copyright = 
 
 
index a60c9d9f7ffb8b2697b7141a9b3ddee84d663be5..776bf1bc283f652c85cbf4098a4defcf53921016 100644 (file)
@@ -57,18 +57,17 @@ public class AjBuildManagerTest extends TestCase {
                super(name);
        }
 
-       public void testSimpleStructure() throws IOException /* , CoreException */{
+       public void testSimpleStructure() throws IOException {
                AjBuildManager manager = new AjBuildManager(messageWriter);
                BuildArgParser parser = new BuildArgParser(messageWriter);
                String javaClassPath = System.getProperty("java.class.path");
-               System.out.println(javaClassPath);
                String sandboxName = TestUtil.createEmptySandbox().getAbsolutePath();
                AjBuildConfig buildConfig = parser.genBuildConfig(new String[] { "-d", sandboxName, "-1.4", "-classpath", javaClassPath,
                                Constants.TESTDATA_PATH + "/src1/A.java",
                // EajcModuleTests.TESTDATA_PATH + "/src1/Hello.java",
                                });
                String err = parser.getOtherMessages(true);
-               assertTrue(err, null == err);
+               assertTrue(err, null == err || err.startsWith("incorrect classpath") && err.endsWith("run-all-junit-tests/target/classes"));
                // manager.setStructureModel(AsmManager.getDefault().getHierarchy());
                MessageHandler handler = new MessageHandler();
                manager.batchBuild(buildConfig, handler);
index c8b61bd49c70b2e8d6539512dd516d6c02740bdf..8d15cdf8fad6040c8bf0a416afc5efd6b9daaeab 100644 (file)
@@ -687,7 +687,7 @@ public abstract class AjcTestCase extends TestCase {
                                e.printStackTrace();
                        }
                        return lastRunResult;
-               } else if (vmargs!=null && (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"))) {
                        // If --add-modules supplied, need to fork the test
                        try {
 //                             if (mp.indexOf("$runtime") != -1) {
index e69c1ad02f0aef68477e65e1a9c302d10a468d12..ec0d8feeb7a3773c08aaef7e791dde7eb81ead7c 100644 (file)
Binary files a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip and b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip differ
index ac96bd96e3a7b78b54942749d81db30616adaf13..24e4ee699f39a7ca7ae6eb79c3a57523b8fc78b3 100644 (file)
Binary files a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar and b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar differ
index fe6be92c9c984ccc680da74197a3651f69f260bb..c648559289b8b408375590a51398f365e5645eec 100644 (file)
@@ -254,9 +254,9 @@ public class AjcTask extends MatchingTask {
 
        public static final String COMMAND_EDITOR_NAME = AjcTask.class.getName() + ".COMMAND_EDITOR";
 
-       static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11" };
-       static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11"};
-       static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", "-10", "-11" };
+       static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11", "12" };
+       static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11", "12" };
+       static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", "-10", "-11", "-12" };
 
        private static final ICommandEditor COMMAND_EDITOR;
 
index 4cb9a87229cefbe5a443a6dda27a2c87c97715a0..0384e775d70e6ebb185d186accac83848b177446 100644 (file)
@@ -1,5 +1,5 @@
 /* *******************************************************************
- * Copyright (c) 2004,2018 IBM Corporation, contributors
+ * Copyright (c) 2004,2019 IBM Corporation, contributors
  * All rights reserved. 
  * This program and the accompanying materials are made available 
  * under the terms of the Eclipse Public License v1.0 
@@ -29,6 +29,7 @@ public class AjcTest {
        private static boolean is19VMOrGreater = false;
        private static boolean is10VMOrGreater = false;
        private static boolean is11VMOrGreater = false;
+       private static boolean is12VMOrGreater = false;
        
        static { // matching logic is also in org.aspectj.util.LangUtil
                is14VMOrGreater = LangUtil.is14VMOrGreater();
@@ -39,6 +40,7 @@ public class AjcTest {
                is19VMOrGreater = LangUtil.is19VMOrGreater();
                is10VMOrGreater = LangUtil.is10VMOrGreater();
                is11VMOrGreater = LangUtil.is11VMOrGreater();
+               is12VMOrGreater = LangUtil.is12VMOrGreater();
        }
 
        private List<ITestStep> testSteps = new ArrayList<ITestStep>();
@@ -84,6 +86,7 @@ public class AjcTest {
                if (vmLevel.equals("1.9")) canRun = is19VMOrGreater;
                if (vmLevel.equals("10")) canRun = is10VMOrGreater;
                if (vmLevel.equals("11")) canRun = is11VMOrGreater;
+               if (vmLevel.equals("12")) canRun = is12VMOrGreater;
                if (!canRun) {
                        System.out.println("***SKIPPING TEST***" + getTitle()+ " needs " + getVmLevel() 
                                        + ", currently running on " + System.getProperty("java.vm.version"));
index bd0301d281eea5f5190a3ac906fa2dd055d62b10..64ff4f3647bca69282860dc1109331493e7e9278 100644 (file)
@@ -207,7 +207,7 @@ public class AntSpec implements ITestStep {
                }
                if (m_stdErrSpec != null) {
                        String stderr2 = stderr.toString();
-                       // Working around this rediculous message that still comes out of Java7 builds:
+                       // Working around this ridiculous message that still comes out of Java7 builds:
                        if (stderr2.indexOf("Class JavaLaunchHelper is implemented in both")!=-1 && stderr2.indexOf('\n')!=-1) {
                                stderr2 = stderr2.replaceAll("objc\\[[0-9]*\\]: Class JavaLaunchHelper is implemented in both [^\n]*\n","");
                        }
@@ -225,7 +225,11 @@ public class AntSpec implements ITestStep {
                                stderr2 = stderr2.replaceAll("WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations\n","");
                                stderr2 = stderr2.replaceAll("WARNING: All illegal access operations will be denied in a future release\n","");
                        }
-
+                       // J12
+                       String msg = "Java HotSpot(TM) 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = \"org.aspectj.weaver.loadtime.WeavingURLClassLoader\"). To use archived non-system classes, this property must not be set";
+                       if (stderr2.contains(msg)) {
+                               stderr2 = stderr2.replace(msg+"\n","");
+                       }
                        m_stdErrSpec.matchAgainst(stderr2);
                }
        }
index 44c4ed5d8aee342593a35ccd62351d52318e0a96..94d31833a89ca14108b75568389b9ed787aaea61 100644 (file)
@@ -208,6 +208,21 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase {
                return result;
        }
 
+       protected void checkVersion(String classname, int major, int minor)  {
+               JavaClass jc;
+               try {
+                       jc = getClassFrom(ajc.getSandboxDirectory(), classname);
+               } catch (ClassNotFoundException e) {
+                       throw new IllegalStateException("Cannot find class "+classname,e);
+               }
+               if (jc.getMajor() != major) {
+                       fail("Expected major version to be " + major + " but was " + jc.getMajor());
+               }
+               if (jc.getMinor() != minor) {
+                       fail("Expected minor version to be " + minor + " but was " + jc.getMinor());
+               }
+       }
+
        /*
         * The rules for parsing a suite spec file. The Digester using bean properties to match attributes in the XML document to
         * properties in the associated classes, so this simple implementation should be very easy to maintain and extend should you
index b71fc19e937e3a8466a79b3ed476008ff5d09d9a..18181d60eb1b58808179d893db1dbd15a28836c2 100644 (file)
@@ -11,6 +11,8 @@
  * ******************************************************************/
 package org.aspectj.testing;
 
+import org.aspectj.util.LangUtil;
+
 /**
  * Makes sure tests are running on the right level of JDK.
  * 
@@ -20,9 +22,7 @@ public abstract class XMLBasedAjcTestCaseForJava11OrLater extends XMLBasedAjcTes
 
        @Override
        public void runTest(String title) {
-               // Check we are on Java11
-               String property = System.getProperty("java.version");
-               if (!property.startsWith("11")) {
+               if (!LangUtil.is11VMOrGreater()) {
                        throw new IllegalStateException("These tests should be run on Java 11 or later");
                }
                super.runTest(title);
diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java
new file mode 100644 (file)
index 0000000..c3242a3
--- /dev/null
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * Copyright (c) 2018 Contributors
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Andy Clement
+ * ******************************************************************/
+package org.aspectj.testing;
+
+import org.aspectj.util.LangUtil;
+
+/**
+ * Ensure sure tests are running on the right level of JDK.
+ * 
+ * @author Andy Clement
+ */
+public abstract class XMLBasedAjcTestCaseForJava12OrLater extends XMLBasedAjcTestCase {
+
+       @Override
+       public void runTest(String title) {
+               if (!LangUtil.is12VMOrGreater()) {
+                       throw new IllegalStateException("These tests should be run on Java 12 or later");
+               }
+               super.runTest(title);
+       }
+       
+}
diff --git a/tests/bugs190/modules/ggg/foo2.jar b/tests/bugs190/modules/ggg/foo2.jar
new file mode 100644 (file)
index 0000000..54b354e
Binary files /dev/null and b/tests/bugs190/modules/ggg/foo2.jar differ
diff --git a/tests/features193/Switch1.java b/tests/features193/Switch1.java
new file mode 100644 (file)
index 0000000..1daeeff
--- /dev/null
@@ -0,0 +1,22 @@
+public class Switch1 {
+       public static void main(String[] argv) {
+               System.out.println(one(Color.R));
+               System.out.println(one(Color.G));
+               System.out.println(one(Color.B));
+               System.out.println(one(Color.Y));
+       }
+
+       public static int one(Color color) {
+               int result = switch(color) {
+               case R -> 0;
+               case G -> 1;
+               case B -> 2;
+               default -> 3;
+               };
+               return result;
+       }
+}
+
+enum Color {
+       R, G, B, Y;
+}
\ No newline at end of file
diff --git a/tests/features193/Switch2.java b/tests/features193/Switch2.java
new file mode 100644 (file)
index 0000000..c4acc82
--- /dev/null
@@ -0,0 +1,28 @@
+public class Switch2 {
+       public static void main(String[] argv) {
+               System.out.println(one(Color.R));
+               System.out.println(one(Color.G));
+               System.out.println(one(Color.B));
+               System.out.println(one(Color.Y));
+       }
+
+       public static int one(Color color) {
+               int result = switch(color) {
+               case R -> 0;
+               case G -> 1;
+               case B -> 2;
+               default -> 3;
+               };
+               return result;
+       }
+}
+
+enum Color {
+       R, G, B, Y;
+}
+
+aspect X {
+       int around(): call(* one(..)) {
+               return proceed()*2;
+       }
+}
\ No newline at end of file
diff --git a/tests/features193/Switch3.java b/tests/features193/Switch3.java
new file mode 100644 (file)
index 0000000..a99622d
--- /dev/null
@@ -0,0 +1,32 @@
+public class Switch3 {
+       public static void main(String[] argv) {
+               System.out.println(one(Color.R));
+               System.out.println(one(Color.G));
+               System.out.println(one(Color.B));
+               System.out.println(one(Color.Y));
+       }
+
+       public static int one(Color color) {
+               int result = switch(color) {
+               case R -> foo(0);
+               case G -> foo(1);
+               case B -> foo(2);
+               default -> foo(3);
+               };
+               return result;
+       }
+       
+       public static final int foo(int i) {
+               return i+1;
+       }
+}
+
+enum Color {
+       R, G, B, Y;
+}
+
+aspect X {
+       int around(): call(* foo(..)) {
+               return proceed()*3;
+       }
+}
\ No newline at end of file
index a9b215bf37c11ecb3afbf3d7855c5c5648471ba0..c3ac6bac8bd735fa06997b4b1aa0acf098204523 100644 (file)
@@ -10,7 +10,7 @@
 
     <target name="compile:javac">
         <!-- compile only javac compilable stuff, exclude the one that needs other dependencies -->
-        <javac source="1.6" target="1.6" destdir="${aj.sandbox}" classpathref="aj.path"
+        <javac source="1.7" target="1.7" destdir="${aj.sandbox}" classpathref="aj.path"
             srcdir="${basedir}"
             includes="ataspectj/*"
             excludes="ataspectj/UnweavableTest.java"
@@ -75,7 +75,7 @@
 
     <target name="ltw.Aspect2MainTest">
         <!-- javac Aspect2 -->
-        <javac source="1.6" target="1.6" destdir="${aj.sandbox}" classpathref="aj.path"
+        <javac source="1.7" target="1.7" destdir="${aj.sandbox}" classpathref="aj.path"
             srcdir="${basedir}"
             includes="ataspectj/ltwreweavable/Aspect2.java"
             debug="true">
     </target>
 
     <target name="ltw.Unweavable">
-        <javac source="1.6" target="1.6"  destdir="${aj.sandbox}"
+        <javac source="1.7" target="1.7"  destdir="${aj.sandbox}"
             srcdir="${basedir}"
             includes="ataspectj/UnweavableTest.java, ataspectj/TestHelper.java"
             debug="true">
 
     <target name="ltw.Decp2">
         <!-- javac compile the 2nd aspect -->
-        <javac source="1.6" target="1.6"  destdir="${aj.sandbox}"
+        <javac source="1.7" target="1.7"  destdir="${aj.sandbox}"
             srcdir="${basedir}"
             includes="ataspectj/DeclareParentsImplementsReweavableTestAspect.java"
             debug="true">
index 157fdc6ce3f58bed36ff6a410e1075e475b0e96c..9bdb68665fe0379f63a21cf7bd523d6948616a99 100644 (file)
  *******************************************************************************/
 package org.aspectj.systemtest.ajc160;
 
-import java.io.File;
-
-import junit.framework.Test;
-
 import org.aspectj.apache.bcel.classfile.Attribute;
 import org.aspectj.apache.bcel.classfile.Code;
 import org.aspectj.apache.bcel.classfile.JavaClass;
 import org.aspectj.apache.bcel.classfile.Method;
 import org.aspectj.testing.XMLBasedAjcTestCase;
 
+import junit.framework.Test;
+
 /*
  * Some very trivial tests that help verify things are OK.
  * Followed by some Java6 specific checks to ensure the class files are well formed.
@@ -136,16 +134,6 @@ public class SanityTests extends org.aspectj.testing.XMLBasedAjcTestCase {
                return false;
        }
 
-       private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException {
-               JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname);
-               if (jc.getMajor() != major) {
-                       fail("Expected major version to be " + major + " but was " + jc.getMajor());
-               }
-               if (jc.getMinor() != minor) {
-                       fail("Expected minor version to be " + minor + " but was " + jc.getMinor());
-               }
-       }
-
        // Check the stackmap stuff is removed when a method gets woven (for now...)
        // public void testStackMapAttributesDeletedInWovenCode() {
        // fail("Not implemented");
index 8cdf935978879f091354405c152f9064d370f0fe..ac5eb14e4b3974896e8b3f51d2b80e382ac1363d 100644 (file)
@@ -149,16 +149,6 @@ public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater {
                return false;
        }
 
-       private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException {
-               JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname);
-               if (jc.getMajor() != major) {
-                       fail("Expected major version to be " + major + " but was " + jc.getMajor());
-               }
-               if (jc.getMinor() != minor) {
-                       fail("Expected minor version to be " + minor + " but was " + jc.getMinor());
-               }
-       }
-
        // Check the stackmap stuff is removed when a method gets woven (for now...)
        // public void testStackMapAttributesDeletedInWovenCode() {
        // fail("Not implemented");
index edb45c5137f1de49ba0b65f250a5c48472f8f77f..46aaddff1615fccb01c4277b0e59dc1876ec74d9 100644 (file)
@@ -10,7 +10,6 @@
  *******************************************************************************/
 package org.aspectj.systemtest.ajc190;
 
-import org.aspectj.apache.bcel.classfile.JavaClass;
 import org.aspectj.testing.XMLBasedAjcTestCase;
 
 import junit.framework.Test;
@@ -124,16 +123,6 @@ public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase {
 //             return false;
 //     }
 
-       private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException {
-               JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname);
-               if (jc.getMajor() != major) {
-                       fail("Expected major version to be " + major + " but was " + jc.getMajor());
-               }
-               if (jc.getMinor() != minor) {
-                       fail("Expected minor version to be " + minor + " but was " + jc.getMinor());
-               }
-       }
-
        // Check the stackmap stuff is removed when a method gets woven (for now...)
        // public void testStackMapAttributesDeletedInWovenCode() {
        // fail("Not implemented");
index 87d8b932a68de9f2bb50c4fd8e53e2296e0093b8..c6d4bc86e218529c6efe8e2ed6bb651ad8ab4be8 100644 (file)
@@ -7,7 +7,6 @@
  *******************************************************************************/
 package org.aspectj.systemtest.ajc191;
 
-import org.aspectj.apache.bcel.classfile.JavaClass;
 import org.aspectj.testing.XMLBasedAjcTestCase;
 
 import junit.framework.Test;
@@ -73,16 +72,6 @@ public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase {
                checkVersion("A", 49, 0);
        }
 
-       private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException {
-               JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname);
-               if (jc.getMajor() != major) {
-                       fail("Expected major version to be " + major + " but was " + jc.getMajor());
-               }
-               if (jc.getMinor() != minor) {
-                       fail("Expected minor version to be " + minor + " but was " + jc.getMinor());
-               }
-       }
-
        // ///////////////////////////////////////
        public static Test suite() {
                return XMLBasedAjcTestCase.loadSuite(SanityTestsJava10.class);
index 33a5affe6e1b87bf79b311028b61e5d1f17c7d93..0506f90a17c6417a954770797f9fe992c411119b 100644 (file)
@@ -74,15 +74,6 @@ public class SanityTestsJava11 extends XMLBasedAjcTestCaseForJava11OrLater {
                checkVersion("A", 49, 0);
        }
 
-       private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException {
-               JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname);
-               if (jc.getMajor() != major) {
-                       fail("Expected major version to be " + major + " but was " + jc.getMajor());
-               }
-               if (jc.getMinor() != minor) {
-                       fail("Expected minor version to be " + minor + " but was " + jc.getMinor());
-               }
-       }
 
        // ///////////////////////////////////////
        public static Test suite() {
index 62cfcccb26cf6f1865ec3e82a4898fd0776b4db3..ddd88372d680711fb0ad4282826d302affae7588 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2018 Contributors
+ * Copyright (c) 2018-2019 Contributors
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -17,9 +17,8 @@ public class AllTestsAspectJ193 {
 
        public static Test suite() {
                TestSuite suite = new TestSuite("AspectJ 1.9.3 tests");
-               // $JUnit-BEGIN$
                suite.addTest(Ajc193Tests.suite());
-               // $JUnit-END$
+               suite.addTest(Java12Tests.suite());
                return suite;
        }
 }
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/Java12Tests.java
new file mode 100644 (file)
index 0000000..72388ba
--- /dev/null
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc193; 
+
+import org.aspectj.apache.bcel.Constants;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCaseForJava12OrLater;
+
+import junit.framework.Test;
+
+/**
+ * @author Andy Clement
+ */ 
+public class Java12Tests extends XMLBasedAjcTestCaseForJava12OrLater {
+
+       public void testSwitch1() {
+               runTest("switch 1");
+               checkVersion("Switch1", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION);
+       }
+
+       public void testSwitch2() {
+               runTest("switch 2");
+               checkVersion("Switch2", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION);
+       }
+
+       public void testSwitch3() {
+               runTest("switch 3");
+               checkVersion("Switch3", Constants.MAJOR_12, Constants.PREVIEW_MINOR_VERSION);
+       }
+       // ---
+
+       public static Test suite() {
+               return XMLBasedAjcTestCase.loadSuite(Java12Tests.class);
+       }
+
+       @Override
+       protected java.net.URL getSpecFile() {
+               return getClassResource("ajc193.xml");
+       }
+
+}
index 2936888cba233d5863702239d36dcea7fada2c06..5a3dec730564fdebef3cc19429d5b2db445698b7 100644 (file)
     <!-- this fails because if you start working with modules you commit to the modules story and classpath
          becomes irrelevant -->
     <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="module.jar" classpath="foo.jar">
-    <message kind="error" text="The import ddd cannot be resolved"/>
+    <message kind="error" text="The type ddd.D is not accessible"/>
     <message kind="error" text="D cannot be resolved"/>
+    <!-- 
+    <message kind="error" text="The import ddd cannot be resolved"/>
+    <message kind="error" text="package ddd is not visible"/>
+     -->
     </compile>
   </ajc-test>
   
index 2a4be40f8220cd18fe22fada6075b1ef5a6273a7..c13159c3064a6c135d4abcb8e00d823903fa15d0 100644 (file)
@@ -51,6 +51,45 @@ Method call
         </run>
     </ajc-test>
     
+    <ajc-test dir="features193" vm="12" title="switch 1">
+        <compile files="Switch1.java" options="-12 --enable-preview">
+        </compile>
+        <run class="Switch1" vmargs="--enable-preview">
+               <stdout>
+               <line text="0"/>
+               <line text="1"/>
+               <line text="2"/>
+               <line text="3"/>
+               </stdout>
+        </run>
+    </ajc-test>
+    
+    <ajc-test dir="features193" vm="12" title="switch 2">
+        <compile files="Switch2.java" options="--enable-preview -source 12">
+        </compile>
+        <run class="Switch2" vmargs="--enable-preview">
+               <stdout>
+               <line text="0"/>
+               <line text="2"/>
+               <line text="4"/>
+               <line text="6"/>
+               </stdout>
+        </run>
+    </ajc-test>
+    
+    <ajc-test dir="features193" vm="12" title="switch 3">
+        <compile files="Switch3.java" options="--enable-preview -source 12">
+        </compile>
+        <run class="Switch3" vmargs="--enable-preview">
+               <stdout>
+               <line text="3"/>
+               <line text="6"/>
+               <line text="9"/>
+               <line text="12"/>
+               </stdout>
+        </run>
+    </ajc-test>
+    
     <ajc-test dir="bugs193/543657" vm="1.8" title="overweaving decm - reweaving">
         <compile files="MoodIndicator.java,Code1.java" options="-showWeaveInfo -1.8" outjar="one.jar">
                <message kind="weave" text="Mixing interface 'MoodIndicator$Moody' (MoodIndicator.java) into type 'Code1' (Code1.java)"/>
index 82bd9426b6f84af3b70f88d2c7253e378a7279e4..ee77556c8d52ad82fa492edbec723481405d5c70 100644 (file)
@@ -161,6 +161,10 @@ public class LangUtil {
                return 11 <= vmVersion;
        }
 
+       public static boolean is12VMOrGreater() {
+               return 12 <= vmVersion;
+       }
+
        /**
         * Shorthand for "if null, throw IllegalArgumentException"
         * 
index 58f7748406fc77d60767440ef177f1adb8fd66bb..03ded4f6da05d37c4249ea61aebbe5ea8c0d8d58 100644 (file)
@@ -13,11 +13,14 @@ package org.aspectj.weaver.bcel;
 
 import junit.framework.TestCase;
 
+import java.util.Arrays;
+
 import org.aspectj.apache.bcel.Repository;
 import org.aspectj.apache.bcel.classfile.JavaClass;
 import org.aspectj.apache.bcel.classfile.Signature;
 import org.aspectj.util.GenericSignature;
 import org.aspectj.util.GenericSignatureParser;
+import org.aspectj.util.LangUtil;
 import org.aspectj.util.GenericSignature.ClassSignature;
 import org.aspectj.weaver.UnresolvedType;
 
@@ -44,12 +47,19 @@ public class BcelGenericSignatureToTypeXTestCase extends TestCase {
                UnresolvedType superclass = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superclassSignature,
                                cSig.formalTypeParameters, world);
                assertEquals("Ljava/lang/Object;", superclass.getSignature());
-               assertEquals("2 superinterfaces", 2, cSig.superInterfaceSignatures.length);
-               UnresolvedType comparable = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superInterfaceSignatures[0],
+               System.out.println(Arrays.toString(cSig.superInterfaceSignatures));
+               if (LangUtil.is12VMOrGreater()) {
+                       // [Ljava/lang/constant/Constable;, Ljava/lang/Comparable<TE;>;, Ljava/io/Serializable;]
+                       assertEquals("3 superinterfaces but "+Arrays.toString(cSig.superInterfaceSignatures), 3, cSig.superInterfaceSignatures.length);
+               } else {
+                       assertEquals("2 superinterfaces", 2, cSig.superInterfaceSignatures.length);
+               }
+               int idx = LangUtil.is12VMOrGreater()?1:0;
+               UnresolvedType comparable = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superInterfaceSignatures[idx++],
                                cSig.formalTypeParameters, world);
                assertEquals("Pjava/lang/Comparable<TE;>;", comparable.getSignature());
                UnresolvedType serializable = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(
-                               cSig.superInterfaceSignatures[1], cSig.formalTypeParameters, world);
+                               cSig.superInterfaceSignatures[idx++], cSig.formalTypeParameters, world);
                assertEquals("Ljava/io/Serializable;", serializable.getSignature());
        }