diff options
author | Andy Clement <aclement@pivotal.io> | 2020-08-16 11:31:18 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2020-08-16 11:31:18 -0700 |
commit | e0adab7d8f01c38ef2650a9f726be4ac853ee721 (patch) | |
tree | de4823c0fe628530c2867e476718830a85fa8b26 | |
parent | 4a2ecf60ebaa4a5ad097da45ef912e1af3cd0dce (diff) | |
download | aspectj-e0adab7d8f01c38ef2650a9f726be4ac853ee721.tar.gz aspectj-e0adab7d8f01c38ef2650a9f726be4ac853ee721.zip |
polish
15 files changed, 268 insertions, 253 deletions
diff --git a/asm/src/test/java/org/aspectj/asm/AsmModuleTests.java b/asm/src/test/java/org/aspectj/asm/AsmModuleTests.java index 834ada306..96a384366 100644 --- a/asm/src/test/java/org/aspectj/asm/AsmModuleTests.java +++ b/asm/src/test/java/org/aspectj/asm/AsmModuleTests.java @@ -13,11 +13,8 @@ package org.aspectj.asm; * ******************************************************************/ -// default package - -import org.aspectj.asm.NameConvertorTest; - -import junit.framework.*; +import junit.framework.TestCase; +import junit.framework.TestSuite; public class AsmModuleTests extends TestCase { diff --git a/asm/src/test/java/org/aspectj/asm/NameConvertorTest.java b/asm/src/test/java/org/aspectj/asm/NameConvertorTest.java index 22ac3fb79..f52d4f045 100644 --- a/asm/src/test/java/org/aspectj/asm/NameConvertorTest.java +++ b/asm/src/test/java/org/aspectj/asm/NameConvertorTest.java @@ -10,11 +10,11 @@ *******************************************************************/ package org.aspectj.asm; -import junit.framework.TestCase; - import org.aspectj.asm.internal.CharOperation; import org.aspectj.asm.internal.NameConvertor; +import junit.framework.TestCase; + public class NameConvertorTest extends TestCase { public void testBoolean() { diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java index 014ad558d..a1a7a57de 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java @@ -60,7 +60,13 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import java.util.StringTokenizer; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java index 03c7c716b..9bc67c9fd 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java @@ -61,7 +61,6 @@ import java.security.MessageDigest; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Comparator; import java.util.List; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java index 7938218bc..690c9f600 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java @@ -58,7 +58,11 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.Serializable; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Set; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Constant; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java index 453fe7c1f..6bc66480f 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java @@ -53,8 +53,11 @@ package org.aspectj.apache.bcel.generic; * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ - -import java.util.*; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Stack; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Attribute; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java index 4f18bd70f..be9aa0b45 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java @@ -70,7 +70,6 @@ import java.util.WeakHashMap; import org.aspectj.apache.bcel.classfile.ClassParser; import org.aspectj.apache.bcel.classfile.JavaClass; -import org.aspectj.apache.bcel.util.ClassLoaderRepository.SoftHashMap.SpecialValue; /** * The repository maintains information about which classes have been loaded. diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java index 678abb1dc..c39d2195b 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java @@ -69,7 +69,12 @@ import java.nio.file.Path; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.BasicFileAttributes; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonPointcutExpressionTests.java b/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonPointcutExpressionTests.java index 02ad20f1f..748de7ce5 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonPointcutExpressionTests.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/matcher/tools/CommonPointcutExpressionTests.java @@ -1,17 +1,15 @@ /******************************************************************************* * Copyright (c) 2008 Contributors - * All rights reserved. This program and the accompanying materials + * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Andy Clement *******************************************************************************/ package org.aspectj.matcher.tools; -import junit.framework.TestCase; - import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; @@ -20,13 +18,15 @@ import org.aspectj.weaver.tools.ShadowMatch; import org.aspectj.weaver.tools.StandardPointcutExpression; import org.aspectj.weaver.tools.StandardPointcutParser; +import junit.framework.TestCase; + /** * Test the use of the pointcut parser and matching infrastructure. The org.aspectj.matcher.tools infrastructure used should not be * aware of what kind of World it is working with and only operate in terms of the type abstraction expressed in the * org.aspectj.matcher project (so Members, etc). These tests only use base java types, there is no other testdata. - * + * * This is based on the Reflection oriented PointcutExpressionTest in the weaver project. - * + * * @author Andy Clement */ public abstract class CommonPointcutExpressionTests extends TestCase { @@ -739,7 +739,6 @@ public abstract class CommonPointcutExpressionTests extends TestCase { private ResolvedMember getMethod(ResolvedType type, String methodName, String methodSignature) { ResolvedMember[] methods = type.getDeclaredMethods(); for (ResolvedMember method : methods) { - System.out.println(method.getName() + method.getSignature()); if (method.getName().equals(methodName) && (methodSignature == null || methodSignature.equals(method.getSignature()))) { return method; diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/IncCompilerRun.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/IncCompilerRun.java index e3bbb9209..8ec74ea0b 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/IncCompilerRun.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/IncCompilerRun.java @@ -1,14 +1,14 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; @@ -28,6 +28,8 @@ import org.aspectj.testing.run.IRunStatus; import org.aspectj.testing.run.WrappedRunIterator; import org.aspectj.testing.util.StructureModelUtil; import org.aspectj.testing.util.StructureModelUtil.ModelIncorrectException; +import org.aspectj.testing.xml.AjcSpecXmlReader; +import org.aspectj.testing.xml.IXmlWritable; import org.aspectj.testing.xml.SoftMessage; import org.aspectj.testing.xml.XMLWriter; import org.aspectj.util.FileUtil; @@ -39,11 +41,11 @@ import org.aspectj.util.LangUtil; * The staging directory is updated by prefix/suffix rules applied * to files found below Sandbox.testBaseSrcDir. * Files with suffix .{tag}.java are owned by this run - * and are copied to the staging directory + * and are copied to the staging directory * unless they are prefixed "delete.", in which case the * corresponding file is deleted. Any "owned" file is passed to * the compiler as the list of changed files. - * The files entry contains the expected files recompiled. XXX underinclusive + * The files entry contains the expected files recompiled. XXX underinclusive * XXX prefer messages for expected files? * XXX later: also support specified paths, etc. */ @@ -51,7 +53,7 @@ public class IncCompilerRun implements IAjcRun { final Spec spec; // nonfinal later to make re-runnable Sandbox sandbox; - + /** * @param handler must not be null, but may be reused in the same thread */ @@ -60,7 +62,7 @@ public class IncCompilerRun implements IAjcRun { this.spec = spec; } - /** + /** * Initialize this from the sandbox, using compiler and changedFiles. * @param sandbox the Sandbox setup for this test, including copying * any changed files, etc. @@ -85,14 +87,14 @@ public class IncCompilerRun implements IAjcRun { this.sandbox = sandbox; return doStaging(validator); } - - /** + + /** * Handle copying and deleting of files per tag. - * This returns false unless + * This returns false unless * (1) tag is "same", or * (2) some file was copied or deleted successfully * and there were no failures copying or deleting files. - * @return true if staging completed successfully + * @return true if staging completed successfully */ boolean doStaging(final Validator validator) { if ("same".equals(spec.tag)) { @@ -106,7 +108,7 @@ public class IncCompilerRun implements IAjcRun { // deleting any with ChangedFilesCollector.DELETE_SUFFIX // sigh - delay until after last last-mod-time intHolder holder = new intHolder(); - List copied = new ArrayList(); + List<File> copied = new ArrayList<>(); doStaging(validator,".java",holder,copied); doStaging(validator,".jar",holder,copied); doStaging(validator,".class",holder,copied); @@ -118,7 +120,7 @@ public class IncCompilerRun implements IAjcRun { result = (0 == holder.numFails); } if (0 < copied.size()) { - File[] files = (File[]) copied.toArray(new File[0]); + File[] files = copied.toArray(new File[0]); FileUtil.sleepPastFinalModifiedTime(files); } } catch (NullPointerException npe) { @@ -129,8 +131,8 @@ public class IncCompilerRun implements IAjcRun { return result; } - - private void doStaging(final Validator validator, final String toSuffix, + + private void doStaging(final Validator validator, final String toSuffix, final intHolder holder,final List copied) throws IOException { @@ -165,7 +167,7 @@ public class IncCompilerRun implements IAjcRun { File destDir = sandbox.stagingDir; FileUtil.copyDir(srcDir, destDir, fromSuffix, toSuffix, deleteOrCount); } - + private static class intHolder { int numCopies; int numDeletes; @@ -181,7 +183,7 @@ public class IncCompilerRun implements IAjcRun { if (null == compiler) { MessageUtil.abort(status, "null compiler"); } - + // // This is a list of expected classes (in File-normal form // // relative to base class/src dir, without .class suffix // // -- like "org/aspectj/tools/ajc/Main") @@ -192,12 +194,12 @@ public class IncCompilerRun implements IAjcRun { // } // // // now add any (additional) expected-class entries listed in the spec -// // normalize to a similar file path (and do info messages for redundancies). +// // normalize to a similar file path (and do info messages for redundancies). // // List alsoChanged = spec.getPathsAsFile(sandbox.stagingDir); // for (Iterator iter = alsoChanged.iterator(); iter.hasNext();) { // File f = (File) iter.next(); -// +// // if (expectedClasses.contains(f)) { // // XXX remove old comment changed.contains() works b/c getPathsAsFile producing both File // // normalizes the paths, and File.equals(..) compares these lexically @@ -205,20 +207,20 @@ public class IncCompilerRun implements IAjcRun { // MessageUtil.info(status, s + f); // } else { // expectedClasses.add(f); -// } +// } // } -// +// // // now can create handler, use it for reporting // List errors = spec.getMessages(IMessage.ERROR); // List warnings = spec.getMessages(IMessage.WARNING); // AjcMessageHandler handler = new AjcMessageHandler(errors, warnings, expectedClasses); - - // same DirChanges handling for JavaRun, CompilerRun, IncCompilerRun + + // same DirChanges handling for JavaRun, CompilerRun, IncCompilerRun // XXX around advice or template method/class DirChanges dirChanges = null; if (!LangUtil.isEmpty(spec.dirChanges)) { LangUtil.throwIaxIfFalse(1 == spec.dirChanges.size(), "expecting only 1 dirChanges"); - dirChanges = new DirChanges((DirChanges.Spec) spec.dirChanges.get(0)); + dirChanges = new DirChanges(spec.dirChanges.get(0)); if (!dirChanges.start(status, sandbox.classesDir)) { return false; // setup failed } @@ -251,9 +253,9 @@ public class IncCompilerRun implements IAjcRun { } else { result = (commandResult == handler.expectingCommandTrue()); if (! result) { - String m = commandResult + String m = commandResult ? "incremental compile command did not return false as expected" - : "incremental compile command returned false unexpectedly"; + : "incremental compile command returned false unexpectedly"; MessageUtil.fail(status, m); } else if (null != dirChanges) { result = dirChanges.end(status, sandbox.testBaseDir); @@ -270,9 +272,9 @@ public class IncCompilerRun implements IAjcRun { } // XXX weak - actual messages not reported in real-time, no fast-fail if (report) { - handler.report(status); + handler.report(status); } - } + } return result; } @@ -282,45 +284,45 @@ public class IncCompilerRun implements IAjcRun { public String toString() { - return "" + spec; + return "" + spec; // return "IncCompilerRun(" + spec + ")"; // XXX } - /** + /** * initializer/factory for IncCompilerRun. */ public static class Spec extends AbstractRunSpec { public static final String XMLNAME = "inc-compile"; protected boolean fresh; - protected ArrayList classesAdded; - protected ArrayList classesRemoved; - protected ArrayList classesUpdated; - + protected ArrayList<String> classesAdded; + protected ArrayList<String> classesRemoved; + protected ArrayList<String> classesUpdated; + protected String checkModel; /** - * skip description, skip sourceLocation, + * skip description, skip sourceLocation, * do keywords, skip options, do paths as classes, do comment, * skip staging (always true), skip badInput (irrelevant) - * do dirChanges, do messages but skip children. + * do dirChanges, do messages but skip children. */ // private static final XMLNames NAMES = new XMLNames(XMLNames.DEFAULT, // "", "", null, "", "classes", null, "", "", false, false, true); -// +// /** identifies files this run owns, so {name}.{tag}.java maps to {name}.java */ String tag; public Spec() { super(XMLNAME); setStaging(true); - classesAdded = new ArrayList(); - classesRemoved = new ArrayList(); - classesUpdated = new ArrayList(); + classesAdded = new ArrayList<>(); + classesRemoved = new ArrayList<>(); + classesUpdated = new ArrayList<>(); checkModel=""; } - - protected void initClone(Spec spec) + + protected void initClone(Spec spec) throws CloneNotSupportedException { super.initClone(spec); spec.fresh = fresh; @@ -332,30 +334,30 @@ public class IncCompilerRun implements IAjcRun { spec.classesUpdated.clear(); spec.classesUpdated.addAll(classesUpdated); } - + public Object clone() throws CloneNotSupportedException { Spec result = new Spec(); initClone(result); - return result; + return result; } public void setFresh(boolean fresh) { this.fresh = fresh; } - + public void setTag(String input) { tag = input; } - + public void setCheckModel(String thingsToCheck) { this.checkModel=thingsToCheck; } - + public String toString() { return "IncCompile.Spec(" + tag + ", " + super.toString() + ",["+checkModel+"])"; } - + /** override to set dirToken to Sandbox.CLASSES and default suffix to ".class" */ public void addDirChanges(DirChanges.Spec spec) { // XXX copy/paste of CompilerRun.Spec... if (null == spec) { @@ -365,7 +367,7 @@ public class IncCompilerRun implements IAjcRun { spec.setDefaultSuffix(".class"); super.addDirChanges(spec); } - + /** @return a IncCompilerRun with this as spec if setup completes successfully. */ public IRunIterator makeRunIterator(Sandbox sandbox, Validator validator) { IncCompilerRun run = new IncCompilerRun(this); @@ -375,12 +377,12 @@ public class IncCompilerRun implements IAjcRun { } return null; } - - /** + + /** * Write this out as a compile element as defined in * AjcSpecXmlReader.DOCTYPE. - * @see AjcSpecXmlReader#DOCTYPE - * @see IXmlWritable#writeXml(XMLWriter) + * @see AjcSpecXmlReader#DOCTYPE + * @see IXmlWritable#writeXml(XMLWriter) */ public void writeXml(XMLWriter out) { String attr = XMLWriter.makeAttribute("tag", tag); @@ -396,20 +398,20 @@ public class IncCompilerRun implements IAjcRun { SoftMessage.writeXml(out, getMessages()); out.endElement(xmlElementName); } - + public void setClassesAdded(String items) { addItems(classesAdded, items); } - + public void setClassesUpdated(String items) { addItems(classesUpdated, items); } - + public void setClassesRemoved(String items) { addItems(classesRemoved, items); } - - private void addItems(List list, String items) { + + private void addItems(List<String> list, String items) { if (null != items) { String[] classes = XMLWriter.unflattenList(items); if (!LangUtil.isEmpty(classes)) { @@ -419,13 +421,13 @@ public class IncCompilerRun implements IAjcRun { } } } - } + } } } // class IncCompilerRun.Spec } // // XXX replaced with method-local class - revisit if useful -// -// /** +// +// /** // * This class collects the list of all changed files and // * deletes the corresponding file for those prefixed "delete." // */ @@ -436,7 +438,7 @@ public class IncCompilerRun implements IAjcRun { // final Validator validator; // /** need this to generate paths by clipping */ // final File destDir; -// +// // /** @param changed the sink for all files changed (full paths) */ // public ChangedFilesCollector(ArrayList changed, File destDir, Validator validator) { // LangUtil.throwIaxIfNull(validator, "ChangedFilesCollector - handler"); @@ -446,11 +448,11 @@ public class IncCompilerRun implements IAjcRun { // } // // /** -// * This converts the input File to normal String path form +// * This converts the input File to normal String path form // * (without any source suffix) and adds it to the list changed. // * If the name of the file is suffixed ".delete..", then -// * delete the corresponding file, and return false (no copy). -// * Return true otherwise (copy file). +// * delete the corresponding file, and return false (no copy). +// * Return true otherwise (copy file). // * @see java.io.FileFilter#accept(File) // */ // public boolean accept(File file) { @@ -484,9 +486,9 @@ public class IncCompilerRun implements IAjcRun { // } else { // int loc = name.lastIndexOf(path); // if (-1 == loc) { // sigh -// +// // } else { -// +// // } // } // } diff --git a/testing/src/test/java/org/aspectj/testing/util/Diffs.java b/testing/src/test/java/org/aspectj/testing/util/Diffs.java index 43739b752..acefa78c8 100644 --- a/testing/src/test/java/org/aspectj/testing/util/Diffs.java +++ b/testing/src/test/java/org/aspectj/testing/util/Diffs.java @@ -1,14 +1,14 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -26,11 +26,12 @@ import org.aspectj.bridge.IMessage; import org.aspectj.bridge.IMessageHandler; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.MessageUtil; +import org.aspectj.testing.util.TestDiffs.TestResult; import org.aspectj.util.FileUtil; import org.aspectj.util.LangUtil; -/** - * Result struct for expected/actual diffs for Collection +/** + * Result struct for expected/actual diffs for Collection */ public class Diffs { @@ -76,8 +77,8 @@ public class Diffs { * @throws NullPointerException if anything is null */ public int compare(IMessage lhs, IMessage rhs) { - IMessage lm = (IMessage) lhs; - IMessage rm = (IMessage) rhs; + IMessage lm = lhs; + IMessage rm = rhs; ISourceLocation ls = (lm == null ? null : lm.getSourceLocation()); ISourceLocation rs = (rm == null ? null : rm.getSourceLocation()); int left = (ls == null ? -1 : ls.getLine()); @@ -94,8 +95,8 @@ public class Diffs { return true; } }; - // // XXX List -> Collection b/c comparator orders - // public static final Diffs NONE + // // XXX List -> Collection b/c comparator orders + // public static final Diffs NONE // = new Diffs("NONE", Collections.EMPTY_LIST, Collections.EMPTY_LIST); public static Diffs makeDiffs( @@ -118,7 +119,7 @@ public class Diffs { IMessage[] actual) { return makeDiffs(label, expected, actual, null, null); } - + private static int getLine(ISourceLocation loc) { int result = -1; if (null != loc) { @@ -148,11 +149,11 @@ public class Diffs { IMessage[] actual, IMessage.Kind[] ignoreExpectedKinds, IMessage.Kind[] ignoreActualKinds) { - List exp = getExcept(expected, ignoreExpectedKinds); - List act = getExcept(actual, ignoreActualKinds); + List<IMessage> exp = getExcept(expected, ignoreExpectedKinds); + List<IMessage> act = getExcept(actual, ignoreActualKinds); - ArrayList missing = new ArrayList(); - List unexpected = new ArrayList(); + List<IMessage> missing = new ArrayList<>(); + List<IMessage> unexpected = new ArrayList<>(); if (LangUtil.isEmpty(expected)) { unexpected.addAll(act); @@ -206,7 +207,7 @@ public class Diffs { unexpected.add(actualMessage); } } - // missing: all expected results not found + // missing: all expected results not found exp.removeAll(expectedFound); missing.addAll(exp); } @@ -266,7 +267,7 @@ public class Diffs { // if (LangUtil.isEmpty(kinds)) { // return sink.length; // } else if (LangUtil.isEmpty(sink)) { - // return 0; + // return 0; // } // int from = -1; // int to = -1; @@ -337,7 +338,7 @@ public class Diffs { * extraSourceLocation[] * if any are defined in expected, then there * must be exactly the actual elements as are - * defined in expected (so it is an error to + * defined in expected (so it is an error to * not define all if you define any) * <pre> * @param expected @@ -366,11 +367,11 @@ public class Diffs { return false; } ISourceLocation[] esl = - (ISourceLocation[]) expected.getExtraSourceLocations().toArray( - new ISourceLocation[0]); + expected.getExtraSourceLocations().toArray( + new ISourceLocation[0]); ISourceLocation[] asl = - (ISourceLocation[]) actual.getExtraSourceLocations().toArray( - new ISourceLocation[0]); + actual.getExtraSourceLocations().toArray( + new ISourceLocation[0]); Arrays.sort(esl, SORT_SOURCELOC); Arrays.sort(asl, SORT_SOURCELOC); @@ -385,7 +386,7 @@ public class Diffs { * (i.e., it ignored any extra source locations if no expectations stated). * XXX need const like NO_FILE. * @param expected the sorted ISourceLocation[] expected - * @param expected the actual sorted ISourceLocation[] + * @param expected the actual sorted ISourceLocation[] * @return true if any expected element is expected by the corresponding actual element. */ static boolean expectingSourceLocations( @@ -442,10 +443,10 @@ public class Diffs { } } - private static ArrayList getExcept( + private static List<IMessage> getExcept( IMessage[] source, IMessage.Kind[] skip) { - ArrayList<IMessage> sink = new ArrayList<>(); + List<IMessage> sink = new ArrayList<>(); if (LangUtil.isEmpty(source)) { return sink; } @@ -482,10 +483,10 @@ public class Diffs { public final String label; /** immutable List */ - public final List missing; + public final List<TestResult> missing; /** immutable List */ - public final List unexpected; + public final List<TestResult> unexpected; /** true if there are any missing or unexpected */ public final boolean different; @@ -505,11 +506,11 @@ public class Diffs { ((0 != this.missing.size()) || (0 != this.unexpected.size())); } - /** + /** * Report missing and extra items to handler. - * For each item in missing or unexpected, this creates a {kind} IMessage with + * For each item in missing or unexpected, this creates a {kind} IMessage with * the text "{missing|unexpected} {label}: {message}" - * where {message} is the result of + * where {message} is the result of * <code>MessageUtil.renderMessage(IMessage)</code>. * @param handler where the messages go - not null * @param kind the kind of message to construct - not null @@ -540,7 +541,7 @@ public class Diffs { + missing.size() + ")"; } - public static interface Filter { + public interface Filter { /** @return true to keep input in list of messages */ boolean accept(Object input); } diff --git a/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java b/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java index ca1aa72ed..bdb66dc08 100644 --- a/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java +++ b/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java @@ -1,14 +1,14 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -27,7 +27,7 @@ import java.util.ListIterator; import org.aspectj.util.LangUtil; /** - * Calculated differences between two test runs + * Calculated differences between two test runs * based on their output files * assuming that tests are logged with prefix [PASS|FAIL] * (as they are when using <tt>-traceTestsMin</tt> with the Harness). @@ -51,7 +51,7 @@ public class TestDiffs { // XXX pretty dumb implementation print(System.out, result.missing, "missing"); print(System.out, result.fixed, "fixed"); print(System.out, result.broken, "broken"); - + System.out.println("## Summary"); System.out.println(" # expected " + result.expected.size() + " tests: " + args[0] ); System.out.println(" # actual " + result.actual.size() + " tests: " + args[1]); @@ -64,42 +64,42 @@ public class TestDiffs { // XXX pretty dumb implementation append(sb, result.stillFailing, " still failing"); System.out.println(" # diffs: " + sb); } - + /** * @param expected the expected/old File results with Harness -traceTestsMin lines * @param actual the actual/new File results with Harness -traceTestsMin lines * @return TestDiffs null if error, valid otherwise */ public static TestDiffs compareResults(File expected, File actual) { - ArrayList exp = null; - ArrayList act = null; + List<TestResult> exp = null; + List<TestResult> act = null; File reading = expected; try { exp = TestDiffs.readTestResults(expected, expected.getPath()); reading = actual; act = TestDiffs.readTestResults(actual, actual.getPath()); - + Diffs tests = Diffs.makeDiffs("tests", exp, act, TestResult.BY_NAME); // remove missing/unexpected (removed, added) tests from results // otherwise, unexpected-[pass|fail] look like [fixes|broken] - List expResults = trimByName(exp, tests.missing); - List actResults = trimByName(act, tests.unexpected); - + List<TestResult> expResults = trimByName(exp, tests.missing); + List<TestResult> actResults = trimByName(act, tests.unexpected); + Diffs results = Diffs.makeDiffs("results", expResults, actResults, TestResult.BY_PASSNAME); // broken tests show up in results as unexpected-fail or missing-pass // fixed tests show up in results as unexpected-pass or missing-fail - ArrayList broken = new ArrayList(); - ArrayList fixed = new ArrayList(); + ArrayList<TestResult> broken = new ArrayList<TestResult>(); + ArrayList<TestResult> fixed = new ArrayList<TestResult>(); split(results.unexpected, fixed, broken); return new TestDiffs( exp, act, - tests.missing, - tests.unexpected, - broken, - fixed); + tests.missing, + tests.unexpected, + broken, + fixed); } catch (IOException e) { System.err.println("error reading " + reading); e.printStackTrace(System.err); // XXX @@ -107,7 +107,7 @@ public class TestDiffs { // XXX pretty dumb implementation } } - private static void append(StringBuffer sb, List list, String label) { + private static void append(StringBuffer sb, List<TestResult> list, String label) { if (!LangUtil.isEmpty(list)) { if (0 < sb.length()) { sb.append(" "); @@ -115,8 +115,8 @@ public class TestDiffs { // XXX pretty dumb implementation sb.append(list.size() + label); } } - - private static void print(PrintStream out, List list, String label) { + + private static void print(PrintStream out, List<TestResult> list, String label) { if ((null == out) || LangUtil.isEmpty(list)) { return; } @@ -130,20 +130,20 @@ public class TestDiffs { // XXX pretty dumb implementation } out.println("## END " + LABEL); } - + /** - * Create ArrayList with input TestResult list + * Create ArrayList with input TestResult list * but without elements in trim list, * comparing based on test name only. * @param input * @param trim * @return ArrayList with all input except those in trim (by name) */ - private static ArrayList trimByName(List input, List trim) { - ArrayList result = new ArrayList(input); + private static List<TestResult> trimByName(List<TestResult> input, List<TestResult> trim) { + List<TestResult> result = new ArrayList<TestResult>(input); if (!LangUtil.isEmpty(input) && !LangUtil.isEmpty(trim)) { - for (ListIterator iter = result.listIterator(); iter.hasNext();) { - TestResult inputItem = (TestResult) iter.next(); + for (ListIterator<TestResult> iter = result.listIterator(); iter.hasNext();) { + TestResult inputItem = iter.next(); for (Object o : trim) { TestResult trimItem = (TestResult) o; if (inputItem.test.equals(trimItem.test)) { @@ -156,9 +156,9 @@ public class TestDiffs { // XXX pretty dumb implementation return result; } - + /** split input List by whether the TestResult element passed or failed */ - private static void split(List input, List pass, List fail) { + private static void split(List<TestResult> input, List<TestResult> pass, List<TestResult> fail) { for (Object o : input) { TestResult result = (TestResult) o; if (result.pass) { @@ -169,18 +169,18 @@ public class TestDiffs { // XXX pretty dumb implementation } } - /** + /** * Read a file of test results, * defined as lines starting with [PASS|FAIL] * (produced by Harness option <tt>-traceTestsmin</tt>). - * @return ArrayList of TestResult, one for every -traceTestsMin line in File + * @return ArrayList of TestResult, one for every -traceTestsMin line in File */ - private static ArrayList readTestResults(File file, String config) throws IOException { + private static ArrayList<TestResult> readTestResults(File file, String config) throws IOException { LangUtil.throwIaxIfNull(file, "file"); if (null == config) { config = file.getPath(); } - ArrayList result = new ArrayList(); + ArrayList<TestResult> result = new ArrayList<TestResult>(); FileReader in = null; try { in = new FileReader(file); @@ -208,56 +208,56 @@ public class TestDiffs { // XXX pretty dumb implementation } return result; } - - private static List safeList(List list) { + + private static List<TestResult> safeList(List<TestResult> list) { return (null == list ? Collections.EMPTY_LIST : Collections.unmodifiableList(list)); } - + /** List of TestResult results from expected run. */ - public final List expected; + public final List<TestResult> expected; /** List of TestResult results from actual run. */ - public final List actual; - + public final List<TestResult> actual; + /** List of TestResult tests disappeared from test suite between expected and actual runs. */ - public final List missing; - + public final List<TestResult> missing; + /** List of TestResult tests added to test suite between expected and actual runs. */ - public final List added; - + public final List<TestResult> added; + /** List of TestResult tests in both runs, expected to pass but actually failed */ - public final List broken; - + public final List<TestResult> broken; + /** List of TestResult tests in both runs, expected to fail but actually passed */ - public final List fixed; - + public final List<TestResult> fixed; + /** List of TestResult passed tests in expected run */ - public final List expectedPassed; + public final List<TestResult> expectedPassed; /** List of TestResult failed tests in expected run */ - public final List expectedFailed; + public final List<TestResult> expectedFailed; /** List of TestResult passed tests in actual run */ - public final List actualPassed; + public final List<TestResult> actualPassed; /** List of TestResult tests failed in actual run */ - public final List actualFailed; + public final List<TestResult> actualFailed; /** List of TestResult tests passed in both expected and actual run */ - public final List stillPassing; + public final List<TestResult> stillPassing; /** List of TestResult tests failed in both expected and actual run */ - public final List stillFailing; - + public final List<TestResult> stillFailing; + private TestDiffs( - List expected, - List actual, - List missing, - List added, - List broken, - List fixed) { + List<TestResult> expected, + List<TestResult> actual, + List<TestResult> missing, + List<TestResult> added, + List<TestResult> broken, + List<TestResult> fixed) { this.expected = safeList(expected); this.actual = safeList(actual); this.missing = safeList(missing); @@ -265,35 +265,35 @@ public class TestDiffs { // XXX pretty dumb implementation this.broken = safeList(broken); this.fixed = safeList(fixed); // expected[Passed|Failed] - ArrayList passed = new ArrayList(); - ArrayList failed = new ArrayList(); + List<TestResult> passed = new ArrayList<TestResult>(); + List<TestResult> failed = new ArrayList<TestResult>(); split(this.expected, passed, failed); expectedPassed = safeList(passed); expectedFailed = safeList(failed); // actual[Passed|Failed] - passed = new ArrayList(); - failed = new ArrayList(); + passed = new ArrayList<TestResult>(); + failed = new ArrayList<TestResult>(); split(this.actual, passed, failed); actualPassed = safeList(passed); actualFailed = safeList(failed); // stillPassing: expected.passed w/o broken, missingPasses - passed = new ArrayList(expectedPassed); + passed = new ArrayList<TestResult>(expectedPassed); passed = trimByName(passed, this.broken); - ArrayList missingPasses = new ArrayList(); - ArrayList missingFails = new ArrayList(); + ArrayList<TestResult> missingPasses = new ArrayList<TestResult>(); + ArrayList<TestResult> missingFails = new ArrayList<TestResult>(); split(this.missing, missingPasses, missingFails); - passed = trimByName(passed, missingPasses); + passed = trimByName(passed, missingPasses); stillPassing = safeList(passed); // stillFailing: expected.failed w/o fixed, missingFails - failed = new ArrayList(expectedFailed); + failed = new ArrayList<TestResult>(expectedFailed); failed = trimByName(failed, this.fixed); - failed = trimByName(failed, missingFails); + failed = trimByName(failed, missingFails); stillFailing = safeList(failed); } - + /** results of a test */ public static class TestResult { public static final Comparator BY_PASSNAME = new Comparator() { @@ -303,16 +303,16 @@ public class TestDiffs { // XXX pretty dumb implementation } TestResult lhs = (TestResult) o1; TestResult rhs = (TestResult) o2; - return (lhs.pass == rhs.pass + return (lhs.pass == rhs.pass ? lhs.test.compareTo(rhs.test) : (lhs.pass ? 1 : -1 )); } - + public boolean equals(Object lhs, Object rhs) { return (0 == compare(lhs, rhs)); } }; - + public static final Comparator BY_NAME = new Comparator() { public int compare(Object o1, Object o2) { if (o1 == o2) { @@ -322,20 +322,20 @@ public class TestDiffs { // XXX pretty dumb implementation TestResult rhs = (TestResult) o2; return lhs.test.compareTo(rhs.test); } - + public boolean equals(Object lhs, Object rhs) { return (0 == compare(lhs, rhs)); } }; - + //private static final ArrayList TESTS = new ArrayList(); public static final String FIELDSEP = "\t"; - + public final String test; public final String config; public final boolean pass; private final String toString; - + public TestResult(String test, String config, boolean pass) { LangUtil.throwIaxIfNull(test, "test"); LangUtil.throwIaxIfNull(test, "config"); @@ -345,7 +345,7 @@ public class TestDiffs { // XXX pretty dumb implementation toString = (pass ? "PASS" : "FAIL") + FIELDSEP + test + FIELDSEP + config; } - + /** @return [PASS|FAIL]{FIELDSEP}test{FIELDSEP}config */ public String toString() { return toString; diff --git a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java index fbe505292..bae13be9e 100644 --- a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java @@ -1,12 +1,12 @@ /* ******************************************************************* * Copyright (c) 2005 Contributors. - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://eclipse.org/legal/epl-v10.html - * - * Contributors: + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: * Adrian Colyer Initial implementation * ******************************************************************/ package org.aspectj.weaver; @@ -23,6 +23,7 @@ import junit.framework.TestCase; // test cases for Adrian's additions to ReferenceType // XXX - couldn't find any unit test cases for the rest of the ReferenceType class +@SuppressWarnings({ "unused", "rawtypes", "unchecked" }) public class ReferenceTypeTestCase extends TestCase { public void testIsRawTrue() { @@ -244,7 +245,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajListOfSomethingNumberish.isAssignableFrom(ajListOfInteger)); // void around(): execution(* C.m1(..)) && args(ArrayList<? extends Number>){}// Should runtime check (it does!) - arrayListOfSomethingNumberish = (ArrayList<? extends Number>) listOfInteger; + arrayListOfSomethingNumberish = listOfInteger; assertFalse(ajArrayListOfSomethingNumberish.isAssignableFrom(ajListOfInteger)); assertTrue(ajArrayListOfSomethingNumberish.isCoerceableFrom(ajListOfInteger)); @@ -253,7 +254,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajList.isAssignableFrom(ajListOfInteger)); // void around(): execution(* C.m1(..)) && args(ArrayList){}//: Should runtime check (it does not match!) - arraylist = (ArrayList) listOfInteger; + arraylist = listOfInteger; assertFalse(ajArrayList.isAssignableFrom(ajListOfInteger)); assertTrue(ajArrayList.isCoerceableFrom(ajListOfInteger)); @@ -262,7 +263,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajListOfSomething.isAssignableFrom(ajListOfInteger)); // void around(): execution(* C.m1(..)) && args(ArrayList<?>){}// Should runtime check (it does not match!) - arrayListOfSomething = (ArrayList<?>) listOfInteger; + arrayListOfSomething = listOfInteger; assertFalse(ajArrayListOfSomething.isAssignableFrom(ajListOfInteger)); assertTrue(ajArrayListOfSomething.isCoerceableFrom(ajListOfInteger)); @@ -331,7 +332,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajListOfSomethingNumberish.isAssignableFrom(ajListOfSomethingNumberish)); // void around(): execution(* C.m2(..)) && args(ArrayList<? extends Number>){}//: Should runtime check (it does!) - arrayListOfSomethingNumberish = (ArrayList<? extends Number>) listOfSomethingNumberish; + arrayListOfSomethingNumberish = listOfSomethingNumberish; assertFalse(ajArrayListOfSomethingNumberish.isAssignableFrom(ajListOfSomethingNumberish)); assertTrue(ajArrayListOfSomethingNumberish.isCoerceableFrom(ajListOfSomethingNumberish)); @@ -340,7 +341,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajList.isAssignableFrom(ajListOfSomethingNumberish)); // void around(): execution(* C.m2(..)) && args(ArrayList){}//: Should runtime check (it does not match!) ERROR - arraylist = (ArrayList) listOfSomethingNumberish; + arraylist = listOfSomethingNumberish; assertFalse(ajArrayList.isAssignableFrom(ajListOfSomethingNumberish)); assertTrue(ajArrayList.isCoerceableFrom(ajListOfSomethingNumberish)); @@ -349,7 +350,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajListOfSomething.isAssignableFrom(ajListOfSomethingNumberish)); // void around(): execution(* C.m2(..)) && args(ArrayList<?>){}//: Should runtime check (it does!) - arrayListOfSomething = (ArrayList) listOfSomethingNumberish; + arrayListOfSomething = listOfSomethingNumberish; assertFalse(ajArrayListOfSomething.isAssignableFrom(ajListOfSomethingNumberish)); assertTrue(ajArrayListOfSomething.isCoerceableFrom(ajListOfSomethingNumberish)); @@ -408,7 +409,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajListOfNumber.isAssignableFrom(ajListOfNumber)); // void around(): execution(* C.m3(..)) && args(ArrayList<Number>){}//: Should runtime match (it does) - arrayListOfNumber = (ArrayList<Number>) listOfNumber; + arrayListOfNumber = listOfNumber; assertFalse(ajArrayListOfNumber.isAssignableFrom(ajListOfNumber)); assertTrue(ajArrayListOfNumber.isCoerceableFrom(ajListOfNumber)); @@ -417,7 +418,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajListOfSomethingNumberish.isAssignableFrom(ajListOfNumber)); // void around(): execution(* C.m3(..)) && args(ArrayList<? extends Number>){}//: Should runtime check (it does!) - arrayListOfSomethingNumberish = (ArrayList<? extends Number>) listOfNumber; + arrayListOfSomethingNumberish = listOfNumber; assertFalse(ajArrayListOfSomethingNumberish.isAssignableFrom(ajListOfNumber)); assertTrue(ajArrayListOfSomethingNumberish.isCoerceableFrom(ajListOfNumber)); @@ -426,7 +427,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajList.isAssignableFrom(ajListOfNumber)); // void around(): execution(* C.m3(..)) && args(ArrayList){}//: Should runtime check (it does not match!) ERROR - arrayList = (ArrayList) listOfNumber; + arrayList = listOfNumber; assertFalse(ajArrayList.isAssignableFrom(ajListOfNumber)); assertTrue(ajArrayList.isCoerceableFrom(ajListOfNumber)); @@ -435,7 +436,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajListOfSomething.isAssignableFrom(ajListOfNumber)); // void around(): execution(* C.m3(..)) && args(ArrayList<?>){}//: Should runtime check (it does!) - arrayListOfSomething = (ArrayList<?>) listOfNumber; + arrayListOfSomething = listOfNumber; assertFalse(ajArrayListOfSomething.isAssignableFrom(ajListOfNumber)); assertTrue(ajArrayListOfSomething.isCoerceableFrom(ajListOfNumber)); @@ -449,7 +450,7 @@ public class ReferenceTypeTestCase extends TestCase { static class ClassA<T> { } - static interface IMarker<H> { + interface IMarker<H> { } static class ClassB<T> implements IMarker<ClassA<T>> { @@ -542,7 +543,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajList.isAssignableFrom(ajListOfSomething)); // void around(): execution(* C.m4(..)) && args(ArrayList){} // Should runtime check - arraylist = (ArrayList) listOfSomething; + arraylist = listOfSomething; assertFalse(ajArrayList.isAssignableFrom(ajListOfSomething)); assertTrue(ajArrayList.isCoerceableFrom(ajListOfSomething)); @@ -551,7 +552,7 @@ public class ReferenceTypeTestCase extends TestCase { assertTrue(ajList.isAssignableFrom(ajListOfSomething)); // void around(): execution(* C.m4(..)) && args(ArrayList<?>){} // Should runtime check - arrayListOfSomething = (ArrayList<?>) listOfSomething; + arrayListOfSomething = listOfSomething; assertFalse(ajArrayListOfSomething.isAssignableFrom(ajListOfSomething)); assertTrue(ajArrayListOfSomething.isCoerceableFrom(ajListOfSomething)); diff --git a/weaver/src/test/java/org/aspectj/weaver/bcel/PointcutResidueTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/PointcutResidueTestCase.java index 7f6f5f163..210002fa6 100644 --- a/weaver/src/test/java/org/aspectj/weaver/bcel/PointcutResidueTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/bcel/PointcutResidueTestCase.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * PARC initial implementation * ******************************************************************/ package org.aspectj.weaver.bcel; @@ -16,7 +16,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.reflect.Modifier; -import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.aspectj.weaver.AdviceKind; @@ -167,8 +167,7 @@ public class PointcutResidueTestCase extends WeaveTestCase { } public void weaveTest(String name, String outName, ShadowMunger planner) throws IOException { - List l = new ArrayList(1); - l.add(planner); + List<ShadowMunger> l = Collections.singletonList(planner); weaveTest(name, outName, l); } diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java index cf10b3662..6e4ffa9f6 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java @@ -1,11 +1,11 @@ /* ******************************************************************* * Copyright (c) 2004 IBM Corporation. - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * * ******************************************************************/ package org.aspectj.weaver.tools; @@ -199,7 +199,7 @@ public class PointcutParserTest extends TestCase { return; } - Set pcKinds = PointcutParser.getAllSupportedPointcutPrimitives(); + Set<PointcutPrimitive> pcKinds = PointcutParser.getAllSupportedPointcutPrimitives(); pcKinds.remove(PointcutPrimitive.REFERENCE); PointcutParser p = PointcutParser.getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution( pcKinds, this.getClass().getClassLoader()); |