]> source.dussan.org Git - aspectj.git/commitdiff
Support Java10
authorAndy Clement <aclement@pivotal.io>
Wed, 18 Apr 2018 20:15:22 +0000 (13:15 -0700)
committerAndy Clement <aclement@pivotal.io>
Wed, 18 Apr 2018 20:15:22 +0000 (13:15 -0700)
39 files changed:
ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java
ajdoc/src/org/aspectj/tools/ajdoc/Main.java
ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java
bcel-builder/src/org/aspectj/apache/bcel/Constants.java
bcel-builder/src/org/aspectj/apache/bcel/util/ClassPath.java
lib/asm/asm-6.0.jar [deleted file]
lib/asm/asm-6.0.renamed.jar [deleted file]
lib/asm/asm-6.1.1.jar [new file with mode: 0644]
lib/asm/asm-6.1.1.renamed.jar [new file with mode: 0644]
lib/asm/build.xml
lib/bcel/bcel-src.zip
lib/bcel/bcel-verifier.jar
lib/bcel/bcel.jar
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
org.aspectj.ajdt.core/testsrc/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/org/aspectj/tools/ant/taskdefs/AjcTask.java
testing/newsrc/org/aspectj/testing/AjcTest.java
testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java [new file with mode: 0644]
testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java
tests/bugs191/var/Code1.java [new file with mode: 0644]
tests/bugs191/var/Code2.java [new file with mode: 0644]
tests/bugs191/var/Code3.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java
tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
tests/src/org/aspectj/systemtest/ajc171/NewFeatures.java
tests/src/org/aspectj/systemtest/ajc191/Ajc191Tests.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc191/ajc191.xml [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java
tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java
util/src/org/aspectj/util/LangUtil.java
weaver/.classpath
weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java

index 37b727175b9d35f979d6870a955d623c7590e6ba..64e53eead02ac0448968453d5bf210ca6d84764d 100644 (file)
 
 package org.aspectj.tools.ajdoc;
 
-import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Vector;
 
-import org.aspectj.util.LangUtil;
+import javax.tools.DocumentationTool;
+import javax.tools.DocumentationTool.DocumentationTask;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
 
 /**
  * @author Mik Kersten
@@ -66,11 +71,6 @@ class JavadocRunner {
                // }
                // } );
                
-               // Need to do something different on Java > 9 due to removal of standard doclet I think
-//             if (LangUtil.is19VMOrGreater()) {
-//                     // Not visible according to module rules...
-//                     clazz = Class.forName("jdk.javadoc.internal.tool.Main");
-//             }
                try {
                        // for JDK 1.4 and above call the execute method...
                        Class jdMainClass = com.sun.tools.javadoc.Main.class;
@@ -100,4 +100,13 @@ class JavadocRunner {
                // Set the security manager back
                // System.setSecurityManager(defaultSecurityManager);
        }
+
+       public static void callJavadocViaToolProvider(Vector<String> options, List<String> files) {
+               DocumentationTool doctool = ToolProvider.getSystemDocumentationTool();
+               StandardJavaFileManager fm = doctool.getStandardFileManager(null, null, null);
+               Iterable<? extends JavaFileObject> jfos = fm.getJavaFileObjects(files.toArray(new String[0]));
+               DocumentationTask task = doctool.getTask(null/*standard System.err*/, null/*standard file manager*/,
+                               null/*default diagnostic listener*/, null/*standard doclet*/, options, jfos);
+               task.call();
+       }
 }
index e8f1472b5f674042477e285024ebc9c81a253b50..2e622ba9cbea7de480b00b2f8875ac0e0d3ecfb1 100644 (file)
@@ -35,6 +35,7 @@ import org.aspectj.asm.AsmManager;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.Version;
 import org.aspectj.util.FileUtil;
