@@ -0,0 +1 @@ | |||
@@ -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; |
@@ -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; | |||
} |
@@ -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(); |
@@ -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 |
@@ -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()) { |
@@ -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; |
@@ -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)); |
@@ -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; |
@@ -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]; |
@@ -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 |
@@ -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); |
@@ -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... |
@@ -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; | |||
} | |||
@@ -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; |
@@ -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) { |
@@ -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( |
@@ -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)); |
@@ -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; | |||
} | |||
} |
@@ -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 |
@@ -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); | |||
@@ -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)); |
@@ -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); |
@@ -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]); |
@@ -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(); |
@@ -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; |
@@ -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; } | |||
} | |||
} | |||
@@ -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> |
@@ -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"); | |||
} |
@@ -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> |
@@ -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); |
@@ -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)); | |||
} | |||
@@ -11,8 +11,6 @@ | |||
* ******************************************************************/ | |||
package org.aspectj.weaver; | |||
import java.util.List; | |||
import org.aspectj.weaver.bcel.BcelWorld; | |||
import junit.framework.TestCase; |