diff options
author | Andy Clement <aclement@pivotal.io> | 2022-02-25 13:29:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-25 13:29:01 -0800 |
commit | 102e0617a4bbcf0bd232b4f64995161db8681099 (patch) | |
tree | 1977f36bb9e816fb630456f4a396a6e87732560e | |
parent | 7405690d0d8ab63bc45cc1fc79ad9141b5a0ddc1 (diff) | |
parent | a66d6da148455ba8485a2272b4efcb83092735d6 (diff) | |
download | aspectj-102e0617a4bbcf0bd232b4f64995161db8681099.tar.gz aspectj-102e0617a4bbcf0bd232b4f64995161db8681099.zip |
Merge pull request #114 from turbanoff/use_generics_in_taskdefs_module
Update 'taskdefs' code to use generics
6 files changed, 27 insertions, 27 deletions
diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc10.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc10.java index b4eb1f020..77fd59d2f 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc10.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc10.java @@ -63,7 +63,7 @@ public class Ajc10 extends MatchingTask { private Path bootclasspath; private Path extdirs; private Path srcdir; - private List argfiles; + private List<File> argfiles; private boolean fork; private boolean failonerror; private boolean verbose; @@ -197,7 +197,7 @@ public class Ajc10 extends MatchingTask { public void setArgfile(File argfile) { // ajc-only eajc-also docDone if (argfiles == null) { - argfiles = new Vector(); + argfiles = new Vector<>(); } argfiles.add(argfile); } @@ -205,7 +205,7 @@ public class Ajc10 extends MatchingTask { public void setArgfiles(String argfiles) { // ajc-only eajc-also docDone StringTokenizer tok = new StringTokenizer(argfiles, ", ", false); if (tok.hasMoreTokens() && this.argfiles == null) { - this.argfiles = new Vector(); + this.argfiles = new Vector<>(); } while (tok.hasMoreTokens()) { this.argfiles.add(project.resolveFile(tok.nextToken().trim())); diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java index d89fee5f5..368417f3f 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapter.java @@ -63,8 +63,8 @@ public class Ajc11CompilerAdapter implements CompilerAdapter { public static final String CLEAN = "build.compiler.clean"; /** track whether we re-called <code>javac.execute()</code> */ - private static final ThreadLocal inSelfCall = new ThreadLocal() { - public Object initialValue() { + private static final ThreadLocal<Boolean> inSelfCall = new ThreadLocal<Boolean>() { + public Boolean initialValue() { return Boolean.FALSE; } }; diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java index 7755718dd..87f2f4423 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajc2.java @@ -75,7 +75,7 @@ public class Ajc2 extends Javac { * The file is a line-delimited list of arguments * these arguments are inserted into the argument list */ - private List argfiles; + private List<Argfile> argfiles; /* ---------------------------------------------------------------------- @@ -239,7 +239,7 @@ public class Ajc2 extends Javac { public Argfile createArgfile() { Argfile argfile = new Argfile(); if (argfiles == null) { - argfiles = new ArrayList(); + argfiles = new ArrayList<>(); } argfiles.add(argfile); return argfile; @@ -408,11 +408,11 @@ public class Ajc2 extends Javac { * @see org.apache.tools.ant.taskdefs.Javac#scanDir */ protected void scanDir(File srcDir, File destDir, String files[]) { - List newFiles = new ArrayList(); + List<File> newFiles = new ArrayList<>(); // Add the files listed in the argfiles to the includes - List newIncludes = new ArrayList(); - List newArguments = new ArrayList(); + List<File> newIncludes = new ArrayList<>(); + List<String> newArguments = new ArrayList<>(); if (argfiles != null) { for (Object o : argfiles) { File argfile = ((Argfile) o).getFile(); @@ -457,7 +457,7 @@ public class Ajc2 extends Javac { } } - private void expandArgfile(File argfile, List includes, List arguments) { + private void expandArgfile(File argfile, List<File> includes, List<String> arguments) { log("argfile:" + argfile, Project.MSG_VERBOSE); diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java index c0c50ed99..aa9bd33a4 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java @@ -233,20 +233,20 @@ public class AjcTask extends MatchingTask { private static final String USAGE_SUBSTRING = "AspectJ-specific options"; /** valid -X[...] options other than -Xlint variants */ - private static final List VALID_XOPTIONS; + private static final List<String> VALID_XOPTIONS; /** valid warning (-warn:[...]) variants */ - private static final List VALID_WARNINGS; + private static final List<String> VALID_WARNINGS; /** valid debugging (-g:[...]) variants */ - private static final List VALID_DEBUG; + private static final List<String> VALID_DEBUG; /** * -Xlint variants (error, warning, ignore) * * @see org.aspectj.weaver.Lint */ - private static final List VALID_XLINT; + private static final List<String> VALID_XLINT; public static final String COMMAND_EDITOR_NAME = AjcTask.class.getName() + ".COMMAND_EDITOR"; @@ -286,7 +286,7 @@ public class AjcTask extends MatchingTask { String editorClassName = System.getProperty(COMMAND_EDITOR_NAME); if (null != editorClassName) { ClassLoader cl = AjcTask.class.getClassLoader(); - Class editorClass = cl.loadClass(editorClassName); + Class<?> editorClass = cl.loadClass(editorClassName); editor = (ICommandEditor) editorClass.getDeclaredConstructor().newInstance(); } } catch (Throwable t) { @@ -318,7 +318,7 @@ public class AjcTask extends MatchingTask { private Path aspectpath; private Path argfiles; private Path inxmlfiles; - private List ignored; + private List<String> ignored; private Path sourceRoots; private File xweaveDir; private String xdoneSignal; @@ -326,7 +326,7 @@ public class AjcTask extends MatchingTask { private List<CompilerArg> compilerArgs; // ----- added by adapter - integrate better? - private List /* File */adapterFiles; + private List<File> adapterFiles; private String[] adapterArguments; private IMessageHolder messageHolder; @@ -388,7 +388,7 @@ public class AjcTask extends MatchingTask { public void reset() { // XXX possible to reset MatchingTask? // need declare for "all fields initialized in ..." adapterArguments = null; - adapterFiles = new ArrayList(); + adapterFiles = new ArrayList<>(); compilerArgs = null; argfiles = null; inxmlfiles = null; @@ -407,7 +407,7 @@ public class AjcTask extends MatchingTask { forkclasspath = null; inIncrementalMode = false; inIncrementalFileMode = false; - ignored = new ArrayList(); + ignored = new ArrayList<>(); injars = null; inpath = null; listFileArgs = false; @@ -864,7 +864,7 @@ public class AjcTask extends MatchingTask { */ public void setMessageHolderClass(String className) { try { - Class mclass = Class.forName(className); + Class<?> mclass = Class.forName(className); IMessageHolder holder = (IMessageHolder) mclass.getDeclaredConstructor().newInstance(); setMessageHolder(holder); } catch (Throwable t) { @@ -888,7 +888,7 @@ public class AjcTask extends MatchingTask { */ public void setCommandEditorClass(String className) { // skip Ant interface? try { - Class mclass = Class.forName(className); + Class<?> mclass = Class.forName(className); setCommandEditor((ICommandEditor) mclass.getDeclaredConstructor().newInstance()); } catch (Throwable t) { String m = "unable to instantiate command editor: " + className; @@ -1178,7 +1178,7 @@ public class AjcTask extends MatchingTask { outjarFixedup = true; } - ArrayList result = new ArrayList(cmd.extractArguments()); + ArrayList<String> result = new ArrayList(cmd.extractArguments()); addListArgs(result); String[] command = (String[]) result.toArray(new String[0]); @@ -2032,7 +2032,7 @@ public class AjcTask extends MatchingTask { // } List extractArguments() { - List result = new ArrayList(); + List<String> result = new ArrayList<>(); String[] cmds = command.getArguments(); if (!LangUtil.isEmpty(cmds)) { result.addAll(Arrays.asList(cmds)); diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java index e58db40f2..1cb525d5f 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java @@ -155,7 +155,7 @@ public class Ajdoc extends MatchingTask { public void setSourcefiles(String list) { (sourcefiles == null ? - sourcefiles = new ArrayList() : + sourcefiles = new ArrayList<>() : sourcefiles).addAll(strings(list)); } diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java index e64080968..5af7b7f42 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/compilers/Ajc.java @@ -81,7 +81,7 @@ public class Ajc extends DefaultCompilerAdapter { PrintStream err = System.err; PrintStream out = System.out; try { - Class main = Class.forName(MAIN_CLASS_NAME); + Class<?> main = Class.forName(MAIN_CLASS_NAME); if (main == null) { throw new ClassNotFoundException(MAIN_CLASS_NAME); } @@ -122,7 +122,7 @@ public class Ajc extends DefaultCompilerAdapter { private String[] removeUnsupported(Commandline cline, PrintStream log) { if (null == log) log = System.err; String[] args = cline.getCommandline(); - List argsList = new ArrayList(); + List<String> argsList = new ArrayList<>(); for (int i = 0; i < args.length; i++) { String arg = args[i]; if (javacOnlyFlags.contains(arg)) { |