From de34df77ea7f7372894cf1e2352766118a798e98 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Mon, 7 Nov 2016 13:04:55 -0800 Subject: Upgraded to new JDT compiler - neon.1 and a bit --- .../internal/tools/ant/taskdefs/AntBuilder.java | 37 ++++++------- .../internal/tools/ant/taskdefs/Checklics.java | 12 ++--- .../tools/ant/taskdefs/ConditionalTask.java | 12 ++--- .../org/aspectj/internal/tools/build/Builder.java | 25 +++++---- .../org/aspectj/internal/tools/build/Module.java | 63 +++++++++++----------- .../org/aspectj/internal/tools/build/Modules.java | 2 +- .../org/aspectj/internal/tools/build/Result.java | 61 +++++++++++---------- .../internal/tools/build/SampleGatherer.java | 24 ++++----- 8 files changed, 117 insertions(+), 119 deletions(-) (limited to 'build/src') 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 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 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 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 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 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 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 toReturn = new ArrayList<>(); + for (Iterator 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 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 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 years, boolean hasLicense) { this.lastLine = lastLine; this.file = file; this.hasLicense = hasLicense; - List newYears = new ArrayList(); + List 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 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 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 ifs; + protected List ifs() { + return ifs != null ? ifs : (ifs = new Vector()); } 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 getFalses() { + Iterator iter = ifs().iterator(); + List 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 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 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 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 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 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 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 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 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 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 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 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 sourceFiles(File srcDir) { + ArrayList result = new ArrayList<>(); sourceFiles(srcDir, result); return result.iterator(); } - private static void sourceFiles(File srcDir, List result) { + private static void sourceFiles(File srcDir, List 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 source, List 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 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 libJars; - /** String list of classpath variables */ - private final List classpathVariables; + /** List of classpath variables */ + private final List 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 exportedLibJars; /** File list of source directories */ - private final List srcDirs; + private final List 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 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 iter = result.getSrcDirs().iterator(); iter.hasNext();) { + File srcDir = iter.next(); + for (Iterator 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 srcDirs(Result result) { myResult(result); return srcDirs; } - List libJars(Result result) { + + List libJars(Result result) { myResult(result); return libJars; } - List classpathVariables(Result result) { + + List classpathVariables(Result result) { myResult(result); return classpathVariables; } - List exportedLibJars(Result result) { + + List exportedLibJars(Result result) { myResult(result); return exportedLibJars; } - List requiredModules(Result result) { + + List 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 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 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 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 requiredResults; - /** File list of library jars */ - private final List libJars; + /** List of library jars */ + private final List libJars; - /** String list of classpath variables */ - private final List classpathVariables; + /** List of classpath variables */ + private final List 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 exportedLibJars; - /** File list of source directories */ - private final List srcDirs; + /** List of source directories */ + private final List 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 findJarRequirements() { + ArrayList result = new ArrayList<>(); Module.doFindJarRequirements(this, result); return result; } /** @return unmodifiable List of String classpath variables */ - public List getClasspathVariables() { + public List 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 getExportedLibJars() { return safeList(exportedLibJars); } /** * @return unmodifiable list of required library files, guaranteed readable */ - public List getLibJars() { + public List 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 getSrcDirs() { return safeList(srcDirs); } @@ -283,12 +283,12 @@ public class Result { return name; } - private List safeList(List l) { + private List safeList(List l) { requiredDone(); return Collections.unmodifiableList(l); } - private Result[] safeResults(List list) { + private Result[] safeResults(List 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 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 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 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 NAME_SOURCE_COMPARER = new Comparator() { + 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 AUTHOR_NAME_SOURCE_COMPARER = new Comparator() { + 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 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 getSortedSamples() { return getSortedSamples(Sample.NAME_SOURCE_COMPARER); } - List getSortedSamples(Comparator comparer) { - ArrayList result = new ArrayList(); + List getSortedSamples(Comparator comparer) { + ArrayList 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 result = new ArrayList<>(); int start = 0; int loc = anchorName.indexOf("-", start); String next; -- cgit v1.2.3