diff options
author | Andy Clement <aclement@pivotal.io> | 2016-11-07 13:04:55 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2016-11-07 13:04:55 -0800 |
commit | de34df77ea7f7372894cf1e2352766118a798e98 (patch) | |
tree | e0d75970e19c61af1ba204810ee1ebebbd1e8166 | |
parent | 64c97807a20105644f604fe9b5263acdb63bd41d (diff) | |
download | aspectj-de34df77ea7f7372894cf1e2352766118a798e98.tar.gz aspectj-de34df77ea7f7372894cf1e2352766118a798e98.zip |
Upgraded to new JDT compiler - neon.1 and a bit
37 files changed, 236 insertions, 196 deletions
diff --git a/build/.isJava5 b/build/.isJava5 new file mode 100644 index 000000000..136d06384 --- /dev/null +++ b/build/.isJava5 @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java b/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java index c1323bb58..253e49fb1 100644 --- a/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java +++ b/build/src/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java @@ -84,7 +84,7 @@ public class AntBuilder extends Builder { /** * Ensure targets exist for this module and all antecedants, so topoSort can work. */ - private static void makeTargetsForResult(final Result result, final Hashtable targets) { + private static void makeTargetsForResult(final Result result, final Hashtable<String,Target> targets) { final String resultTargetName = resultToTargetName(result); Target target = (Target) targets.get(resultTargetName); if (null == target) { @@ -196,7 +196,7 @@ public class AntBuilder extends Builder { return copy; } - protected void dumpMinFile(Result result, File classesDir, List errors) { + protected void dumpMinFile(Result result, File classesDir, List<String> errors) { String name = result.getName() + "-empty"; File minFile = new File(classesDir, name); FileWriter fw = null; @@ -211,8 +211,8 @@ public class AntBuilder extends Builder { } - protected boolean compile(Result result, File classesDir, boolean useExistingClasses, List errors) { - + @Override + protected boolean compile(Result result, File classesDir, boolean useExistingClasses, List<String> errors) { if (!classesDir.exists() && !classesDir.mkdirs()) { errors.add("compile - unable to create " + classesDir); return false; @@ -224,8 +224,9 @@ public class AntBuilder extends Builder { Path path = new Path(project); boolean hasSourceDirectories = false; boolean isJava5Compile = false; - for (Iterator iter = result.getSrcDirs().iterator(); iter.hasNext();) { - File file = (File) iter.next(); + for (File file: result.getSrcDirs()) { +// for (Iterator iter = result.getSrcDirs().iterator(); iter.hasNext();) { +// File file = (File) iter.next(); path.createPathElement().setLocation(file); if (!isJava5Compile && (Util.Constants.JAVA5_SRC.equals(file.getName()) || Util.Constants.JAVA5_TESTSRC.equals(file.getName()) || new File( @@ -268,8 +269,8 @@ public class AntBuilder extends Builder { javac.setTarget("1.1"); // 1.1 class files - Javac in 1.4 uses 1.4 javac.setSource("1.3"); } else { - javac.setSource("1.5"); - javac.setTarget("1.5"); + javac.setSource("1.8"); + javac.setTarget("1.8"); } // compile boolean passed = false; @@ -330,7 +331,8 @@ public class AntBuilder extends Builder { * Merge classes directory and any merge jars into module jar with any specified manifest file. META-INF directories are * excluded. */ - protected boolean assemble(Result result, File classesDir, List errors) { + @Override + protected boolean assemble(Result result, File classesDir, List<String> errors) { if (!buildingEnabled) { return false; } @@ -400,18 +402,18 @@ public class AntBuilder extends Builder { * @see org.aspectj.internal.tools.build.Builder#buildAntecedants(Module) */ protected Result[] getAntecedantResults(Result moduleResult) { - Hashtable targets = new Hashtable(); + Hashtable<String,Target> targets = new Hashtable<>(); makeTargetsForResult(moduleResult, targets); String targetName = resultToTargetName(moduleResult); // bug: doc says topoSort returns String, but returns Target - Collection result = project.topoSort(targetName, targets); + Collection<Target> result = project.topoSort(targetName, targets); // fyi, we don't rely on topoSort to detect cycles - see buildAll int size = result.size(); if (0 == result.size()) { return new Result[0]; } - ArrayList toReturn = new ArrayList(); - for (Iterator iter = result.iterator(); iter.hasNext();) { + ArrayList<String> toReturn = new ArrayList<>(); + for (Iterator<Target> iter = result.iterator(); iter.hasNext();) { Target target = (Target) iter.next(); String name = target.getName(); if (null == name) { @@ -450,11 +452,10 @@ public class AntBuilder extends Builder { zip.setDestFile(result.getOutputFile()); ZipFileSet zipfileset = null; final Module module = result.getModule(); - List known = result.findJarRequirements(); + List<File> known = result.findJarRequirements(); removeLibraryFilesToSkip(module, known); // -- merge any antecedents, less any manifest - for (Iterator iter = known.iterator(); iter.hasNext();) { - File jarFile = (File) iter.next(); + for (File jarFile: known) { zipfileset = new ZipFileSet(); zipfileset.setProject(project); zipfileset.setSrc(jarFile); @@ -541,8 +542,7 @@ public class AntBuilder extends Builder { /** @return true if aspectjrt.jar is on classpath */ private static boolean runtimeJarOnClasspath(Result result) { - for (Iterator iter = result.getLibJars().iterator(); iter.hasNext();) { - File file = (File) iter.next(); + for (File file: result.getLibJars()) { if ("aspectjrt.jar".equals(file.getName())) { return true; } @@ -582,6 +582,7 @@ public class AntBuilder extends Builder { * @param runtimeJar the Path to the aspectjrt.jar * @return javac or another Task invoking the AspectJ compiler */ + @SuppressWarnings("unchecked") static Task aspectJTask(Javac javac, Path toolsJar, Path runtimeJar) { Object task = null; String url = null; diff --git a/build/src/org/aspectj/internal/tools/ant/taskdefs/Checklics.java b/build/src/org/aspectj/internal/tools/ant/taskdefs/Checklics.java index 0cefa7952..819673cff 100644 --- a/build/src/org/aspectj/internal/tools/ant/taskdefs/Checklics.java +++ b/build/src/org/aspectj/internal/tools/ant/taskdefs/Checklics.java @@ -54,7 +54,7 @@ public class Checklics extends MatchingTask { public static final String EPL_CPL_IBM_PARC_XEROX_OTHERS_TAG = "epl-cpl-ibm|parc|xerox|vmware|others"; public static final String DEFAULT = EPL_CPL_IBM_PARC_XEROX_OTHERS_TAG; - static final Map LICENSES; // unmodifiable Map + static final Map<String,License> LICENSES; // unmodifiable Map static { final String CONTRIBUTORS = "Contributors"; @@ -82,7 +82,7 @@ public class Checklics extends MatchingTask { License MPL_ONLY = new License(MPL_ONLY_TAG, LIC_MPL); License MPL_PARC = new License(MPL_PARC_TAG, LIC_MPL, PARC); License PARC_COPYRIGHT = new License(PARC_COPYRIGHT_TAG, null, PARC); - LICENSES = new Hashtable(); + LICENSES = new Hashtable<>(); LICENSES.put(APL.tag, APL); LICENSES.put(MPL.tag, MPL); LICENSES.put(MPL_PARC.tag, MPL_PARC); @@ -458,11 +458,11 @@ class HeaderInfo { /** last line of license */ public final boolean hasLicense; - public HeaderInfo(File file, int lastLine, List years, boolean hasLicense) { + public HeaderInfo(File file, int lastLine, List<String> years, boolean hasLicense) { this.lastLine = lastLine; this.file = file; this.hasLicense = hasLicense; - List newYears = new ArrayList(); + List<String> newYears = new ArrayList<>(); newYears.addAll(years); Collections.sort(newYears); this.years = Collections.unmodifiableList(newYears); @@ -610,7 +610,7 @@ class Header { } public static HeaderInfo checkFile(final File file) { - ArrayList years = new ArrayList(); + ArrayList<String> years = new ArrayList<>(); int endLine = 0; BufferedReader input = null; int lineNum = 0; @@ -647,7 +647,7 @@ class Header { * * @return true if this line has end-of-comment */ - private static boolean checkLine(String line, ArrayList years) { + private static boolean checkLine(String line, ArrayList<String> years) { if ((null == line) || (0 == line.length())) { return false; } diff --git a/build/src/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java b/build/src/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java index 99ab1ab44..7a9092352 100644 --- a/build/src/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java +++ b/build/src/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java @@ -25,9 +25,9 @@ public abstract class ConditionalTask extends Task { public final static String TRUE = "true"; - private List ifs; - protected List ifs() { - return ifs != null ? ifs : (ifs = new Vector()); + private List<If> ifs; + protected List<If> ifs() { + return ifs != null ? ifs : (ifs = new Vector<If>()); } public If createIf() { @@ -166,9 +166,9 @@ public abstract class ConditionalTask extends Task { return getFalses().size() == 0; } - protected List getFalses() { - Iterator iter = ifs().iterator(); - List result = new Vector(); + protected List<String> getFalses() { + Iterator<If> iter = ifs().iterator(); + List<String> result = new Vector<>(); while (iter.hasNext()) { If next = (If) iter.next(); String name = next.getName(); diff --git a/build/src/org/aspectj/internal/tools/build/Builder.java b/build/src/org/aspectj/internal/tools/build/Builder.java index 2bd49ac61..4fe47ced4 100644 --- a/build/src/org/aspectj/internal/tools/build/Builder.java +++ b/build/src/org/aspectj/internal/tools/build/Builder.java @@ -104,14 +104,14 @@ public abstract class Builder { private static final String SKIP_LIBRARIES_KEY = "skip.libraries"; /** List (String) names of libraries to skip during assembly */ - private static final List SKIP_LIBRARIES; + private static final List<String> SKIP_LIBRARIES; private static final String ERROR_KEY = "error loading properties"; private static final Properties PROPS; static { PROPS = new Properties(); - List skips = Collections.EMPTY_LIST; + List<String> skips = Collections.emptyList(); String resourcePattern = "**/*.txt,**/*.rsc,**/*.gif,**/*.properties"; String allPattern = "**/*"; String binarySourcePattern = "**/*.rsc,**/*.gif,**/*.jar,**/*.zip"; @@ -149,7 +149,7 @@ public abstract class Builder { if ((null == text) || (0 == text.length())) { return Collections.EMPTY_LIST; } - List strings = new ArrayList(); + List<String> strings = new ArrayList<>(); StringTokenizer tok = new StringTokenizer(text, ","); while (tok.hasMoreTokens()) { String token = tok.nextToken().trim(); @@ -275,13 +275,13 @@ public abstract class Builder { return buildProduct(buildSpec); } Result result = specifyResultFor(buildSpec); - ArrayList errors = new ArrayList(); + ArrayList<String> errors = new ArrayList<>(); try { return buildAll(result, errors); } finally { if (0 < errors.size()) { String label = "error building " + buildSpec + ": "; - for (Iterator iter = errors.iterator(); iter.hasNext();) { + for (Iterator<String> iter = errors.iterator(); iter.hasNext();) { String m = label + iter.next(); handler.error(m); } @@ -340,7 +340,7 @@ public abstract class Builder { */ protected final boolean buildAll(Result result, List errors) { Result[] buildList = skipUptodate(getAntecedantResults(result)); - ArrayList doneList = new ArrayList(); + ArrayList<String> doneList = new ArrayList<>(); if ((null != buildList) && (0 < buildList.length)) { if (isLogging()) { handler.log("modules to build: " + Arrays.asList(buildList)); @@ -371,7 +371,7 @@ public abstract class Builder { * the List sink for errors, if any * @return false after successful build, when module jar should exist */ - protected final boolean buildOnly(Result result, List errors) { + protected final boolean buildOnly(Result result, List<String> errors) { if (!result.outOfDate()) { return true; } @@ -545,7 +545,7 @@ public abstract class Builder { * deliverables. */ protected ProductModule[] discoverModules(File productDir, Modules modules) { - final ArrayList found = new ArrayList(); + final ArrayList<File> found = new ArrayList<>(); FileFilter filter = new FileFilter() {// empty jar files public boolean accept(File file) { if ((null != file) && file.canRead() @@ -557,9 +557,8 @@ public abstract class Builder { } }; Util.visitFiles(productDir, filter); - ArrayList results = new ArrayList(); - for (Iterator iter = found.iterator(); iter.hasNext();) { - File file = (File) iter.next(); + ArrayList<ProductModule> results = new ArrayList<>(); + for (File file: found) { String jarName = moduleAliasFor(file.getName().toLowerCase()); if (jarName.endsWith(".jar") || jarName.endsWith(".zip")) { // XXXFileLiteral jarName = jarName.substring(0, jarName.length() - 4); @@ -625,7 +624,7 @@ public abstract class Builder { * the List to add error messages to */ abstract protected boolean compile(Result result, File classesDir, - boolean useExistingClasses, List errors); + boolean useExistingClasses, List<String> errors); /** * Assemble the module distribution from the classesDir, saving String @@ -634,7 +633,7 @@ public abstract class Builder { * @see #removeLibraryFilesToSkip(Module, File) */ abstract protected boolean assemble(Result result, File classesDir, - List errors); + List<String> errors); /** * Assemble the module distribution from the classesDir and all diff --git a/build/src/org/aspectj/internal/tools/build/Module.java b/build/src/org/aspectj/internal/tools/build/Module.java index 02209e22e..8df660e2a 100644 --- a/build/src/org/aspectj/internal/tools/build/Module.java +++ b/build/src/org/aspectj/internal/tools/build/Module.java @@ -68,13 +68,13 @@ public class Module { } /** @return all source files under srcDir */ - private static Iterator sourceFiles(File srcDir) { - ArrayList result = new ArrayList(); + private static Iterator<File> sourceFiles(File srcDir) { + ArrayList<File> result = new ArrayList<>(); sourceFiles(srcDir, result); return result.iterator(); } - private static void sourceFiles(File srcDir, List result) { + private static void sourceFiles(File srcDir, List<File> result) { if ((null == srcDir) || !srcDir.canRead() || !srcDir.isDirectory()) { return; } @@ -88,9 +88,8 @@ public class Module { } } - private static void addIfNew(List source, List sink) { - for (Iterator iter = source.iterator(); iter.hasNext();) { - Object item = iter.next(); + private static void addIfNew(List<File> source, List<File> sink) { + for (File item: source) { if (!sink.contains(item)) { sink.add(item); } @@ -102,7 +101,7 @@ public class Module { * * @see findKnownJarAntecedants() */ - static void doFindJarRequirements(Result result, List known) { + static void doFindJarRequirements(Result result, List<File> known) { Util.iaxIfNull(result, "result"); Util.iaxIfNull(known, "known"); addIfNew(result.getLibJars(), known); @@ -170,25 +169,25 @@ public class Module { private final File moduleJar; /** File list of library jars */ - private final List libJars; + private final List<File> libJars; - /** String list of classpath variables */ - private final List classpathVariables; + /** List of classpath variables */ + private final List<String> classpathVariables; /** - * File list of library jars exported to clients (duplicates some libJars + * List of library jars exported to clients (duplicates some libJars * entries) */ - private final List exportedLibJars; + private final List<File> exportedLibJars; /** File list of source directories */ - private final List srcDirs; + private final List<File> srcDirs; /** properties from the modules {name}.properties file */ private final Properties properties; - /** Module list of required modules */ - private final List requiredModules; + /** List of required modules */ + private final List<Module> requiredModules; /** logger */ private final Messager messager; @@ -200,11 +199,11 @@ public class Module { Util.iaxIfNull(name, "name"); Util.iaxIfNull(modules, "modules"); this.moduleDir = moduleDir; - this.libJars = new ArrayList(); - this.exportedLibJars = new ArrayList(); - this.requiredModules = new ArrayList(); - this.srcDirs = new ArrayList(); - this.classpathVariables = new ArrayList(); + this.libJars = new ArrayList<>(); + this.exportedLibJars = new ArrayList<>(); + this.requiredModules = new ArrayList<>(); + this.srcDirs = new ArrayList<>(); + this.classpathVariables = new ArrayList<>(); this.properties = new Properties(); this.name = name; this.modules = modules; @@ -239,10 +238,10 @@ public class Module { } final long time = outputFile.lastModified(); File file; - for (Iterator iter = result.getSrcDirs().iterator(); iter.hasNext();) { - File srcDir = (File) iter.next(); - for (Iterator srcFiles = sourceFiles(srcDir); srcFiles.hasNext();) { - file = (File) srcFiles.next(); + for (Iterator<File> iter = result.getSrcDirs().iterator(); iter.hasNext();) { + File srcDir = iter.next(); + for (Iterator<File> srcFiles = sourceFiles(srcDir); srcFiles.hasNext();) { + file = srcFiles.next(); if (outOfDate(time, file)) { return true; } @@ -284,23 +283,27 @@ public class Module { : (kind.normal ? release : test); } - List srcDirs(Result result) { + List<File> srcDirs(Result result) { myResult(result); return srcDirs; } - List libJars(Result result) { + + List<File> libJars(Result result) { myResult(result); return libJars; } - List classpathVariables(Result result) { + + List<String> classpathVariables(Result result) { myResult(result); return classpathVariables; } - List exportedLibJars(Result result) { + + List<File> exportedLibJars(Result result) { myResult(result); return exportedLibJars; } - List requiredModules(Result result) { + + List<Module> requiredModules(Result result) { myResult(result); return requiredModules; } @@ -610,7 +613,7 @@ public class Module { String[] tokenize(String line) { final String DELIM = " \n\t\\<>\"="; StringTokenizer st = new StringTokenizer(line, DELIM, true); - ArrayList result = new ArrayList(); + ArrayList<String> result = new ArrayList<>(); StringBuffer quote = new StringBuffer(); boolean inQuote = false; while (st.hasMoreTokens()) { diff --git a/build/src/org/aspectj/internal/tools/build/Modules.java b/build/src/org/aspectj/internal/tools/build/Modules.java index 49391fe68..ca2b50aac 100644 --- a/build/src/org/aspectj/internal/tools/build/Modules.java +++ b/build/src/org/aspectj/internal/tools/build/Modules.java @@ -24,7 +24,7 @@ import java.util.Hashtable; */ public class Modules { - private final Hashtable modules = new Hashtable(); + private final Hashtable<String,Module> modules = new Hashtable<>(); public final File baseDir; public final File jarDir; private final Messager handler; diff --git a/build/src/org/aspectj/internal/tools/build/Result.java b/build/src/org/aspectj/internal/tools/build/Result.java index 672ba561b..3b5a4e141 100644 --- a/build/src/org/aspectj/internal/tools/build/Result.java +++ b/build/src/org/aspectj/internal/tools/build/Result.java @@ -40,7 +40,7 @@ public class Result { private static final Kind[] KINDS = { RELEASE, TEST, RELEASE_ALL, TEST_ALL }; - private static final HashMap nameToResult = new HashMap(); + private static final HashMap<String,Result> nameToResult = new HashMap<>(); public static boolean isTestingJar(String name) { name = name.toLowerCase(); @@ -141,25 +141,25 @@ public class Result { /** path to output jar - may not exist */ private final File outputFile; - /** list of required Result */ - private final List requiredResults; + /** List of required Result */ + private final List<Result> requiredResults; - /** File list of library jars */ - private final List libJars; + /** List of library jars */ + private final List<File> libJars; - /** String list of classpath variables */ - private final List classpathVariables; + /** List of classpath variables */ + private final List<String> classpathVariables; transient String toLongString; /** - * File list of library jars exported to clients (duplicates some libJars + * List of library jars exported to clients (duplicates some libJars * entries) */ - private final List exportedLibJars; + private final List<File> exportedLibJars; - /** File list of source directories */ - private final List srcDirs; + /** List of source directories */ + private final List<File> srcDirs; /** true if this has calculated List fields. */ private boolean requiredDone; @@ -179,11 +179,11 @@ public class Result { Result(Kind kind, Module module, File jarDir) { this.kind = kind; this.module = module; - this.libJars = new ArrayList(); - this.exportedLibJars = new ArrayList(); - this.srcDirs = new ArrayList(); - this.classpathVariables = new ArrayList(); - this.requiredResults = new ArrayList(); + this.libJars = new ArrayList<>(); + this.exportedLibJars = new ArrayList<>(); + this.srcDirs = new ArrayList<>(); + this.classpathVariables = new ArrayList<>(); + this.requiredResults = new ArrayList<>(); String name = module.name; if (!kind.normal) { name += "-test"; @@ -218,14 +218,14 @@ public class Result { } /** @return List (File) of jar's required */ - public List findJarRequirements() { - ArrayList result = new ArrayList(); + public List<File> findJarRequirements() { + ArrayList<File> result = new ArrayList<>(); Module.doFindJarRequirements(this, result); return result; } /** @return unmodifiable List of String classpath variables */ - public List getClasspathVariables() { + public List<String> getClasspathVariables() { return safeList(classpathVariables); } @@ -238,14 +238,14 @@ public class Result { /** * @return unmodifiable list of exported library files, guaranteed readable */ - public List getExportedLibJars() { + public List<File> getExportedLibJars() { return safeList(exportedLibJars); } /** * @return unmodifiable list of required library files, guaranteed readable */ - public List getLibJars() { + public List<File> getLibJars() { requiredDone(); return safeList(libJars); } @@ -258,7 +258,7 @@ public class Result { // return safeList(merges); // } /** @return unmodifiable list of source directories, guaranteed readable */ - public List getSrcDirs() { + public List<File> getSrcDirs() { return safeList(srcDirs); } @@ -283,12 +283,12 @@ public class Result { return name; } - private List safeList(List l) { + private <T> List<T> safeList(List<T> l) { requiredDone(); return Collections.unmodifiableList(l); } - private Result[] safeResults(List list) { + private Result[] safeResults(List<Result> list) { requiredDone(); if (null == list) { return new Result[0]; @@ -300,8 +300,8 @@ public class Result { srcDirs.addAll(getModule().srcDirs(this)); if (getKind().normal) { // trim testing source directories - for (ListIterator iter = srcDirs.listIterator(); iter.hasNext();) { - File srcDir = (File) iter.next(); + for (ListIterator<File> iter = srcDirs.listIterator(); iter.hasNext();) { + File srcDir = iter.next(); if (isTestingDir(srcDir.getName())) { iter.remove(); } @@ -313,8 +313,8 @@ public class Result { libJars.addAll(getModule().libJars(this)); if (getKind().normal && !isTestingModule(getModule())) { // trim testing libraries - for (ListIterator iter = libJars.listIterator(); iter.hasNext();) { - File libJar = (File) iter.next(); + for (ListIterator<File> iter = libJars.listIterator(); iter.hasNext();) { + File libJar = iter.next(); if (isTestingJar(libJar.getName())) { iter.remove(); } @@ -348,10 +348,9 @@ public class Result { assertKind(RELEASE); } // externally-required: - List modules = module.requiredModules(this); + List<Module> modules = module.requiredModules(this); final boolean adoptTests = !kind.normal || isTestingModule(module); - for (Iterator iter = modules.iterator(); iter.hasNext();) { - Module required = (Module) iter.next(); + for (Module required: modules) { if (adoptTests) { // testing builds can rely on other release and test results requiredResults.add(required.getResult(TEST)); diff --git a/build/src/org/aspectj/internal/tools/build/SampleGatherer.java b/build/src/org/aspectj/internal/tools/build/SampleGatherer.java index f95b43b5b..a9d29af6b 100644 --- a/build/src/org/aspectj/internal/tools/build/SampleGatherer.java +++ b/build/src/org/aspectj/internal/tools/build/SampleGatherer.java @@ -268,10 +268,8 @@ class Sample { public static final String ASPECTJ_TEAM = "The AspectJ Team"; /** sort by anchorName, file path, and start/end location */ - static Comparator NAME_SOURCE_COMPARER = new Comparator() { - public int compare(Object lhs, Object rhs) { - Sample left = (Sample) lhs; - Sample right = (Sample) rhs; + static Comparator<Sample> NAME_SOURCE_COMPARER = new Comparator<Sample>() { + public int compare(Sample left, Sample right) { if (null == left) { return (null == right ? 0 : -1); } @@ -295,10 +293,8 @@ class Sample { }; /** sort by author, then NAME_SOURCE_COMPARER */ - static Comparator AUTHOR_NAME_SOURCE_COMPARER = new Comparator() { - public int compare(Object lhs, Object rhs) { - Sample left = (Sample) lhs; - Sample right = (Sample) rhs; + static Comparator<Sample> AUTHOR_NAME_SOURCE_COMPARER = new Comparator<Sample>() { + public int compare(Sample left, Sample right) { if (null == left) { return (null == right ? 0 : -1); } @@ -309,7 +305,7 @@ class Sample { if (0 != result) { return result; } - return NAME_SOURCE_COMPARER.compare(lhs, rhs); + return NAME_SOURCE_COMPARER.compare(left,right); } }; @@ -395,7 +391,7 @@ class Sample { * type-safe Collection of samples. */ class Samples { - private ArrayList samples = new ArrayList(); + private ArrayList<Sample> samples = new ArrayList<>(); int size() { return samples.size(); } @@ -405,12 +401,12 @@ class Samples { /** * @return List copy, sorted by Sample.NAME_SOURCE_COMPARER */ - List getSortedSamples() { + List<Sample> getSortedSamples() { return getSortedSamples(Sample.NAME_SOURCE_COMPARER); } - List getSortedSamples(Comparator comparer) { - ArrayList result = new ArrayList(); + List<Sample> getSortedSamples(Comparator<Sample> comparer) { + ArrayList<Sample> result = new ArrayList<>(); result.addAll(samples); Collections.sort(result, comparer); return result; @@ -961,7 +957,7 @@ class SampleUtil { } public static String[] splitAnchorName(String anchorName) { - ArrayList result = new ArrayList(); + ArrayList<String> result = new ArrayList<>(); int start = 0; int loc = anchorName.indexOf("-", start); String next; diff --git a/build/testsrc/org/aspectj/build/BuildModuleTests.java b/build/testsrc/org/aspectj/build/BuildModuleTests.java index bfc6b58cc..073cf0f39 100644 --- a/build/testsrc/org/aspectj/build/BuildModuleTests.java +++ b/build/testsrc/org/aspectj/build/BuildModuleTests.java @@ -27,7 +27,6 @@ import java.io.FileFilter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; @@ -62,7 +61,7 @@ public class BuildModuleTests extends TestCase { return null; // use permissive default } - final static List SOURCE_NAMES = Collections.unmodifiableList( + final static List<String> SOURCE_NAMES = Collections.unmodifiableList( Arrays.asList(new String[]{"src", "testsrc", "java5-src", "java5-testsrc", "aspectj-src"})); /** @@ -70,9 +69,8 @@ public class BuildModuleTests extends TestCase { * @return */ private static File[] findSourceRoots(File moduleDir) { - ArrayList result = new ArrayList(); - for (Iterator iter = SOURCE_NAMES.iterator(); iter.hasNext();) { - String name = (String) iter.next(); + ArrayList<File> result = new ArrayList<>(); + for (String name: SOURCE_NAMES) { File srcDir = new File(moduleDir, name); if (srcDir.canRead() && srcDir.isDirectory()) { result.add(srcDir); @@ -219,12 +217,12 @@ public class BuildModuleTests extends TestCase { */ static class UnknownFileCheck implements FileFilter { private static final UnknownFileCheck SINGLETON = new UnknownFileCheck(); - private static final ArrayList STATIC_ERRORS = new ArrayList(); + private static final ArrayList<String> STATIC_ERRORS = new ArrayList<>(); // Builder.BINARY_SOURCE_PATTERN and Builder.RESOURCE_PATTERN - public static final List KNOWN_SUFFIXES; + public static final List<String> KNOWN_SUFFIXES; static { - List suffixes = new ArrayList(); + List<String> suffixes = new ArrayList<>(); // sources from org.aspectj.util.FileUtil.SOURCE_SUFFIXES suffixes.add(".aj"); suffixes.add(".java"); @@ -278,8 +276,7 @@ public class BuildModuleTests extends TestCase { return false; } // to do not accepting uppercase suffixes... - for (Iterator iter = KNOWN_SUFFIXES.iterator(); iter.hasNext();) { - String suffix = (String) iter.next(); + for (String suffix: KNOWN_SUFFIXES) { if (name.endsWith(suffix)) { return false; } @@ -287,7 +284,7 @@ public class BuildModuleTests extends TestCase { return true; } - void unknownFiles(File dir, ArrayList results) { + void unknownFiles(File dir, ArrayList<File> results) { File[] files = dir.listFiles(this); for (int j = 0; j < files.length; j++) { File file = files[j]; diff --git a/build/testsrc/org/aspectj/internal/build/BuildModuleTest.java b/build/testsrc/org/aspectj/internal/build/BuildModuleTest.java index d513c1b71..d0dfb55f2 100644 --- a/build/testsrc/org/aspectj/internal/build/BuildModuleTest.java +++ b/build/testsrc/org/aspectj/internal/build/BuildModuleTest.java @@ -80,7 +80,7 @@ public class BuildModuleTest extends TestCase { } } - ArrayList tempFiles = new ArrayList(); + ArrayList<File> tempFiles = new ArrayList<>(); private File jarDir; private boolean deleteJars; boolean building; // must be enabled for tests to run diff --git a/build/testsrc/org/aspectj/internal/build/ModulesTest.java b/build/testsrc/org/aspectj/internal/build/ModulesTest.java index c482950c6..0478c44c2 100644 --- a/build/testsrc/org/aspectj/internal/build/ModulesTest.java +++ b/build/testsrc/org/aspectj/internal/build/ModulesTest.java @@ -41,7 +41,7 @@ import org.aspectj.internal.tools.build.Result.Kind; * */ public class ModulesTest extends TestCase { - public static final List /*String*/ MODULE_NAMES; + public static final List<String> MODULE_NAMES; private static final File BASE_DIR = new File(".."); static { String[] names = { @@ -49,7 +49,7 @@ public class ModulesTest extends TestCase { "bridge", "loadtime", "loadtime5", "org.aspectj.ajdt.core", "runtime", "taskdefs", "testing-client", "testing-util", "tests", "util", "weaver"}; - List list = Arrays.asList(names); + List<String> list = Arrays.asList(names); MODULE_NAMES = Collections.unmodifiableList(list); } @@ -80,7 +80,7 @@ public class ModulesTest extends TestCase { protected void tearDown() throws Exception { super.tearDown(); - for (Iterator iter = tempFiles.iterator(); iter.hasNext();) { + for (Iterator<File> iter = tempFiles.iterator(); iter.hasNext();) { File file = (File) iter.next(); if (!ModulesTest.delete(file)) { System.err.println("warning: ModulesTest unable to delete " + file); @@ -101,9 +101,8 @@ public class ModulesTest extends TestCase { } public void testAllModulesCreation() { - ArrayList badModules = new ArrayList(); - for (Iterator iter = MODULE_NAMES.iterator(); iter.hasNext();) { - String name = (String) iter.next(); + ArrayList<Module> badModules = new ArrayList<>(); + for (String name: MODULE_NAMES) { File dir = new File(BASE_DIR, name); if (dir.isDirectory()) { File classpath = new File(dir, ".classpath"); @@ -118,8 +117,7 @@ public class ModulesTest extends TestCase { } if (!badModules.isEmpty()) { StringBuffer sb = new StringBuffer(); - for (Iterator iter = badModules.iterator(); iter.hasNext();) { - Module module = (Module) iter.next(); + for (Module module: badModules) { System.err.println(module.toLongString()); sb.append("\n"); sb.append(module); diff --git a/lib/build/build.jar b/lib/build/build.jar Binary files differindex d08b25042..f48ce3390 100644 --- a/lib/build/build.jar +++ b/lib/build/build.jar diff --git a/lib/build/build.old.jar b/lib/build/build.old.jar Binary files differnew file mode 100644 index 000000000..d08b25042 --- /dev/null +++ b/lib/build/build.old.jar diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties index 185ab046c..630fedb7a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties @@ -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 1.8.10 -compiler.version = Eclipse Compiler Mars.2 #A7BBA8B1, 3.12 +compiler.version = Eclipse Compiler Neon.1 #5925A0B5, 3.12 compiler.copyright = ## this next one superceded by above... diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java index 0755476e9..ad50e430c 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java @@ -181,6 +181,7 @@ public class AccessForInlineVisitor extends ASTVisitor { } FieldBinding ret = new InlineAccessFieldBinding(inAspect, binding, m); inAspect.accessForInline.put(m, ret); + System.out.println(">>"+m); return ret; } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java index 73e539e71..0d6e90d4c 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java @@ -65,7 +65,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { public int adviceSequenceNumberInType; public MethodBinding proceedMethodBinding; // set during this.resolveStaments, referenced by Proceed - public List proceedCalls = new ArrayList(2); // populated during Proceed.findEnclosingAround + public List<Proceed> proceedCalls = new ArrayList<>(2); // populated during Proceed.findEnclosingAround private boolean proceedInInners; private ResolvedMember[] proceedCallSignatures; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java index 88556fccf..2cb035a70 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java @@ -757,6 +757,11 @@ public class AjProblemReporter extends ProblemReporter { public String getSupplementaryMessageInfo() { return delegate.getSupplementaryMessageInfo(); } + + @Override + public boolean isInfo() { + return delegate.isInfo(); + } } public void duplicateMethodInType(AbstractMethodDeclaration methodDecl, boolean equalParameters, int severity) { diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 0dda15cb1..164af6629 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -1021,7 +1021,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } org.aspectj.ajdt.internal.compiler.CompilerAdapter.setCompilerAdapterFactory(this); - final Map<?, ?> settings = buildConfig.getOptions().getMap(); + final Map<String, String> settings = buildConfig.getOptions().getMap(); final BuildArgParser bMain = buildConfig.getBuildArgParser(); final org.aspectj.org.eclipse.jdt.internal.compiler.Compiler compiler = new org.aspectj.org.eclipse.jdt.internal.compiler.Compiler( diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java index ceba72e30..ffe2f4761 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java @@ -128,7 +128,7 @@ public class AjCompilerOptions extends CompilerOptions { * * @see org.eclipse.jdt.internal.compiler.impl.CompilerOptions#getMap() */ - public Map getMap() { + public Map<String,String> getMap() { Map<String,String> map = super.getMap(); // now add AspectJ additional options map.put(OPTION_ReportInvalidAbsoluteTypeName, getSeverityString(InvalidAbsoluteTypeName)); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/CompactTypeStructureRepresentation.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/CompactTypeStructureRepresentation.java index 1a88cb3c6..e9d367abd 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/CompactTypeStructureRepresentation.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/CompactTypeStructureRepresentation.java @@ -20,6 +20,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryNestedType; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation; import org.aspectj.org.eclipse.jdt.internal.compiler.env.ITypeAnnotationWalker; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; /** @@ -189,4 +190,7 @@ public class CompactTypeStructureRepresentation implements IBinaryType { return walker; } + public ExternalAnnotationStatus getExternalAnnotationStatus() { + return ExternalAnnotationStatus.NOT_EEA_CONFIGURED; + } }
\ No newline at end of file diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java index b7468d552..9d4cc3cec 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java @@ -49,7 +49,7 @@ public class BcweaverJarMaker { } public static void makeJar0() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.add("-outjar"); args.add("../weaver/testdata/tracing.jar"); @@ -63,7 +63,7 @@ public class BcweaverJarMaker { } public static void makeJar1() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.add("-outjar"); args.add("../weaver/testdata/megatrace.jar"); @@ -78,7 +78,7 @@ public class BcweaverJarMaker { public static void makeJarObviousNothing() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.add("-outjar"); args.add("../weaver/testdata/megatrace0easy.jar"); @@ -92,7 +92,7 @@ public class BcweaverJarMaker { } public static void makeJarHardNothing() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.add("-outjar"); args.add("../weaver/testdata/megatrace0hard.jar"); @@ -107,7 +107,7 @@ public class BcweaverJarMaker { public static void makeJar1a() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.add("-outjar"); args.add("../weaver/testdata/megatraceNoweave.jar"); @@ -124,7 +124,7 @@ public class BcweaverJarMaker { public static void makeJar2() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.add("-outjar"); args.add("../weaver/testdata/dummyAspect.jar"); @@ -137,7 +137,7 @@ public class BcweaverJarMaker { } public static void makeTestJars() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.add("-classpath"); args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar" + @@ -148,7 +148,7 @@ public class BcweaverJarMaker { CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); - args = new ArrayList(); + args = new ArrayList<>(); args.add("-classpath"); args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar" + @@ -159,7 +159,7 @@ public class BcweaverJarMaker { CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS); - args = new ArrayList(); + args = new ArrayList<>(); args.add("-classpath"); args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar" + @@ -196,7 +196,7 @@ public class BcweaverJarMaker { } public static void makeURLWeavingClassLoaderJars() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); /* * Vanilla classes @@ -302,7 +302,7 @@ public class BcweaverJarMaker { private static void buildJarWithClasspath(String outjar,String input,String deps,boolean nodebug) { System.out.println(" Building "+outjar); - List args = new ArrayList(); + List<String> args = new ArrayList<>(); if (nodebug) args.add("-g:none"); args.add("-classpath"); args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar" + @@ -332,7 +332,7 @@ public class BcweaverJarMaker { } public static void makeDuplicateManifestTestJars() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); /* * injar @@ -360,7 +360,7 @@ public class BcweaverJarMaker { } public static void makeAspectPathTestJars() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.clear(); args.add("-classpath"); @@ -372,7 +372,7 @@ public class BcweaverJarMaker { } public static void makeAjc11TestJars() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.clear(); args.add("-classpath"); @@ -384,7 +384,7 @@ public class BcweaverJarMaker { } public static void makeOutjarTestJars() throws IOException { - List args = new ArrayList(); + List<String> args = new ArrayList<>(); /* * parent diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java index d69906cdf..d43a3f340 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java @@ -32,7 +32,7 @@ public class BinaryFormsTestCase extends CommandTestCase { public void testJar1() throws IOException { String library = getSandboxName() + "/lib.jar"; - List args = new ArrayList(); + List<String> args = new ArrayList<>(); args.add("-outjar"); args.add(library); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjCompilerOptionsTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjCompilerOptionsTest.java index 818bee537..1e94e300a 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjCompilerOptionsTest.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjCompilerOptionsTest.java @@ -46,9 +46,9 @@ public class AjCompilerOptionsTest extends TestCase { assertFalse(options.generateEmacsSymFiles); assertFalse(options.noAtAspectJProcessing); - Map map = options.getMap(); + Map<String,String> map = options.getMap(); assertEquals(CompilerOptions.WARNING,map.get(AjCompilerOptions.OPTION_ReportInvalidAbsoluteTypeName)); - assertEquals(CompilerOptions.IGNORE,map.get(AjCompilerOptions.OPTION_ReportInvalidWildcardTypeName)); + assertEquals(CompilerOptions.WARNING,map.get(AjCompilerOptions.OPTION_ReportInvalidWildcardTypeName)); assertEquals(CompilerOptions.WARNING,map.get(AjCompilerOptions.OPTION_ReportUnresolvableMember)); assertEquals(CompilerOptions.WARNING,map.get(AjCompilerOptions.OPTION_ReportTypeNotExposedToWeaver)); assertEquals(CompilerOptions.IGNORE,map.get(AjCompilerOptions.OPTION_ReportShadowNotInStructure)); diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/VisitorTestCase.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/VisitorTestCase.java index 40d39359e..7fd131528 100644 --- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/VisitorTestCase.java +++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/patterns/VisitorTestCase.java @@ -15,7 +15,6 @@ import junit.framework.TestCase; import java.util.HashSet; import java.util.Set; -import java.util.Iterator; import java.io.LineNumberReader; import java.io.FileReader; @@ -28,8 +27,8 @@ import org.aspectj.weaver.patterns.TypePattern; */ public class VisitorTestCase extends TestCase { - private Set pointcuts = new HashSet(); - private Set typePatterns = new HashSet(); + private Set<String> pointcuts = new HashSet<>(); + private Set<String> typePatterns = new HashSet<>(); protected void setUp() throws Exception { super.setUp(); @@ -41,7 +40,7 @@ public class VisitorTestCase extends TestCase { rt.close(); } - private void feed(LineNumberReader r, Set set) throws Exception { + private void feed(LineNumberReader r, Set<String> set) throws Exception { for (String line = r.readLine(); line != null; line = r.readLine()) { set.add(line); } @@ -51,8 +50,7 @@ public class VisitorTestCase extends TestCase { if (pointcuts.isEmpty()) { fail("Empty pointcuts file!"); } - for (Iterator iterator = pointcuts.iterator(); iterator.hasNext();) { - String pointcut = (String) iterator.next(); + for (String pointcut: pointcuts) { try { DumpPointcutVisitor.check(pointcut); } catch (Throwable t) { @@ -66,8 +64,7 @@ public class VisitorTestCase extends TestCase { if (typePatterns.isEmpty()) { fail("Empty typePatterns file!"); } - for (Iterator iterator = typePatterns.iterator(); iterator.hasNext();) { - String tp = (String) iterator.next(); + for (String tp: typePatterns) { try { TypePattern p = new PatternParser(tp).parseTypePattern(); DumpPointcutVisitor.check(p, true); diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip Binary files differindex f950bd813..29a5eb821 100644 --- a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip +++ b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar Binary files differindex 63115ed1f..6aa41c4c1 100644 --- a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar +++ b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar diff --git a/testing-client/src/org/aspectj/testing/Tester.java b/testing-client/src/org/aspectj/testing/Tester.java index afd37a492..500c4c363 100644 --- a/testing-client/src/org/aspectj/testing/Tester.java +++ b/testing-client/src/org/aspectj/testing/Tester.java @@ -51,10 +51,10 @@ public class Tester { private static Set notes; /** <code>List</code> to hold events submitted. */ - private static List actualEvents = new ArrayList(); + private static List<String> actualEvents = new ArrayList<>(); /** <code>List</code> to hold events we expect. */ - private static List expectedEvents = new ArrayList(); + private static List<String> expectedEvents = new ArrayList<>(); static { setBASEDIR(new File(".")); @@ -103,8 +103,8 @@ public class Tester { /** XXX deprecated #clear() */ public static void clearEvents() { - actualEvents = new ArrayList(); - expectedEvents = new ArrayList(); + actualEvents = new ArrayList<>(); + expectedEvents = new ArrayList<>(); } @@ -707,10 +707,10 @@ public class Tester { } /** @return String[] of differences '{un}expected msg "..." {not} found' */ - private static String[] diffIgnoreDups(Collection set, String[] expected, String msg, + private static String[] diffIgnoreDups(Collection<String> set, String[] expected, String msg, boolean ignoreDups) { - ArrayList result = new ArrayList(); - ArrayList actual = new ArrayList(set); + ArrayList<String> result = new ArrayList<>(); + ArrayList<String> actual = new ArrayList<>(set); BitSet hits = new BitSet(); for (int i = 0; i < expected.length; i++) { if (!actual.remove(expected[i])) { @@ -722,8 +722,7 @@ public class Tester { } } } - for (Iterator iter = actual.iterator(); iter.hasNext();) { - String act = (String) iter.next(); + for (String act: actual) { result.add(" unexpected " + msg + " \"" + act + "\" found"); } return (String[]) result.toArray(new String[0]); diff --git a/testing-client/src/org/aspectj/testing/server/TestServer.java b/testing-client/src/org/aspectj/testing/server/TestServer.java index b7b0d762b..12e8d097e 100644 --- a/testing-client/src/org/aspectj/testing/server/TestServer.java +++ b/testing-client/src/org/aspectj/testing/server/TestServer.java @@ -32,7 +32,7 @@ public class TestServer implements Runnable { private boolean exitOnError = true; private File workingDirectory; private ClassLoader rootLoader; - private Map loaders = new HashMap(); + private Map<String,ClassLoader> loaders = new HashMap<>(); private String mainClass = "UnknownClass"; private String mainLoader = "UnknownLoader"; @@ -75,7 +75,7 @@ public class TestServer implements Runnable { if (parent == null) error("No such loader: " + parentName); } - List urlList = new ArrayList(); + List<URL> urlList = new ArrayList<>(); st = new StringTokenizer(classpath,";"); while (st.hasMoreTokens()) { String fileName = st.nextToken(); @@ -93,7 +93,7 @@ public class TestServer implements Runnable { } private void createRootLoader () throws IOException { - List urlList = new ArrayList(); + List<URL> urlList = new ArrayList(); /* Sandbox */ URL url = workingDirectory.getCanonicalFile().toURL(); diff --git a/testing-client/testsrc/org/aspectj/testing/TesterTest.java b/testing-client/testsrc/org/aspectj/testing/TesterTest.java index c2fceb81a..d538a63f7 100644 --- a/testing-client/testsrc/org/aspectj/testing/TesterTest.java +++ b/testing-client/testsrc/org/aspectj/testing/TesterTest.java @@ -167,8 +167,8 @@ public class TesterTest extends TestCase { * @author isberg */ public static class MyTestReporter implements IMessageHandler { - public ArrayList failures = new ArrayList(); - public ArrayList passes = new ArrayList(); + public ArrayList<IMessage> failures = new ArrayList<>(); + public ArrayList<IMessage> passes = new ArrayList<>(); public void clear() { failures.clear(); @@ -188,9 +188,8 @@ public class TesterTest extends TestCase { return gotItem(failures, substring); } - boolean gotItem(List list, String substring) { - for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { - IMessage element = (IMessage) iterator.next(); + boolean gotItem(List<IMessage> list, String substring) { + for (IMessage element: list) { String s = element.getMessage(); if ((null != s) && (-1 != s.indexOf(substring))) { return true; diff --git a/tests/bugs1810/502807/TestCollectors.java b/tests/bugs1810/502807/TestCollectors.java new file mode 100644 index 000000000..323fb76ce --- /dev/null +++ b/tests/bugs1810/502807/TestCollectors.java @@ -0,0 +1,36 @@ +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; + +public class TestCollectors { + Set<Integer> ids; + + public TestCollectors(Set<Inner> inners) { + ids = inners.stream().collect(Collectors.toList(Inner::getId)); +// ids = inners.stream().map(Inner::getId).collect(Collectors.toSet()); + } + + public static void main() { + Set<Inner> inners = new HashSet<>(); + inners.add(new Inner(1, "a")); + inners.add(new Inner(1, "a")); + + new TestCollectors(inners); + } + + + public static class Inner { + private int id; + private String name; + + public Inner(int id, String name) { + this.id = id; + this.name = name; + } + + public int getId() { return id; } + + public String getName() { return name; } + } +} + diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index c8a068c78..b368e77e0 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -4545,8 +4545,8 @@ </ajc-test> <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - M"> <compile files="GenericAspectM.aj" options="-1.5"> - <message kind="error" line="23" text="The method m0(Integer) in the type GenericAspect<A,B>.SimpleI<Integer> is not applicable for the arguments (String)"/> - <message kind="error" line="24" text="The method m1(List<Integer>) in the type GenericAspect<A,B>.SimpleI<Integer> is not applicable for the arguments (List<String>)"/> + <message kind="error" line="23" text="The method m0(Integer) in the type GenericAspect.SimpleI<Integer> is not applicable for the arguments (String)"/> + <message kind="error" line="24" text="The method m1(List<Integer>) in the type GenericAspect.SimpleI<Integer> is not applicable for the arguments (List<String>)"/> <message kind="error" line="25" text="Type mismatch: cannot convert from String to Integer"/> <message kind="error" line="26" text="Type mismatch: cannot convert from List<String> to List<Integer>"/> </compile> diff --git a/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java b/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java index 3af4bb79c..6122b1638 100644 --- a/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java @@ -30,6 +30,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Ajc1810Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testAIOOBE_502807() { + runTest("unexpected aioobe"); + } + public void testInvokeDynamic_490315() { runTest("indy"); } diff --git a/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml b/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml index e53b8aabe..065420da3 100644 --- a/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml +++ b/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml @@ -18,5 +18,11 @@ <ajc-test dir="bugs1810/ambig" title="ambiguous message - 17"> <compile options="-1.7" files="X.java"/> </ajc-test> + + <ajc-test dir="bugs1810/502807" title="unexpected aioobe"> + <compile options="-1.8" files="TestCollectors.java"> + <message kind="error" text="The method toList() in the type Collectors is not applicable for the arguments (Inner::getId)"/> + </compile> + </ajc-test> </suite> diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 869ed5819..0b02041ab 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -24,7 +24,6 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.Set; -import java.util.Stack; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Attribute; @@ -688,8 +687,7 @@ public final class LazyMethodGen implements Traceable { } } int ecounter = 0; - for (Iterator i = exnTable.iterator(); i.hasNext();) { - ExceptionRange er = (ExceptionRange) i.next(); + for (ExceptionRange er: exnTable) { String exceptionLabel = "E" + ecounter++; labelMap.put(Range.getRealStart(er.getHandler()), exceptionLabel); labelMap.put(er.getHandler(), exceptionLabel); diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java index 3148cbdaf..8e7f72f4f 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java @@ -22,6 +22,7 @@ import org.aspectj.apache.bcel.generic.InstructionFactory; import org.aspectj.apache.bcel.generic.InstructionHandle; import org.aspectj.apache.bcel.generic.InstructionList; import org.aspectj.apache.bcel.generic.Type; +import org.aspectj.weaver.Advice; import org.aspectj.weaver.AdviceKind; import org.aspectj.weaver.MemberImpl; import org.aspectj.weaver.ResolvedType; @@ -54,8 +55,7 @@ public class ArgsWeaveTestCase extends WeaveTestCase { } public void testLots() throws IOException { - List l = new ArrayList(); - + List<Advice> l = new ArrayList(); BcelAdvice p1 = makeArgsMunger("before"); @@ -70,7 +70,6 @@ public class ArgsWeaveTestCase extends WeaveTestCase { l.add(p2); l.add(p3); - weaveTest("HelloWorld", "ArgsBeforeAfterHelloWorld", addLexicalOrder(l)); } diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/MemberTestCase15.java b/weaver5/java5-testsrc/org/aspectj/weaver/MemberTestCase15.java index 7838c0696..f44095a0e 100644 --- a/weaver5/java5-testsrc/org/aspectj/weaver/MemberTestCase15.java +++ b/weaver5/java5-testsrc/org/aspectj/weaver/MemberTestCase15.java @@ -11,8 +11,6 @@ * ******************************************************************/ package org.aspectj.weaver; -import java.util.List; - import org.aspectj.weaver.bcel.BcelWorld; import junit.framework.TestCase; |