+import org.aspectj.util.LangUtil;
 
 /**
  * This is an old implementation of ajdoc that does not use an OO style. However, it does the job, and should serve to evolve a
@@ -125,7 +126,7 @@ public class Main implements Config {
                        }
 
                        for (int i = 0; i < filenames.size(); i++) {
-                               inputFiles[i] = new File((String) filenames.elementAt(i));
+                               inputFiles[i] = new File(filenames.elementAt(i));
                        }
 
                        // PHASE 0: call ajc
@@ -223,7 +224,7 @@ public class Main implements Config {
                String[] argsToCompiler = new String[ajcOptions.size() + inputFiles.length];
                int i = 0;
                for (; i < ajcOptions.size(); i++) {
-                       argsToCompiler[i] = (String) ajcOptions.elementAt(i);
+                       argsToCompiler[i] = ajcOptions.elementAt(i);
                }
                for (int j = 0; j < inputFiles.length; j++) {
                        argsToCompiler[i] = inputFiles[j].getAbsolutePath();
@@ -237,6 +238,8 @@ public class Main implements Config {
        private static void callJavadoc(File[] signatureFiles) throws IOException {
                System.out.println("> Calling javadoc...");
                String[] javadocargs = null;
+
+               List<String> files = new ArrayList<String>();
                if (packageMode) {
                        int numExtraArgs = 2;
                        if (authorStandardDocletSwitch)
@@ -256,24 +259,37 @@ public class Main implements Config {
                        }
                        // javadocargs[1] = getSourcepathAsString();
                        for (int k = 0; k < options.size(); k++) {
-                               javadocargs[numExtraArgs + k] = (String) options.elementAt(k);
+                               javadocargs[numExtraArgs + k] = options.elementAt(k);
                        }
                        for (int k = 0; k < packageList.size(); k++) {
-                               javadocargs[numExtraArgs + options.size() + k] = (String) packageList.elementAt(k);
+                               javadocargs[numExtraArgs + options.size() + k] = packageList.elementAt(k);
                        }
                        for (int k = 0; k < fileList.size(); k++) {
-                               javadocargs[numExtraArgs + options.size() + packageList.size() + k] = (String) fileList.elementAt(k);
+                               javadocargs[numExtraArgs + options.size() + packageList.size() + k] = fileList.elementAt(k);
+                       }
+                       if (LangUtil.is19VMOrGreater()) {
+                               options = new Vector<String>();
+                               for (String a: javadocargs) {
+                                       options.add(a);
+                               }
                        }
                } else {
                        javadocargs = new String[options.size() + signatureFiles.length];
                        for (int k = 0; k < options.size(); k++) {
-                               javadocargs[k] = (String) options.elementAt(k);
+                               javadocargs[k] = options.elementAt(k);
                        }
                        for (int k = 0; k < signatureFiles.length; k++) {
                                javadocargs[options.size() + k] = StructureUtil.translateAjPathName(signatureFiles[k].getCanonicalPath());
                        }
+                       for (int k = 0; k < signatureFiles.length; k++) {
+                               files.add(StructureUtil.translateAjPathName(signatureFiles[k].getCanonicalPath()));
+                       }
+               }
+               if (LangUtil.is19VMOrGreater()) {
+                       JavadocRunner.callJavadocViaToolProvider(options, files);
+               } else {
+                       JavadocRunner.callJavadoc(javadocargs);
                }
-               JavadocRunner.callJavadoc(javadocargs);
        }
 
        /**
@@ -290,7 +306,7 @@ public class Main implements Config {
                removeDeclIDsFromFile("serialized-form.html", true);
                if (packageList.size() > 0) {
                        for (int p = 0; p < packageList.size(); p++) {
-                               removeDeclIDsFromFile(((String) packageList.elementAt(p)).replace('.', '/') + Config.DIR_SEP_CHAR
+                               removeDeclIDsFromFile(packageList.elementAt(p).replace('.', '/') + Config.DIR_SEP_CHAR
                                                + "package-summary.html", true);
                        }
                } else {
@@ -300,6 +316,7 @@ public class Main implements Config {
                                return;
                        }
                        files = FileUtil.listFiles(rootDir, new FileFilter() {
+                               @Override
                                public boolean accept(File f) {
                                        return f.getName().equals("package-summary.html");
                                }
@@ -348,7 +365,7 @@ public class Main implements Config {
                Vector<String> sourcePath = new Vector<String>();
                boolean found = false;
                for (int i = 0; i < options.size(); i++) {
-                       String currOption = (String) options.elementAt(i);
+                       String currOption = options.elementAt(i);
                        if (found && !currOption.startsWith("-")) {
                                sourcePath.add(currOption);
                        }
@@ -362,8 +379,8 @@ public class Main implements Config {
        static File getRootDir() {
                File rootDir = new File(".");
                for (int i = 0; i < options.size(); i++) {
-                       if (((String) options.elementAt(i)).equals("-d")) {
-                               rootDir = new File((String) options.elementAt(i + 1));
+                       if (options.elementAt(i).equals("-d")) {
+                               rootDir = new File(options.elementAt(i + 1));
                                if (!rootDir.exists()) {
                                        rootDir.mkdir();
                                        // System.out.println( "Destination directory not found: " +
@@ -462,7 +479,7 @@ public class Main implements Config {
                                args = new String[argList.size()];
                                int counter = 0;
                                for (Iterator<String> it = argList.iterator(); it.hasNext();) {
-                                       args[counter] = (String) it.next();
+                                       args[counter] = it.next();
                                        counter++;
                                }
                        } catch (FileNotFoundException e) {
@@ -494,7 +511,7 @@ public class Main implements Config {
        static String getSourcepathAsString() {
                String cPath = "";
                for (int i = 0; i < sourcepath.size(); i++) {
-                       cPath += (String) sourcepath.elementAt(i) + Config.DIR_SEP_CHAR + outputWorkingDir;
+                       cPath += sourcepath.elementAt(i) + Config.DIR_SEP_CHAR + outputWorkingDir;
                        if (i != sourcepath.size() - 1) {
                                cPath += File.pathSeparator;
                        }
@@ -667,10 +684,11 @@ public class Main implements Config {
 
                                        // do this for every item in the classpath
                                        for (int c = 0; c < sourcepath.size(); c++) {
-                                               String path = (String) sourcepath.elementAt(c) + Config.DIR_SEP_CHAR + arg;
+                                               String path = sourcepath.elementAt(c) + Config.DIR_SEP_CHAR + arg;
                                                File pkg = new File(path);
                                                if (pkg.isDirectory()) {
                                                        String[] files = pkg.list(new FilenameFilter() {
+                                                               @Override
                                                                public boolean accept(File dir, String name) {
                                                                        int index1 = name.lastIndexOf(".");
                                                                        int index2 = name.length();
@@ -684,7 +702,7 @@ public class Main implements Config {
                                                                }
                                                        });
                                                        for (int j = 0; j < files.length; j++) {
-                                                               filenames.addElement((String) sourcepath.elementAt(c) + Config.DIR_SEP_CHAR + arg
+                                                               filenames.addElement(sourcepath.elementAt(c) + Config.DIR_SEP_CHAR + arg
                                                                                + Config.DIR_SEP_CHAR + files[j]);
                                                        }
                                                } else if (c == sourcepath.size()) { // last element on classpath
index ea9a8187547905db18d46ef2e7446cbedbf7e756..e3674086e0ea401b8181f963c4a1c57b507caa4a 100644 (file)
@@ -15,12 +15,12 @@ import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
 
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
 import org.aspectj.tools.ajc.Ajc;
 import org.aspectj.util.LangUtil;
 
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
 /**
  * This class is the super class of all Ajdoc tests. It creates a sandbox directory and provides utility methods for copying over
  * the test projects and running the ajdoc command
@@ -31,6 +31,7 @@ public class AjdocTestCase extends TestCase {
        protected static File sandboxDir;
        private String docOutdir, projectDir;
 
+       @Override
        protected void setUp() throws Exception {
                super.setUp();
                docOutdir = null;
@@ -41,6 +42,7 @@ public class AjdocTestCase extends TestCase {
                Main.setOutputWorkingDir(getWorkingDir().getAbsolutePath());
        }
 
+       @Override
        protected void tearDown() throws Exception {
                super.tearDown();
                // reset where ajdocworkingdir is created
@@ -166,7 +168,8 @@ public class AjdocTestCase extends TestCase {
                        !sourceLevel.equals("1.6") && 
                        !sourceLevel.equals("1.7") && 
                        !sourceLevel.equals("1.8") && 
-                       !sourceLevel.equals("1.9")) {
+                       !sourceLevel.equals("1.9") &&
+                       !sourceLevel.equals("10")) {
                        fail("need to pass ajdoc '1.3' > '1.9' as the source level");
                }
                String[] args = new String[6 + inputFiles.length + ajOptions.length];
index 85abecff78d8bbde25ce301142331dd922deafcd..a5068f6382e88982cd2b1cc38fb0de859cad4725 100644 (file)
@@ -82,6 +82,8 @@ public interface Constants {
        public final static short MINOR_1_8 = 0;
        public final static short MAJOR_1_9 = 53;
        public final static short MINOR_1_9 = 0;
+       public final static short MAJOR_10 = 54;
+       public final static short MINOR_10 = 0;
        // Defaults
        public final static short MAJOR = MAJOR_1_1;
        public final static short MINOR = MINOR_1_1;
index 0f5df2d4dca8ae16ba1f8894986609101507c38e..136f69390459daead3b6d791a48d035a3207f4b9 100644 (file)
  */
 package org.aspectj.apache.bcel.util;
 
-import java.util.*;
-import java.util.zip.*;
-
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
 import java.net.URI;
-import java.nio.file.FileVisitResult;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.DirectoryStream;
 import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
 import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributeView;
 import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 
 /**
  * Responsible for loading (class) files from the CLASSPATH. Inspired by
@@ -131,6 +140,7 @@ public class ClassPath implements Serializable {
         * 
         * @deprecated Use SYSTEM_CLASS_PATH constant
         */
+       @Deprecated
        public ClassPath() {
                this(getClassPath());
        }
@@ -138,14 +148,17 @@ public class ClassPath implements Serializable {
        /**
         * @return used class path string
         */
+       @Override
        public String toString() {
                return class_path;
        }
 
+       @Override
        public int hashCode() {
                return class_path.hashCode();
        }
 
+       @Override
        public boolean equals(Object o) {
                if (o instanceof ClassPath) {
                        return class_path.equals(((ClassPath) o).class_path);
@@ -191,6 +204,7 @@ public class ClassPath implements Serializable {
                for (Iterator<String> e = dirs.iterator(); e.hasNext();) {
                        File ext_dir = new File(e.next());
                        String[] extensions = ext_dir.list(new FilenameFilter() {
+                               @Override
                                public boolean accept(File dir, String name) {
                                        name = name.toLowerCase();
                                        return name.endsWith(".zip") || name.endsWith(".jar");
@@ -212,7 +226,7 @@ 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")) {
+        if (vm_version.startsWith("9") || vm_version.startsWith("10")) {
                        buf.insert(0, File.pathSeparatorChar);
                        buf.insert(0, System.getProperty("java.home") + File.separator + "lib" + File.separator + JRT_FS);                      
         }
@@ -378,14 +392,17 @@ public class ClassPath implements Serializable {
                        dir = d;
                }
 
+               @Override
                ClassFile getClassFile(String name, String suffix) throws IOException {
                        final File file = new File(dir + File.separatorChar + name.replace('.', File.separatorChar) + suffix);
 
                        return file.exists() ? new ClassFile() {
+                               @Override
                                public InputStream getInputStream() throws IOException {
                                        return new FileInputStream(file);
                                }
 
+                               @Override
                                public String getPath() {
                                        try {
                                                return file.getCanonicalPath();
@@ -395,14 +412,17 @@ public class ClassPath implements Serializable {
 
                                }
 
+                               @Override
                                public long getTime() {
                                        return file.lastModified();
                                }
 
+                               @Override
                                public long getSize() {
                                        return file.length();
                                }
 
+                               @Override
                                public String getBase() {
                                        return dir;
                                }
@@ -410,6 +430,7 @@ public class ClassPath implements Serializable {
                        } : null;
                }
 
+               @Override
                public String toString() {
                        return dir;
                }
@@ -472,30 +493,36 @@ public class ClassPath implements Serializable {
                                this.size = size;
                        }
                        
+                       @Override
                        public InputStream getInputStream() throws IOException {
                                // TODO too costly to keep these in inflated form in memory?
                                this.bais = new ByteArrayInputStream(bytes);
                                return this.bais;
                        }
 
+                       @Override
                        public String getPath() {
                                return this.path;
                        }
 
+                       @Override
                        public String getBase() {
                                return this.base;
                        }
 
+                       @Override
                        public long getTime() {
                                return this.time;
                        }
 
+                       @Override
                        public long getSize() {
                                return this.size;
                        }
                        
                }
                
+               @Override
                ClassFile getClassFile(String name, String suffix) throws IOException {
                        // Class files are in here under names like this:
                        //   /modules/java.base/java/lang/Object.class (jdk9 b74)
@@ -522,26 +549,32 @@ public class ClassPath implements Serializable {
                        zip = z;
                }
 
+               @Override
                ClassFile getClassFile(String name, String suffix) throws IOException {
                        final ZipEntry entry = zip.getEntry(name.replace('.', '/') + suffix);
 
                        return (entry != null) ? new ClassFile() {
+                               @Override
                                public InputStream getInputStream() throws IOException {
                                        return zip.getInputStream(entry);
                                }
 
+                               @Override
                                public String getPath() {
                                        return entry.toString();
                                }
 
+                               @Override
                                public long getTime() {
                                        return entry.getTime();
                                }
 
+                               @Override
                                public long getSize() {
                                        return entry.getSize();
                                }
 
+                               @Override
                                public String getBase() {
                                        return zip.getName();
                                }
diff --git a/lib/asm/asm-6.0.jar b/lib/asm/asm-6.0.jar
deleted file mode 100644 (file)
index cf2de27..0000000
Binary files a/lib/asm/asm-6.0.jar and /dev/null differ
diff --git a/lib/asm/asm-6.0.renamed.jar b/lib/asm/asm-6.0.renamed.jar
deleted file mode 100644 (file)
index c84e356..0000000
Binary files a/lib/asm/asm-6.0.renamed.jar and /dev/null differ
diff --git a/lib/asm/asm-6.1.1.jar b/lib/asm/asm-6.1.1.jar
new file mode 100644 (file)
index 0000000..35b934d
Binary files /dev/null and b/lib/asm/asm-6.1.1.jar differ
diff --git a/lib/asm/asm-6.1.1.renamed.jar b/lib/asm/asm-6.1.1.renamed.jar
new file mode 100644 (file)
index 0000000..3f99d22
Binary files /dev/null and b/lib/asm/asm-6.1.1.renamed.jar differ
index fdd569cce80081ba729c9248c671040d37b6e7fe..5aa6f88e169b8fd56c34f09cd5d95cd918f9951c 100644 (file)
@@ -4,8 +4,8 @@
     <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"/>
 
        <target name="package" description="Jarjar asm-5.0.4.jar and prefix package name with aj">
-               <jarjar destfile="asm-6.0.renamed.jar">
-                 <zipfileset src="asm-6.0.jar" excludes="module-info.class"/>
+               <jarjar destfile="asm-6.1.1.renamed.jar">
+                 <zipfileset src="asm-6.1.1.jar" excludes="module-info.class"/>
                  <rule pattern="org.objectweb.asm.**" result="aj.org.objectweb.asm.@1"/>
                </jarjar>
        </target> 
index b98e0889ea88f13d2d13087c7a5e8ef3a97a6c3f..5cf1d1b025599de9b75e241f5fffdafcf9aaa297 100644 (file)
Binary files a/lib/bcel/bcel-src.zip and b/lib/bcel/bcel-src.zip differ
index cee235ad9d0022efc94b3768069128512a43f161..27e88cef54e1363eb4dd8b9b51ae10afd4b930f3 100644 (file)
Binary files a/lib/bcel/bcel-verifier.jar and b/lib/bcel/bcel-verifier.jar differ
index 793bf0d0d7cafcdf513480db20c64f2e366e9c4f..5d1ad474eb7d438987c10c882a388abe437e5094 100644 (file)
Binary files a/lib/bcel/bcel.jar and b/lib/bcel/bcel.jar differ
index 0327191652a33ace627c323e2cebce04058c759a..448618c11980462ac328a4538003a98a70c71e14 100644 (file)
@@ -832,11 +832,15 @@ public class BuildArgParser extends Main {
                        } else if (arg.equals("-1.9")) {
                                buildConfig.setBehaveInJava5Way(true);
                                unparsedArgs.add("-1.9");
+                       } else if (arg.equals("-10")) {
+                               buildConfig.setBehaveInJava5Way(true);
+                               unparsedArgs.add("-10");
                        } else if (arg.equals("-source")) {
                                if (args.size() > nextArgIndex) {
                                        String level = args.get(nextArgIndex).getValue();
                                        if (level.equals("1.5") || level.equals("5") || level.equals("1.6") || level.equals("6") || level.equals("1.7")
-                                                       || level.equals("7") || level.equals("8") || level.equals("1.8") || level.equals("9") || level.equals("1.9")) {
+                                                       || level.equals("7") || level.equals("8") || level.equals("1.8")
+                                                       || level.equals("9") || level.equals("1.9") || level.equals("10")) {
                                                buildConfig.setBehaveInJava5Way(true);
                                        }
                                        unparsedArgs.add("-source");
index 0590df7121a3ef8b8aa2cb2f6fa885eaff9eee92..f2a938c4ef018453faba69bf7a598132d9a8fdf6 100644 (file)
@@ -56,9 +56,10 @@ public class AjMethodDeclaration extends MethodDeclaration {
                return classFile.generateMethodInfoAttributes(binding,extras);
        }
        
+       @Override
        protected int generateInfoAttributes(ClassFile classFile) {
            return generateInfoAttributes(classFile,false);
-       }
+       } 
        
        protected void addDeclarationStartLineAttribute(List extraAttributeList, ClassFile classFile) {
                if ((classFile.codeStream.generateAttributes & ClassFileConstants.ATTR_LINES)==0) return;
index 3355c94c9d57693f0d93341dcd67c3fec29ceee8..fc0d421546df1ed8b0e667d815943097716440b0 100644 (file)
@@ -22,14 +22,12 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
 import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
 import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
 import org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
-import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeParameter;
 import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference;
 import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
 import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream;
 import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Opcodes;
 import org.aspectj.org.eclipse.jdt.internal.compiler.flow.FlowContext;
 import org.aspectj.org.eclipse.jdt.internal.compiler.flow.FlowInfo;
-import org.aspectj.org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
@@ -59,9 +57,10 @@ import org.aspectj.weaver.UnresolvedType;
  */
 public class InterTypeMethodDeclaration extends InterTypeDeclaration {
        public InterTypeMethodDeclaration(CompilationResult result, TypeReference onType) {
-               super(result, onType);
+               super(result, onType); 
        }
 
+       @Override
        public void parseStatements(Parser parser, CompilationUnitDeclaration unit) {
                if (ignoreFurtherInvestigation)
                        return;
@@ -70,6 +69,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
                }
        }
 
+       @Override
        protected char[] getPrefix() {
                return (NameMangler.ITD_PREFIX + "interMethod$").toCharArray();
        }
@@ -91,6 +91,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
                super.analyseCode(classScope, flowContext, flowInfo);
        }
 
+       @Override
        public void resolve(ClassScope upperScope) {
                if (munger == null)
                        ignoreFurtherInvestigation = true;
@@ -119,6 +120,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
                super.resolve(upperScope);
        }
 
+       @Override
        public void resolveStatements() {
                checkAndSetModifiersForMethod();
                if ((modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0) {
@@ -196,6 +198,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
                }
        }
 
+       @Override
        public EclipseTypeMunger build(ClassScope classScope) {
                EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(classScope);
 
@@ -241,6 +244,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
                return new AjAttribute.TypeMunger(munger);
        }
 
+       @Override
        public void generateCode(ClassScope classScope, ClassFile classFile) {
                if (ignoreFurtherInvestigation) {
                        // System.err.println("no code for " + this);
@@ -339,6 +343,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
                classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber);
        }
 
+       @Override
        protected Shadow.Kind getShadowKindForBody() {
                return Shadow.MethodExecution;
        }
index 9752359181b462e56cabf138f8bce9c1c3480b21..c9ce44abf446d65bf255764b74ba4bb033575c9a 100644 (file)
@@ -997,7 +997,12 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour
                                units[i] = moduleCU;
                        } else {
                                units[i] = new CompilationUnit(null, filenames[i], defaultEncoding, null, false, moduleName);
-                               units[i].setModule(moduleCU);
+                               // With Java 10 changes the modulebinding is fetched from the rootenvironment 
+                               // this.moduleBinding = rootEnvironment.getModule(this.module);
+                               // rather than using the moduleCU:
+                               // if (this.modCU != null)
+                               //      return this.moduleBinding = this.modCU.module(rootEnvironment);
+//                             units[i].setModule(moduleCU);
                        }
 //                     new CompilationUnit(null, fileName, encoding, this.destinationPaths[i],
 //                                     shouldIgnoreOptionalProblems(this.ignoreOptionalProblemsFromFolders, fileName.toCharArray()), 
index 8014e5ff7326310b80c9bafc27adf42ee8fd76e8..30bc1165b977a5dec7707d05d816724a86b2718f 100644 (file)
@@ -2227,7 +2227,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe
                if (qualifiedNames.length < qualifiedStrings.elementSize) {
                        qualifiedNames = null;
                }
-               char[][] simpleNames = ReferenceCollection.internSimpleNames(simpleStrings);
+               char[][] simpleNames = ReferenceCollection.internSimpleNames(simpleStrings, true);
                // if a well known name was found then we can skip over these
                if (simpleNames.length < simpleStrings.elementSize) {
                        simpleNames = null;
index 302739e71990030197222b8440eb8f52ba46fc83..e88ae0251db4f1be5d126ffeaed4c3b02c84679b 100644 (file)
@@ -91,7 +91,7 @@ public class AjcTestCase extends TestCase {
                        + File.separator
                        + "bcel-verifier.jar"
                        
-                       + File.pathSeparator + ".." +  File.separator + "lib" + File.separator + "asm" + File.separator + "asm-6.0.renamed.jar"
+                       + File.pathSeparator + ".." +  File.separator + "lib" + File.separator + "asm" + File.separator + "asm-6.1.1.renamed.jar"
 
                        // When the build machine executes the tests, it is using code built into jars rather than code build into
                        // bin directories. This means for the necessary types to be found we have to put these jars on the classpath:
index 6fd88f22c1dcea4dc3281f4a8e534c305ef44a71..17eba397bebec1d6a66ad4532789a85d0f9ccc00 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 577b4be39e49aadd083e6fa52149cbc08c44b4cc..270837a87ffec376b21ed252d43b6dd9603197f7 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 1bbab168a34d8aebe0fa6526a57f1a001f161413..93f93ef47a35486de747a9be147fdabc1b35de98 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" };
-       static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9" };
-       static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9" };
+       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" };
+       static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10" };
+       static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", "-10" };
 
        private static final ICommandEditor COMMAND_EDITOR;
 
index 2cc45063642944f309e68a11ccc75adab1ce49c2..d56bc6e37e360942531579ffe60128f015000a08 100644 (file)
@@ -1,5 +1,5 @@
 /* *******************************************************************
- * Copyright (c) 2004,2013 IBM Corporation, contributors
+ * Copyright (c) 2004,2018 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 
@@ -27,6 +27,7 @@ public class AjcTest {
        private static boolean is17VMOrGreater = false;
        private static boolean is18VMOrGreater = false;
        private static boolean is19VMOrGreater = false;
+       private static boolean is10VMOrGreater = false;
        
        static { // matching logic is also in org.aspectj.util.LangUtil
                is14VMOrGreater = LangUtil.is14VMOrGreater();
@@ -35,6 +36,7 @@ public class AjcTest {
                is17VMOrGreater = LangUtil.is17VMOrGreater();
                is18VMOrGreater = LangUtil.is18VMOrGreater();
                is19VMOrGreater = LangUtil.is19VMOrGreater();
+               is10VMOrGreater = LangUtil.is10VMOrGreater();
        }
 
        private List<ITestStep> testSteps = new ArrayList<ITestStep>();
@@ -78,6 +80,7 @@ public class AjcTest {
                if (vmLevel.equals("1.7")) canRun = is17VMOrGreater;
                if (vmLevel.equals("1.8")) canRun = is18VMOrGreater;
                if (vmLevel.equals("1.9")) canRun = is19VMOrGreater;
+               if (vmLevel.equals("10")) canRun = is10VMOrGreater;
                if (!canRun) {
                        System.out.println("***SKIPPING TEST***" + getTitle()+ " needs " + getVmLevel() 
                                        + ", currently running on " + System.getProperty("java.vm.version"));
diff --git a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java
new file mode 100644 (file)
index 0000000..492106d
--- /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;
+
+/**
+ * Makes sure tests are running on the right level of JDK.
+ * 
+ * @author Andy Clement
+ */
+public abstract class XMLBasedAjcTestCaseForJava10OrLater extends XMLBasedAjcTestCase {
+
+       @Override
+       public void runTest(String title) {
+               // Check we are on Java10
+               String property = System.getProperty("java.version");
+               if (!property.startsWith("10")) {
+                       throw new IllegalStateException("These tests should be run on Java 10 or later");
+               }
+               super.runTest(title);
+       }
+       
+}
index 826cf55d33eaa032157e7a73adf37e3a740103de..205b552737a973a838e5533ecd51d3b6035f2193 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,8 @@ public abstract class XMLBasedAjcTestCaseForJava9OrLater extends XMLBasedAjcTest
 
        @Override
        public void runTest(String title) {
-               // Check we are on Java9
-               String property = System.getProperty("java.version");
-               if (!property.startsWith("9")) {
+               // Check we are on Java9 or later
+               if (!LangUtil.is19VMOrGreater()) {
                        throw new IllegalStateException("These tests should be run on Java 9 or later");
                }
                super.runTest(title);
diff --git a/tests/bugs191/var/Code1.java b/tests/bugs191/var/Code1.java
new file mode 100644 (file)
index 0000000..58f93d1
--- /dev/null
@@ -0,0 +1,6 @@
+public class Code1 {
+       public static void main(String []argv) {
+               var x = "hello";
+               System.out.println(x.getClass());
+       }
+}
diff --git a/tests/bugs191/var/Code2.java b/tests/bugs191/var/Code2.java
new file mode 100644 (file)
index 0000000..7f8ba93
--- /dev/null
@@ -0,0 +1,11 @@
+import java.util.*;
+public class Code2 {
+       public static void main(String []argv) {
+               foo(new ArrayList<String>());
+       }
+
+       public static void foo(ArrayList<String> als) {
+               var aly = als;
+               System.out.println(aly.getClass());
+       }
+}
diff --git a/tests/bugs191/var/Code3.java b/tests/bugs191/var/Code3.java
new file mode 100644 (file)
index 0000000..f2494bc
--- /dev/null
@@ -0,0 +1,12 @@
+public class Code3 {
+       public static void main(String []argv) {
+               var x = "hello";
+               System.out.println(x.getClass());
+       }
+}
+
+aspect X {
+       before(): call(* *.getClass()) && target(String) {
+               System.out.println(thisJoinPointStaticPart);
+       }
+}
index 58de6b44772e40250638956e547ff70699e10d0e..866fbb7294e564af9551ce823f307f69ecbd395c 100644 (file)
@@ -15,9 +15,6 @@ import java.io.PrintWriter;
 import java.util.Iterator;
 import java.util.List;
 
-import junit.framework.Test;
-
-import org.aspectj.apache.bcel.classfile.JavaClass;
 import org.aspectj.apache.bcel.classfile.LocalVariable;
 import org.aspectj.apache.bcel.classfile.LocalVariableTable;
 import org.aspectj.apache.bcel.classfile.Method;
@@ -27,6 +24,8 @@ import org.aspectj.asm.IProgramElement;
 import org.aspectj.asm.IRelationship;
 import org.aspectj.testing.XMLBasedAjcTestCase;
 
+import junit.framework.Test;
+
 public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
        public void testGenericAspectsNpe_pr268689() {
@@ -116,14 +115,14 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
                // assertEquals("/binaries<{Aspect.java}Aspect)Fruit.Fruit_new)QColor;)QString;", itdCtorHandle);
                assertEquals("/binaries<(Aspect.class'Aspect)Fruit.Fruit_new)QColor;)QString;", itdCtorHandle);
                IProgramElement itdcpe = model.getHierarchy().findElementForHandle(itdCtorHandle);
-               List ptypes = itdcpe.getParameterTypes();
-               assertEquals("java.awt.Color", new String((char[]) ptypes.get(0)));
-               assertEquals("java.lang.String", new String((char[]) ptypes.get(1)));
+               List<char[]> ptypes = itdcpe.getParameterTypes();
+               assertEquals("java.awt.Color", new String(ptypes.get(0)));
+               assertEquals("java.lang.String", new String(ptypes.get(1)));
        }
 
        private void printModel(AsmManager model) {
                try {
-                       model.dumptree(model.getHierarchy().getRoot(), 0);
+                       AsmManager.dumptree(model.getHierarchy().getRoot(), 0);
                        model.dumprels(new PrintWriter(System.out));
                } catch (Exception e) {
                }
@@ -416,6 +415,7 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
                return XMLBasedAjcTestCase.loadSuite(Ajc164Tests.class);
        }
 
+       @Override
        protected File getSpecFile() {
                return getClassResource("ajc164.xml");
        }
@@ -427,9 +427,9 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
                if (whereToLook.getSourceLocation() != null && whereToLook.getSourceLocation().getLine() == line) {
                        return whereToLook;
                }
-               List kids = whereToLook.getChildren();
-               for (Iterator iterator = kids.iterator(); iterator.hasNext();) {
-                       IProgramElement object = (IProgramElement) iterator.next();
+               List<IProgramElement> kids = whereToLook.getChildren();
+               for (Iterator<IProgramElement> iterator = kids.iterator(); iterator.hasNext();) {
+                       IProgramElement object = iterator.next();
                        if (object.getSourceLocation() != null && object.getSourceLocation().getLine() == line) {
                                return object;
                        }
index 441e0b4e6282ba31db3408094e727cb177ac283d..196e07ca19ee14824dbc73a3721afd1cd991d3b7 100644 (file)
@@ -13,11 +13,12 @@ package org.aspectj.systemtest.ajc165;
 import java.io.File;
 import java.util.List;
 
-import junit.framework.Test;
-
+import org.aspectj.bridge.IMessage;
 import org.aspectj.testing.XMLBasedAjcTestCase;
 import org.aspectj.weaver.LintMessage;
 
+import junit.framework.Test;
+
 public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
 // fix is too disruptive for 1.6.5
@@ -82,7 +83,7 @@ public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
        public void testAnnotationStyle_pr265356() {
                runTest("annotation style message positions");
-               List ms = ajc.getLastCompilationResult().getWarningMessages();
+               List<IMessage> ms = ajc.getLastCompilationResult().getWarningMessages();
                boolean checked = true;
                // Look for the message relating to 'List' and check the offsets
                for (int i = 0; i < ms.size(); i++) {
@@ -115,6 +116,7 @@ public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
                return XMLBasedAjcTestCase.loadSuite(Ajc165Tests.class);
        }
 
+       @Override
        protected File getSpecFile() {
                return getClassResource("ajc165.xml");
        }
index 79d1a46699a2121663ab29bedd200fd87c71d278..6a713e93032e1fb21332e0c649de18255617345b 100644 (file)
@@ -12,11 +12,11 @@ package org.aspectj.systemtest.ajc171;
 
 import java.io.File;
 
-import junit.framework.Test;
-
 import org.aspectj.apache.bcel.classfile.JavaClass;
 import org.aspectj.testing.XMLBasedAjcTestCase;
 
+import junit.framework.Test;
+
 // NOTE THIS IS ACTUALLY IN 1.7.2 - IT IS JUST THAT THE PATCH WAS CREATED AGAINST 1.7.1
 public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase {
 
@@ -60,10 +60,12 @@ public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase {
                return XMLBasedAjcTestCase.loadSuite(NewFeatures.class);
        }
 
+       @SuppressWarnings("unused")
        private JavaClass getMyClass(String className) throws ClassNotFoundException {
                return getClassFrom(ajc.getSandboxDirectory(), className);
        }
 
+       @Override
        protected File getSpecFile() {
                return new File("../tests/src/org/aspectj/systemtest/ajc171/newfeatures-tests.xml");
        }
diff --git a/tests/src/org/aspectj/systemtest/ajc191/Ajc191Tests.java b/tests/src/org/aspectj/systemtest/ajc191/Ajc191Tests.java
new file mode 100644 (file)
index 0000000..230a912
--- /dev/null
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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 - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc191;
+
+import java.io.File;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCaseForJava10OrLater;
+
+import junit.framework.Test;
+
+/**
+ * @author Andy Clement
+ */
+public class Ajc191Tests extends XMLBasedAjcTestCaseForJava10OrLater {
+
+       public void testVar1() {
+               runTest("var 1");
+       }
+
+       public void testVar2() {
+               runTest("var 2");
+       }
+
+       public void testVarIncludesAspect3() {
+               runTest("var 3");
+       }
+
+       // ---
+
+       public static Test suite() {
+               return XMLBasedAjcTestCase.loadSuite(Ajc191Tests.class);
+       }
+
+       @Override
+       protected File getSpecFile() {
+        return getClassResource("ajc191.xml");
+       }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java b/tests/src/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java
new file mode 100644 (file)
index 0000000..a42ad5b
--- /dev/null
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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 - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc191;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTestsAspectJ191 {
+
+       public static Test suite() {
+               TestSuite suite = new TestSuite("AspectJ 1.9.1 tests");
+               // $JUnit-BEGIN$
+               suite.addTest(Ajc191Tests.suite());
+               // $JUnit-END$
+               return suite;
+       }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc191/ajc191.xml b/tests/src/org/aspectj/systemtest/ajc191/ajc191.xml
new file mode 100644 (file)
index 0000000..ab14b9e
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+
+  <ajc-test dir="bugs191/var" title="var 1">
+    <compile files="Code1.java" options="-10">
+       </compile>
+       <run class="Code1">
+       <stdout>
+       <line text="class java.lang.String"/>
+       </stdout>
+       </run>
+  </ajc-test>
+  
+  <ajc-test dir="bugs191/var" title="var 2">
+    <compile files="Code2.java" options="-10">
+       </compile>
+       <run class="Code2">
+       <stdout>
+       <line text="class java.util.ArrayList"/>
+       </stdout>
+       </run>
+  </ajc-test>
+  
+  <ajc-test dir="bugs191/var" title="var 3">
+    <compile files="Code3.java" options="-10">
+       </compile>
+       <run class="Code3">
+       <stdout>
+       <line text="call(Class java.lang.Object.getClass())"/>
+       <line text="class java.util.ArrayList"/>
+       </stdout>
+       </run>
+  </ajc-test>
+
+</suite>
index c5e53cdeb23bd197858c5fc45599ecbf67c5d928..428c037d8826b555ecddbc1fd262ab39e8931b26 100644 (file)
@@ -141,6 +141,7 @@ public class IncrementalPerformanceTests extends AbstractMultiProjectIncremental
 
        // --- helper code ---
 
+       @SuppressWarnings("unused")
        private void waitFor10() {
                try {
                        Thread.sleep(10000);
@@ -149,6 +150,7 @@ public class IncrementalPerformanceTests extends AbstractMultiProjectIncremental
                }
        }
 
+       @SuppressWarnings("unused")
        private void waitForReturn() {
                try {
                        System.in.read();
@@ -157,11 +159,13 @@ public class IncrementalPerformanceTests extends AbstractMultiProjectIncremental
                }
        }
 
+       @Override
        protected void setUp() throws Exception {
                super.setUp();
                testdataSrcDir = "../tests/incrementalPerformance";
        }
 
+       @Override
        protected void tearDown() throws Exception {
                super.tearDown();
                testdataSrcDir = "../tests/multiIncremental";
index 308ed42d54a1df25be4b8565a4e355c620834088..c35b88610559de4bf5f282b10d2f1951108f88bc 100644 (file)
@@ -48,6 +48,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
        private String inpathTestingDir;
        private String expectedOutputDir;
 
+       @Override
        protected void setUp() throws Exception {
                super.setUp();
                initialiseProject("inpathTesting");
@@ -71,7 +72,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
                        Map.Entry<String,File> entry = iterator.next();
                        String className = entry.getKey();
                        String fullClassName = expectedOutputDir + File.separator + className.replace('.', File.separatorChar) + ".class";
-                       File file = (File) entry.getValue();
+                       File file = entry.getValue();
                        assertEquals("expected file to have path \n" + fullClassName + ", but" + " found path \n" + file.getAbsolutePath(),
                                        fullClassName, file.getAbsolutePath());
                }
@@ -289,7 +290,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
                configureNonStandardCompileOptions("inpathTesting", "-outxml");
                build("inpathTesting");
                AjState state = getState();
-               Map m = state.getAspectNamesToFileNameMap();
+               Map<String,char[]> m = state.getAspectNamesToFileNameMap();
                assertEquals("Expected only one aspect recored in the state but found " + m.size(), 1, m.size());
                build("inpathTesting");
                m = state.getAspectNamesToFileNameMap();
@@ -333,37 +334,46 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
                        allOutputLocations.add(outputLoc);
                }
 
+               @Override
                public File getOutputLocationForClass(File compilationUnit) {
                        return outputLoc;
                }
                
+               @Override
                public Map<File,String> getInpathMap() {
                        return Collections.emptyMap();
                }
 
 
+               @Override
                public File getOutputLocationForResource(File resource) {
                        return outputLoc;
                }
 
+               @Override
                public List<File> getAllOutputLocations() {
                        return allOutputLocations;
                }
 
+               @Override
                public File getDefaultOutputLocation() {
                        return outputLoc;
                }
 
+               @Override
                public void reportFileWrite(String outputfile, int filetype) {
                }
 
+               @Override
                public void reportFileRemove(String outputfile, int filetype) {
                }
 
+               @Override
                public String getSourceFolderForFile(File sourceFile) {
                        return null; // no impl
                }
 
+               @Override
                public int discoverChangesSince(File dir, long buildtime) {
                        return 0; // no impl
                }
index ff6c7246c37e4495a811fe4f0dd98c651dec32b6..ad83a4edd502e3dbbfddb2ff374b5b878b1c5a33 100644 (file)
@@ -1,6 +1,7 @@
 /* *******************************************************************
  * Copyright (c) 1999-2001 Xerox Corporation, 
  *               2002 Palo Alto Research Center, Incorporated (PARC).
+ *               2018 Contributors
  * All rights reserved. 
  * This program and the accompanying materials are made available 
  * under the terms of the Eclipse Public License v1.0 
@@ -151,6 +152,10 @@ public class LangUtil {
        public static boolean is19VMOrGreater() {
                return 9 <= vmVersion;
        }
+       
+       public static boolean is10VMOrGreater() {
+               return 10 <= vmVersion;
+       }
 
        /**
         * Shorthand for "if null, throw IllegalArgumentException"
@@ -267,7 +272,7 @@ public class LangUtil {
         * @param text <code>String</code> to split.
         */
        public static String[] split(String text) {
-               return (String[]) strings(text).toArray(new String[0]);
+               return strings(text).toArray(new String[0]);
        }
 
        /**
@@ -298,7 +303,7 @@ public class LangUtil {
                                result.add(entry);
                        }
                }
-               return (String[]) result.toArray(new String[0]);
+               return result.toArray(new String[0]);
        }
 
        /**
@@ -886,7 +891,7 @@ public class LangUtil {
                String line;
                int elided = 0;
                while (!lines.isEmpty()) {
-                       line = (String) lines.getLast();
+                       line = lines.getLast();
                        if (!checker.acceptString(line)) {
                                break;
                        } else {
@@ -898,7 +903,7 @@ public class LangUtil {
                        final int EOL_LEN = EOL.length();
                        int totalLength = 0;
                        while (!lines.isEmpty()) {
-                               totalLength += EOL_LEN + ((String) lines.getFirst()).length();
+                               totalLength += EOL_LEN + lines.getFirst().length();
                                lines.removeFirst();
                        }
                        if (stack.length() > totalLength) {
@@ -1060,7 +1065,7 @@ public class LangUtil {
                if (!LangUtil.isEmpty(args)) {
                        cmd.addAll(Arrays.asList(args));
                }
-               String[] command = (String[]) cmd.toArray(new String[0]);
+               String[] command = cmd.toArray(new String[0]);
                if (null == controller) {
                        controller = new ProcessController();
                }
@@ -1249,7 +1254,7 @@ public class LangUtil {
                        if (!LangUtil.isEmpty(args)) {
                                cmd.addAll(Arrays.asList(args));
                        }
-                       init((String[]) cmd.toArray(new String[0]), mainClass);
+                       init(cmd.toArray(new String[0]), mainClass);
                }
 
                public final void init(String[] command, String label) {
@@ -1315,6 +1320,7 @@ public class LangUtil {
                        inStream = new FileUtil.Pipe(System.in, process.getOutputStream());
                        // start 4 threads, process & pipes for in, err, out
                        Runnable processRunner = new Runnable() {
+                               @Override
                                public void run() {
                                        Throwable thrown = null;
                                        int result = Integer.MIN_VALUE;
@@ -1466,6 +1472,7 @@ public class LangUtil {
                                thrown = ((null != fromProcess) || (null != fromInPipe) || (null != fromOutPipe) || (null != fromErrPipe));
                        }
 
+                       @Override
                        public String toString() {
                                StringBuffer sb = new StringBuffer();
                                append(sb, fromProcess, "process");
index 995d885a709c3b51fde32ebae204b7f8a65c62eb..dd355f8e5b26b97a4786b225c8230aa35b664add 100644 (file)
@@ -13,6 +13,6 @@
        <classpathentry kind="lib" path="/lib/bcel/bcel.jar" sourcepath="/lib/bcel/bcel-src.zip"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
        <classpathentry combineaccessrules="false" kind="src" path="/org.aspectj.matcher"/>
-       <classpathentry kind="lib" path="/lib/asm/asm-6.0.renamed.jar"/>
+       <classpathentry kind="lib" path="/lib/asm/asm-6.1.1.renamed.jar"/>
        <classpathentry kind="output" path="bin"/>
 </classpath>
index f6f3ab40edcd9d2661698f1a8298eff366bf2fc2..d39299acec8756f87e4b373ec4551bd407b731db 100644 (file)
@@ -118,12 +118,8 @@ public abstract class WeaveTestCase extends TestCase {
                        gen = classType.getLazyClassGen(); // new LazyClassGen(classType);
                }
                try {
-                       File possibleVmSpecificFile = new File(TESTDATA_DIR,outName + "." + LangUtil.getVmVersionString()+".txt");
-                       if (possibleVmSpecificFile.exists()) {                          
-                               checkClass(gen, outDirPath, outName + "." + LangUtil.getVmVersionString()+".txt");
-                       } else {
-                               checkClass(gen, outDirPath, outName + ".txt");
-                       }
+                       String filenameToUse = findMostRelevantFile(outName);
+                       checkClass(gen, outDirPath, filenameToUse);
                        if (runTests) {
                                System.out.println("*******RUNNING: " + outName + "  " + name + " *******");
                                TestUtil.runMain(makeClassPath(outDirPath), name);
@@ -137,6 +133,19 @@ public abstract class WeaveTestCase extends TestCase {
                        throw e;
                }
        }
+       
+       public String findMostRelevantFile(String name) {
+               double version = LangUtil.getVmVersion();
+               while (version > 0) {
+                       String possibleFileName = name+"."+Double.toString(version)+".txt";
+                       if (new File(TESTDATA_DIR, possibleFileName).exists()) {
+                               return possibleFileName;
+                       }
+                       version--;
+               }
+               // Use the standard file
+               return name+".txt";
+       }
 
        public String makeClassPath(String outDir) {
                return outDir + File.pathSeparator + getTraceJar() + File.pathSeparator + classDir + File.pathSeparator