diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-06-04 07:58:52 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-06-04 07:58:52 +0700 |
commit | 49cb924f5402c9d24379ae1af62def6fa5892649 (patch) | |
tree | 69844405209043e2e18aa9eef0f01f287bc1ae52 /testing | |
parent | 82df3f0fc9842758f15f12299c9113e48f1ccb5c (diff) | |
download | aspectj-49cb924f5402c9d24379ae1af62def6fa5892649.tar.gz aspectj-49cb924f5402c9d24379ae1af62def6fa5892649.zip |
Upgrade license from CPLv1/EPLv1 to EPLv2
This was required by the Eclipse team as one precondition for the next
release.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'testing')
114 files changed, 2011 insertions, 2011 deletions
diff --git a/testing/src/main/java/Empty.java b/testing/src/main/java/Empty.java index 0b2319f5e..888e16632 100644 --- a/testing/src/main/java/Empty.java +++ b/testing/src/main/java/Empty.java @@ -1,9 +1,9 @@ /******************************************************************************* * Copyright (c) 2019 Contributors * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * are made available under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * *******************************************************************************/ diff --git a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java index 98878dcbc..d9a91703b 100644 --- a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java +++ b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/Ajctest.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/MainWrapper.java b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/MainWrapper.java index 6ce22df24..55b80741e 100644 --- a/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/MainWrapper.java +++ b/testing/src/test/java/org/aspectj/internal/tools/ant/taskdefs/MainWrapper.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -23,7 +23,7 @@ import java.lang.reflect.Modifier; import org.aspectj.testing.util.LangUtil; -/** +/** * Wrapper to invoke class identified by setting VM argument. * Caller must set a system property "MainWrapper.classname" * to the fully-qualified name of the target class to invoke, @@ -37,10 +37,10 @@ import org.aspectj.testing.util.LangUtil; */ public class MainWrapper { /** MUST set the fully-qualified name of class to invoke using - * a VM property of this name + * a VM property of this name * tracked in Ajctest.java */ public static final String PROP_NAME = "MainWrapper.classname"; - /** May set the path to a classes diretory, + /** May set the path to a classes diretory, * to interpret class names and load classes. * Tracked in Ajctest.java */ public static final String CLASSDIR_NAME = "MainWrapper.classdir"; @@ -51,23 +51,23 @@ public class MainWrapper { /** to disable returning via System.exit on first Throwable, set to boolean true value (todo: ignored) */ public static final String FAIL_ON_EXCEPTION_NAME = "MainWrapper.failOnException"; - /** quit on first exception */ // todo public class controls - yuck + /** quit on first exception */ // todo public class controls - yuck public static boolean FAIL_ON_EXCEPTION = true; - /** signal number of exceptions with int return value */ + /** signal number of exceptions with int return value */ public static boolean SIGNAL_EXCEPTION = true; - /** redirect messages for exceptions; if null, none printed */ + /** redirect messages for exceptions; if null, none printed */ public static PrintStream OUT_STREAM = System.err; - /** result accumulated, possibly from multiple threads */ + /** result accumulated, possibly from multiple threads */ private static int result; /** * Run target class's main(args), doing a System.exit() with - * a value > 0 for the number of Throwable that + * a value > 0 for the number of Throwable that * the target class threw that - * makes it through to a top-level ThreadGroup. (This is + * makes it through to a top-level ThreadGroup. (This is * strictly speaking not correct since applications can live * after their exceptions stop a thread.) * Exit with a value < 0 if there were exceptions in loading @@ -78,7 +78,7 @@ public class MainWrapper { Method main = null; // setup: this try block is for loading main method - return -1 if fail try { - // access classname from jvm arg + // access classname from jvm arg classname = System.getProperty(PROP_NAME); // this will fail if the class is not available from this classloader Class<?> cl = Class.forName(classname); @@ -149,7 +149,7 @@ public class MainWrapper { } } - /** + /** * Try to load all classes in a directory. * @throws Error if any failed */ @@ -159,7 +159,7 @@ public class MainWrapper { StringBuffer err = new StringBuffer(); LangUtil.loadClasses(names, null, err); if (0 < err.length()) { - throw new Error("MainWrapper Errors loading classes: " + throw new Error("MainWrapper Errors loading classes: " + err.toString()); } } @@ -168,7 +168,7 @@ public class MainWrapper { static void reportException(String context, Throwable t) { PrintStream outStream = OUT_STREAM; if (null != outStream) { - while ((null != t) && + while ((null != t) && (InvocationTargetException.class.isAssignableFrom(t.getClass()))) { t = ((InvocationTargetException) t).getTargetException(); } diff --git a/testing/src/test/java/org/aspectj/testing/AjcTest.java b/testing/src/test/java/org/aspectj/testing/AjcTest.java index ee0349c81..cf356723e 100644 --- a/testing/src/test/java/org/aspectj/testing/AjcTest.java +++ b/testing/src/test/java/org/aspectj/testing/AjcTest.java @@ -2,9 +2,9 @@ * Copyright (c) 2004,2019 IBM Corporation, contributors * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * ******************************************************************/ package org.aspectj.testing; diff --git a/testing/src/test/java/org/aspectj/testing/AntSpec.java b/testing/src/test/java/org/aspectj/testing/AntSpec.java index f3bf7cc44..9d239d61b 100644 --- a/testing/src/test/java/org/aspectj/testing/AntSpec.java +++ b/testing/src/test/java/org/aspectj/testing/AntSpec.java @@ -2,9 +2,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Alexandre Vasseur initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java index a0314017b..3769f9326 100644 --- a/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java +++ b/testing/src/test/java/org/aspectj/testing/AutowiredXMLBasedAjcTestCase.java @@ -1,9 +1,9 @@ /******************************************************************************* * 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 + * are made available under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * initial implementation Alexandre Vasseur diff --git a/testing/src/test/java/org/aspectj/testing/CompileSpec.java b/testing/src/test/java/org/aspectj/testing/CompileSpec.java index 9122dc0d3..33e3d49aa 100644 --- a/testing/src/test/java/org/aspectj/testing/CompileSpec.java +++ b/testing/src/test/java/org/aspectj/testing/CompileSpec.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2004,2016 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 - * - * Contributors: - * Adrian Colyer, + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Adrian Colyer, * ******************************************************************/ package org.aspectj.testing; @@ -27,7 +27,7 @@ import org.aspectj.tools.ajc.CompilationResult; public class CompileSpec implements ITestStep { private List<ExpectedMessageSpec> expected = new ArrayList<>(); - + private String files; private boolean includeClassesDir; private String aspectpath; @@ -42,10 +42,10 @@ public class CompileSpec implements ITestStep { private String baseDir; private String extdirs; private AjcTest myTest; - + public CompileSpec() { } - + public void execute(AjcTestCase inTestCase) { File base = new File(baseDir); String[] args = buildArgs(); @@ -63,18 +63,18 @@ public class CompileSpec implements ITestStep { public void setBaseDir(String dir) { this.baseDir = dir; } - + protected String getBaseDir() { return baseDir; } - + public void setTest(AjcTest t) { this.myTest = t; if (options != null && (options.contains("-1.5"))) { myTest.setVm("1.5"); } } - + protected AjcTest getTest() { return myTest; } - + /** * @return Returns the aspectpath. */ @@ -103,7 +103,7 @@ public class CompileSpec implements ITestStep { public String getModulepath() { return this.modulepath; } - + public void setModulepath(String modulepath) { this.modulepath = modulepath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); } @@ -211,10 +211,10 @@ public class CompileSpec implements ITestStep { public void setXlintfile(String xlintfile) { this.xlintfile = xlintfile; } - + public String getExtdirs() { return extdirs;} public void setExtdirs(String extdirs) { this.extdirs = extdirs; } - + protected String[] buildArgs() { StringBuffer args = new StringBuffer(); // add any set options, and then files to compile at the end @@ -301,7 +301,7 @@ public class CompileSpec implements ITestStep { } return ret; } - + private String rewrite(String path) { path = path.replace("$runtimemodule", TestUtil.aspectjrtPath(true).toString()); path = path.replace("$runtime", TestUtil.aspectjrtPath().toString()); @@ -323,7 +323,7 @@ public class CompileSpec implements ITestStep { } else if (kind.equals("warning")) { warnings.add(exMsg.toMessage()); } else if (kind.equals("error")) { - errors.add(exMsg.toMessage()); + errors.add(exMsg.toMessage()); } else if (kind.equals("fail")) { fails.add(exMsg.toMessage()); } else if (kind.equals("abort")) { diff --git a/testing/src/test/java/org/aspectj/testing/ExpectedMessageSpec.java b/testing/src/test/java/org/aspectj/testing/ExpectedMessageSpec.java index 2193b55ae..23903beb7 100644 --- a/testing/src/test/java/org/aspectj/testing/ExpectedMessageSpec.java +++ b/testing/src/test/java/org/aspectj/testing/ExpectedMessageSpec.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 - * - * Contributors: - * Adrian Colyer, + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Adrian Colyer, * ******************************************************************/ package org.aspectj.testing; @@ -26,11 +26,11 @@ public class ExpectedMessageSpec { private String text; private String file; private String details; - + public AjcTestCase.Message toMessage() { return new AjcTestCase.Message(line,file,text,null); } - + /** * @return Returns the details. */ diff --git a/testing/src/test/java/org/aspectj/testing/FileSpec.java b/testing/src/test/java/org/aspectj/testing/FileSpec.java index cd11e4026..4d6b78e5b 100644 --- a/testing/src/test/java/org/aspectj/testing/FileSpec.java +++ b/testing/src/test/java/org/aspectj/testing/FileSpec.java @@ -1,9 +1,9 @@ /******************************************************************************* - * Copyright (c) 2010 Contributors + * Copyright (c) 2010 Contributors * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 + * are made available under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Andy Clement - SpringSource @@ -17,13 +17,13 @@ import org.aspectj.tools.ajc.AjcTestCase; /** * Support simple file system operations in a test spec. Example:<br> * <file deletefile="foo.jar"/> will delete the file foo.jar from the sandbox. - * + * * @author Andy Clement */ public class FileSpec implements ITestStep { private String toDelete; - + private String renameFrom; private String renameTo; @@ -36,11 +36,11 @@ public class FileSpec implements ITestStep { public void setRenameFrom(String file) { this.renameFrom = file; } - + public void setRenameTo(String file) { this.renameTo = file; } - + public void setDeletefile(String file) { this.toDelete = file; } diff --git a/testing/src/test/java/org/aspectj/testing/ITestStep.java b/testing/src/test/java/org/aspectj/testing/ITestStep.java index 673d6c66d..0c57e41e0 100644 --- a/testing/src/test/java/org/aspectj/testing/ITestStep.java +++ b/testing/src/test/java/org/aspectj/testing/ITestStep.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 - * - * Contributors: - * Adrian Colyer, + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Adrian Colyer, * ******************************************************************/ package org.aspectj.testing; @@ -19,10 +19,10 @@ import org.aspectj.tools.ajc.AjcTestCase; public interface ITestStep { void execute(AjcTestCase inTestCase); - + void addExpectedMessage(ExpectedMessageSpec message); - + void setBaseDir(String dir); - + void setTest(AjcTest test); } diff --git a/testing/src/test/java/org/aspectj/testing/MakeTestClass.java b/testing/src/test/java/org/aspectj/testing/MakeTestClass.java index 840368c63..91cee0ea2 100644 --- a/testing/src/test/java/org/aspectj/testing/MakeTestClass.java +++ b/testing/src/test/java/org/aspectj/testing/MakeTestClass.java @@ -22,15 +22,15 @@ import org.apache.commons.digester.Digester; */ public class MakeTestClass { - private static final String HEADER = + private static final String HEADER = "/* *******************************************************************\n" + " * Copyright (c) 2004 IBM Corporation\n" + - " * All rights reserved.\n" + - " * This program and the accompanying materials are made available\n" + - " * under the terms of the Eclipse Public License v1.0\n" + - " * which accompanies this distribution and is available at\n" + - " * http://www.eclipse.org/legal/epl-v10.html \n" + - " * \n" + + " * All rights reserved.\n" + + " * This program and the accompanying materials are made available\n" + + " * under the terms of the Eclipse Public License v 2.0\n" + + " * which accompanies this distribution and is available at\n" + + " * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt\n" + + " * \n" + " * ******************************************************************/\n" + "package org.aspectj.systemtest.XXX;\n" + "\n" + @@ -40,34 +40,34 @@ public class MakeTestClass { "\n" + "public class "; - private static final String BODY_1 = + private static final String BODY_1 = " extends org.aspectj.testing.XMLBasedAjcTestCase {\n" + "\n" + " public static Test suite() {\n" + " return XMLBasedAjcTestCase.loadSuite("; - + private static final String BODY_2 = ".class);\n" + " }\n" + "\n" + " protected File getSpecFile() {\n" + " return new File(\""; - + private static final String BODY_3 = "\");\n" + " }\n"; - + private static final String FOOTER = "}\n"; - + private List<AjcTest> tests = new ArrayList<>(); private String className; private String suiteFile; - + public static void main(String[] args) throws Exception { new MakeTestClass(args[0],args[1]).makeTestClass(); } - + public MakeTestClass(String className, String suiteFile)throws Exception { this.className = className; this.suiteFile = suiteFile; @@ -75,11 +75,11 @@ public class MakeTestClass { InputStreamReader isr = new InputStreamReader(new FileInputStream(suiteFile)); d.parse(isr); } - + public void addTest(AjcTest test) { tests.add(test); } - + public void makeTestClass() throws Exception { FileOutputStream fos = new FileOutputStream(className + ".java"); PrintStream out = new PrintStream(fos); @@ -106,7 +106,7 @@ public class MakeTestClass { out.println(FOOTER); out.close(); } - + private Digester getDigester() { Digester digester = new Digester(); digester.push(this); diff --git a/testing/src/test/java/org/aspectj/testing/OutputLine.java b/testing/src/test/java/org/aspectj/testing/OutputLine.java index fc6fe4ce9..d9e995d3f 100644 --- a/testing/src/test/java/org/aspectj/testing/OutputLine.java +++ b/testing/src/test/java/org/aspectj/testing/OutputLine.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2005 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 - * - * Contributors: - * Adrian Colyer, + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Adrian Colyer, * ******************************************************************/ package org.aspectj.testing; @@ -22,21 +22,21 @@ public class OutputLine { // Comma separated list of vm versions on which this is expected private String vm; - + public String getText() { return text; } - + public void setText(String text) { this.text = text; } - + public String getVm() { return vm; } - + public void setVm(String vm) { this.vm = vm; } - + } diff --git a/testing/src/test/java/org/aspectj/testing/OutputSpec.java b/testing/src/test/java/org/aspectj/testing/OutputSpec.java index f8c96077f..210dc24a8 100644 --- a/testing/src/test/java/org/aspectj/testing/OutputSpec.java +++ b/testing/src/test/java/org/aspectj/testing/OutputSpec.java @@ -2,9 +2,9 @@ * Copyright (c) 2005 IBM Corporation * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Adrian Colyer, diff --git a/testing/src/test/java/org/aspectj/testing/RunSpec.java b/testing/src/test/java/org/aspectj/testing/RunSpec.java index f4dc98206..d687ae86b 100644 --- a/testing/src/test/java/org/aspectj/testing/RunSpec.java +++ b/testing/src/test/java/org/aspectj/testing/RunSpec.java @@ -2,9 +2,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Adrian Colyer, Abraham Nevado (lucierna) diff --git a/testing/src/test/java/org/aspectj/testing/TestingModuleTests.java b/testing/src/test/java/org/aspectj/testing/TestingModuleTests.java index 327be6bd4..ea02d562b 100644 --- a/testing/src/test/java/org/aspectj/testing/TestingModuleTests.java +++ b/testing/src/test/java/org/aspectj/testing/TestingModuleTests.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing; @@ -39,7 +39,7 @@ import junit.framework.TestSuite; public class TestingModuleTests extends TestCase { - public static Test suite() { + public static Test suite() { TestSuite suite = new TestSuite(TestingModuleTests.class.getName()); suite.addTestSuite(ValuesTest.class); @@ -63,14 +63,14 @@ public class TestingModuleTests extends TestCase { suite.addTestSuite(AbstractRunSpecTest.class); suite.addTestSuite(AjcTaskCompileCommandTest.class); -// suite.addTest(org.aspectj.testing.harness.bridge.TestingBridgeTests.suite()); -// suite.addTest(org.aspectj.testing.taskdefs.TaskdefTests.suite()); -// suite.addTest(org.aspectj.testing.util.UtilTests.suite()); -// suite.addTest(org.aspectj.testing.util.options.OptionsTests.suite()); -// suite.addTest(org.aspectj.testing.xml.TestingXmlTests.suite()); +// suite.addTest(org.aspectj.testing.harness.bridge.TestingBridgeTests.suite()); +// suite.addTest(org.aspectj.testing.taskdefs.TaskdefTests.suite()); +// suite.addTest(org.aspectj.testing.util.UtilTests.suite()); +// suite.addTest(org.aspectj.testing.util.options.OptionsTests.suite()); +// suite.addTest(org.aspectj.testing.xml.TestingXmlTests.suite()); return suite; } public TestingModuleTests(String name) { super(name); } -} +} diff --git a/testing/src/test/java/org/aspectj/testing/WeaveSpec.java b/testing/src/test/java/org/aspectj/testing/WeaveSpec.java index 41b561311..c840f4261 100644 --- a/testing/src/test/java/org/aspectj/testing/WeaveSpec.java +++ b/testing/src/test/java/org/aspectj/testing/WeaveSpec.java @@ -2,9 +2,9 @@ * Copyright (c) 2005 IBM Corporation * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Adrian Colyer, diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java index 05a8cafa1..c332ab6f2 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java @@ -2,9 +2,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Adrian Colyer, diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java index 753de0c80..cde3c077e 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java @@ -1,12 +1,12 @@ /* ******************************************************************* * Copyright (c) 2018 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://www.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: * Andy Clement * ******************************************************************/ package org.aspectj.testing; @@ -15,7 +15,7 @@ import org.aspectj.util.LangUtil; /** * Ensure sure tests are running on the right level of JDK. - * + * * @author Andy Clement */ public abstract class XMLBasedAjcTestCaseForJava10OrLater extends XMLBasedAjcTestCase { @@ -26,5 +26,5 @@ public abstract class XMLBasedAjcTestCaseForJava10OrLater extends XMLBasedAjcTes throw new IllegalStateException("These tests should be run on Java 10 or later"); super.setUp(); } - + } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java index 1bfcdd580..2083f462e 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava11OrLater.java @@ -1,12 +1,12 @@ /* ******************************************************************* * Copyright (c) 2018 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://www.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: * Andy Clement * ******************************************************************/ package org.aspectj.testing; @@ -15,7 +15,7 @@ import org.aspectj.util.LangUtil; /** * Makes sure tests are running on the right level of JDK. - * + * * @author Andy Clement */ public abstract class XMLBasedAjcTestCaseForJava11OrLater extends XMLBasedAjcTestCase { @@ -26,5 +26,5 @@ public abstract class XMLBasedAjcTestCaseForJava11OrLater extends XMLBasedAjcTes throw new IllegalStateException("These tests should be run on Java 11 or later"); super.setUp(); } - + } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java index e1a847f4e..86da7d4a4 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava12OrLater.java @@ -1,12 +1,12 @@ /* ******************************************************************* * Copyright (c) 2018 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://www.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: * Andy Clement * ******************************************************************/ package org.aspectj.testing; @@ -15,7 +15,7 @@ import org.aspectj.util.LangUtil; /** * Ensure sure tests are running on the right level of JDK. - * + * * @author Andy Clement */ public abstract class XMLBasedAjcTestCaseForJava12OrLater extends XMLBasedAjcTestCase { @@ -26,5 +26,5 @@ public abstract class XMLBasedAjcTestCaseForJava12OrLater extends XMLBasedAjcTes throw new IllegalStateException("These tests should be run on Java 12 or later"); super.setUp(); } - + } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java index 2ce1ee80e..a280f157f 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava13OrLater.java @@ -2,9 +2,9 @@ * Copyright (c) 2019 Contributors * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Andy Clement diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java index 8e90ead3a..ece127651 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14Only.java @@ -2,9 +2,9 @@ * Copyright (c) 2021 Contributors * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * ******************************************************************/ package org.aspectj.testing; diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java index 73df02f4a..d147c572f 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava14OrLater.java @@ -2,9 +2,9 @@ * Copyright (c) 2020 Contributors * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * ******************************************************************/ package org.aspectj.testing; diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java index 0e9f43d83..868ece1e3 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15Only.java @@ -2,9 +2,9 @@ * Copyright (c) 2021 Contributors * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * ******************************************************************/ package org.aspectj.testing; diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java index 72033daf5..3027825a2 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava15OrLater.java @@ -2,9 +2,9 @@ * Copyright (c) 2021 Contributors * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * ******************************************************************/ package org.aspectj.testing; diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java index dc51db8ca..0a4e31b6f 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16Only.java @@ -2,9 +2,9 @@ * Copyright (c) 2021 Contributors * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * ******************************************************************/ package org.aspectj.testing; diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java index 6fd29c8d3..7f5da29b0 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava16OrLater.java @@ -2,9 +2,9 @@ * Copyright (c) 2021 Contributors * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * ******************************************************************/ package org.aspectj.testing; diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java index 0be3424ef..5a8ae0b01 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java @@ -2,9 +2,9 @@ * Copyright (c) 2018 Contributors * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Andy Clement diff --git a/testing/src/test/java/org/aspectj/testing/ajde/CompileCommand.java b/testing/src/test/java/org/aspectj/testing/ajde/CompileCommand.java index ccae0fd43..d78c4e68d 100644 --- a/testing/src/test/java/org/aspectj/testing/ajde/CompileCommand.java +++ b/testing/src/test/java/org/aspectj/testing/ajde/CompileCommand.java @@ -1,14 +1,14 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: * Wes Isberg initial implementation - * Helen Hawkins Converted to new interface (bug 148190) + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ package org.aspectj.testing.ajde; @@ -43,7 +43,7 @@ import org.aspectj.util.FileUtil; /** * This re-uses the same config file to setup ajde so that recompiles appear to be of the same configuration. - * + * * @since Java 1.3 (uses dynamic proxies) */ public class CompileCommand implements ICommand { diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpec.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpec.java index ed4f560c0..c0516ad77 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpec.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpec.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpecTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpecTest.java index 3ed472c5e..c9a4304c4 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpecTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/AbstractRunSpecTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; @@ -22,7 +22,7 @@ import org.aspectj.testing.xml.XMLWriter; import junit.framework.TestCase; /** - * + * */ public class AbstractRunSpecTest extends TestCase { @@ -48,10 +48,10 @@ public class AbstractRunSpecTest extends TestCase { String s = "" + options; assertTrue(s, "[1, 2]".equals(s)); } - + static class TestSpec extends AbstractRunSpec { TestSpec() { - super("testspec"); + super("testspec"); } /** * @see org.aspectj.testing.harness.bridge.AbstractRunSpec#makeRunIterator(Sandbox, Validator) diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcMessageHandler.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcMessageHandler.java index da265e7f9..575c1e04a 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcMessageHandler.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcMessageHandler.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; @@ -70,7 +70,7 @@ public class AjcMessageHandler extends MessageHandler { AjcMessageHandler(IMessageHolder expectedMessages) { this(expectedMessages, false); } - /** + /** * @param messages the (constant) IMessageHolder with expected messages */ AjcMessageHandler( @@ -117,7 +117,7 @@ public class AjcMessageHandler extends MessageHandler { return expecting(message); } - /** + /** * Set the actual files recompiled. * @param List of File recompiled - may be null; adopted but not modified * @throws IllegalStateException if they have been set already. @@ -150,7 +150,7 @@ public class AjcMessageHandler extends MessageHandler { if (usingNew) { final IMessage.Kind[] NOSKIPS = new IMessage.Kind[0]; IMessage.Kind[] skipActual = new IMessage.Kind[] { IMessage.INFO }; - int expectedInfo + int expectedInfo = MessageUtil.numMessages(expected, IMessage.INFO, false); if (0 < expectedInfo) { // fyi, when expecting any info messages, have to expect all @@ -164,11 +164,11 @@ public class AjcMessageHandler extends MessageHandler { skipActual); } else { messages = Diffs.makeDiffs( - "message", - expected, - actual, - COMP_IMessage, - Diffs.ACCEPT_ALL, + "message", + expected, + actual, + COMP_IMessage, + Diffs.ACCEPT_ALL, CompilerDiffs.SKIP_UNEXPECTED_INFO); } Diffs recompiled = @@ -186,7 +186,7 @@ public class AjcMessageHandler extends MessageHandler { * Get the (current) result of this run, * ignoring differences in warnings on request. * Note it may return passed (true) when there are expected error messages. - * @return false + * @return false * if there are any fail or abort messages, * or if the expected errors, warnings, or recompiled do not match actual. */ @@ -240,9 +240,9 @@ public class AjcMessageHandler extends MessageHandler { return sb.toString(); // XXX cache toString } - /** + /** * Check if the message was expected, and clear diffs if not. - * @return true if we expect a message of this kind with this line number + * @return true if we expect a message of this kind with this line number */ private boolean expecting(IMessage message) { boolean match = false; diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java index 5adf128e3..3da7a6a32 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcSpecTest.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcTest.java index 5ca41509f..2e2dc5e17 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/AjcTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; @@ -42,7 +42,7 @@ import org.aspectj.util.LangUtil; * (add Thread to key to restrict access?) */ public class AjcTest extends RunSpecIterator { - + /** Unwrap an AjcTest.Spec from an IRunStatus around an AjcTest */ public static Spec unwrapSpec(IRunStatus status) { if (null != status) { @@ -54,9 +54,9 @@ public class AjcTest extends RunSpecIterator { } } } - return null; + return null; } - + /** Unwrap initial CompilerRun.Spec from an AjcTest.Spec */ public static CompilerRun.Spec unwrapCompilerRunSpec(Spec spec) { if (null != spec) { @@ -68,14 +68,14 @@ public class AjcTest extends RunSpecIterator { } } } - return null; + return null; } /** The spec creates the sandbox, so we use it throughout */ public AjcTest(Spec spec, Sandbox sandbox, Validator validator) { super(spec, sandbox, validator, true); } - + /** * Clear the command from the sandbox, to avoid memory leaks. * @see org.aspectj.testing.harness.bridge.RunSpecIterator#iterationCompleted() @@ -84,9 +84,9 @@ public class AjcTest extends RunSpecIterator { super.iterationCompleted(); sandbox.clearCommand(this); } - - - /** + + + /** * Specification for an ajc test. * Keyword directives are global/parent options passed, e.g., as * <pre>-ajctest[Require|Skip]Keywords=keyword{,keyword}..</pre>. @@ -95,15 +95,15 @@ public class AjcTest extends RunSpecIterator { public static class Spec extends AbstractRunSpec { public static final String XMLNAME = "ajc-test"; /** - * do description as title, do sourceLocation, + * do description as title, do sourceLocation, * do keywords, do options, skip paths, do comment, * skip staging, skip badInput, * skip dirChanges, do messages and do children - * (though we do children directly). + * (though we do children directly). */ private static final XMLNames NAMES = new XMLNames(XMLNames.DEFAULT, "title", null, null, null, "", null, "", "", true, false, false); - + private static final String OPTION_PREFIX = "-ajctest"; private static final String[] VALID_OPTIONS = new String[] { OPTION_PREFIX }; @@ -113,14 +113,14 @@ public class AjcTest extends RunSpecIterator { private static final String REQUIRE_KEYWORDS = "RequireKeywords="; private static final String SKIP_KEYWORDS = "SkipKeywords="; private static final String PICK_PR = "PR="; - private static final List<String> VALID_SUFFIXES - = Collections.unmodifiableList(Arrays.asList(new String[] - { TITLE_LIST, TITLE_FAIL_LIST, TITLE_CONTAINS, + private static final List<String> VALID_SUFFIXES + = Collections.unmodifiableList(Arrays.asList(new String[] + { TITLE_LIST, TITLE_FAIL_LIST, TITLE_CONTAINS, REQUIRE_KEYWORDS, SKIP_KEYWORDS, PICK_PR })); - + /** Map String titlesName to List (String) of titles to accept */ private static final Map<String,List<String>> TITLES = new HashMap<>(); - + private static List<String> getTitles(String titlesName) { return getTitles(titlesName, false); } @@ -135,7 +135,7 @@ public class AjcTest extends RunSpecIterator { } return result; } - + /** * Make titles list per titlesKey, either a path to a file * containing "[PASS|FAIL] {title}(..)" entries, @@ -148,7 +148,7 @@ public class AjcTest extends RunSpecIterator { */ private static List<String> makeTitlesList(String titlesKey, boolean fail) { File file = new File(titlesKey); - return file.canRead() + return file.canRead() ? readTitlesFile(file, fail) : parseTitlesList(titlesKey); } @@ -184,7 +184,7 @@ public class AjcTest extends RunSpecIterator { result.add(next); } } - if (null != last) { + if (null != last) { String m = "unterminated entry \"" + last; // XXX messages System.err.println(m + "\" in " + titlesList); result.add(last.trim()); @@ -198,7 +198,7 @@ public class AjcTest extends RunSpecIterator { * excluding the "[PASS|FAIL] Suite.Spec(.." entry. * @param titlesFile the File containing a * list of titles from test results, - * with some lines of the form + * with some lines of the form * <code>[PASS|FAIL] {title}()<code> (excluding * <code>[PASS|FAIL] Suite.Spec(...<code>. * @param titlesFile the File path to the file containing titles @@ -238,13 +238,13 @@ public class AjcTest extends RunSpecIterator { } return Collections.unmodifiableList(result); } - + /** base directory of the test suite - set before making run */ private File suiteDir; - + /** path offset from suite directory to base of test directory */ String testDirOffset; // XXX revert to private after fixes - + /** id of bug - if 0, then no bug associated with this test */ private int bugId; @@ -252,49 +252,49 @@ public class AjcTest extends RunSpecIterator { super(XMLNAME); setXMLNames(NAMES); } - - protected void initClone(Spec spec) + + protected void initClone(Spec spec) throws CloneNotSupportedException { super.initClone(spec); spec.bugId = bugId; spec.suiteDir = suiteDir; spec.testDirOffset = testDirOffset; } - + public Object clone() throws CloneNotSupportedException { Spec result = new Spec(); initClone(result); - return result; + return result; } - + public void setSuiteDir(File suiteDir) { this.suiteDir = suiteDir; } - + public File getSuiteDir() { return suiteDir; } - + /** @param bugId 100..999999 */ public void setBugId(int bugId) { LangUtil.throwIaxIfFalse((bugId > 10) && (bugId < 1000000), "bad bug id: " + bugId); this.bugId = bugId; } - + public int getBugId() { return bugId; } - + public void setTestDirOffset(String testDirOffset) { if (!LangUtil.isEmpty(testDirOffset)) { this.testDirOffset = testDirOffset; } } - + public String getTestDirOffset() { return (null == testDirOffset ? "" : testDirOffset); } - + /** * @param sandbox ignored * @see org.aspectj.testing.harness.bridge.AbstractRunSpec#makeAjcRun(Sandbox, Validator) @@ -316,7 +316,7 @@ public class AjcTest extends RunSpecIterator { suiteDir = locDir; } - // we make a new sandbox with more state for our subruns, keep that, + // we make a new sandbox with more state for our subruns, keep that, // in order to defer initialization to nextRun() File testBaseDir; String testDirOffset = getTestDirOffset(); @@ -352,10 +352,10 @@ public class AjcTest extends RunSpecIterator { out.endAttributes(); super.writeChildren(out); out.endElement(xmlElementName); - } - + } + /** - * AjcTest overrides this to skip if + * AjcTest overrides this to skip if * <ul> * <li>the spec has a keyword the parent wants to skip</li> * <li>the spec does not have a required keyword</li> @@ -373,7 +373,7 @@ public class AjcTest extends RunSpecIterator { return false; } runtime.copy(parentRuntime); - + String[] globalOptions = runtime.extractOptions(VALID_OPTIONS, true); for (String globalOption : globalOptions) { String option = globalOption; @@ -461,17 +461,17 @@ public class AjcTest extends RunSpecIterator { } } return true; - } + } } // AjcTest.Spec - - /** + + /** * A suite of AjcTest has children for each AjcTest - * and flows all options down as globals + * and flows all options down as globals */ public static class Suite extends RunSpecIterator { final Spec spec; - + /** * Count the number of AjcTest in this suite. * @param spec @@ -492,7 +492,7 @@ public class AjcTest extends RunSpecIterator { super(spec, sandbox, validator, false); this.spec = spec; } - + /** * While being called to make the sandbox for the child, * set up the child's suite dir based on ours. @@ -514,9 +514,9 @@ public class AjcTest extends RunSpecIterator { return super.makeSandbox(child, validator); } - /** + /** * A suite spec contains AjcTest children. - * The suite dir or source location should be set + * The suite dir or source location should be set * if the tests do not each have a source location * with a source file in the suite dir. * XXX whether to write out suiteDir in XML? @@ -524,11 +524,11 @@ public class AjcTest extends RunSpecIterator { public static class Spec extends AbstractRunSpec { public static final String XMLNAME = "suite"; /** - * do description, do sourceLocation, + * do description, do sourceLocation, * do keywords, do options, skip paths, do comment, * skip staging, skip badInput, * skip dirChanges, skip messages and do children - * (though we do children directly). + * (though we do children directly). */ // private static final XMLNames NAMES = new XMLNames(XMLNames.DEFAULT, // null, null, null, null, "", null, "", "", true, true, false); @@ -536,26 +536,26 @@ public class AjcTest extends RunSpecIterator { public Spec() { super(XMLNAME, false); // do not skip this even if children skip } - + public Object clone() throws CloneNotSupportedException { Spec spec = new Spec(); super.initClone(spec); - spec.suiteDir = suiteDir; + spec.suiteDir = suiteDir; return spec; } - + /** @param suiteDirPath the String path to the base suite dir */ public void setSuiteDir(String suiteDirPath) { if (!LangUtil.isEmpty(suiteDirPath)) { this.suiteDir = new File(suiteDirPath); } } - + /** @param suiteDirFile the File for the base suite dir */ public void setSuiteDirFile(File suiteDir) { this.suiteDir = suiteDir; } - + /** @return suiteDir from any set or source location if set */ public File getSuiteDirFile() { if (null == suiteDir) { @@ -569,13 +569,13 @@ public class AjcTest extends RunSpecIterator { } return suiteDir; } - + /** * @return * @see org.aspectj.testing.harness.bridge.AbstractRunSpec#makeRunIterator(Sandbox, Validator) */ public IRunIterator makeRunIterator( - Sandbox sandbox, + Sandbox sandbox, Validator validator) { return new Suite(this, sandbox, validator); } @@ -583,9 +583,9 @@ public class AjcTest extends RunSpecIterator { public String toString() { // removed nKids as misleading, since children.size() may change //int nKids = children.size(); - //return "Suite.Spec(" + suiteDir + ", " + nKids + " tests)"; - return "Suite.Spec(" + suiteDir + ")"; + //return "Suite.Spec(" + suiteDir + ", " + nKids + " tests)"; + return "Suite.Spec(" + suiteDir + ")"; } - } - } + } + } } diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRun.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRun.java index d85384a8a..8241e3947 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRun.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRun.java @@ -1,14 +1,14 @@ /* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC), * 2003 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://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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * Wes Isberg 2003 updates * ******************************************************************/ @@ -67,13 +67,13 @@ import org.aspectj.util.LangUtil; * <li>Paths are resolved absolutely, which fails to test the * compiler's ability to find files relative to a source base</li> * <li>This does not enforce the lifecycle.</li> - * <li>This must be used as the initial compile + * <li>This must be used as the initial compile * before doing an incremental compile. * In that case, staging must be enabled.</li> * </ul> */ public class CompilerRun implements IAjcRun { - // static final String JAVAC_COMPILER + // static final String JAVAC_COMPILER // = JavacCompileCommand.class.getName(); static final String[] RA_String = new String[0]; @@ -90,21 +90,21 @@ public class CompilerRun implements IAjcRun { /** get shared stuff during setup */ Sandbox sandbox; - /** + /** * During run, these String are passed as the source and arg files to compile. * The list is set up in setupAjcRun(..), when arg files are prefixed with "@". */ final List /*String*/ arguments; - /** + /** * During run, these String are collapsed and passed as the injar option. * The list is set up in setupAjcRun(..). */ final List /*String*/ injars; - /** + /** * During run, these String are collapsed and passed as the inpath option. * The list is set up in setupAjcRun(..), * which extracts only directories from the files attribute. @@ -120,7 +120,7 @@ public class CompilerRun implements IAjcRun { injars = new ArrayList(); inpaths = new ArrayList(); } - + /** * Select from input String[] if readable directories @@ -144,7 +144,7 @@ public class CompilerRun implements IAjcRun { } return (String[]) result.toArray(new String[0]); } - + /** * Select from input String[] based on suffix-matching * @param inputs String[] of input - null ignored @@ -158,7 +158,7 @@ public class CompilerRun implements IAjcRun { } if (ignoreCase) { String[] temp = new String[suffixes.length]; - for (int i = 0; i < temp.length; i++) { + for (int i = 0; i < temp.length; i++) { String suff = suffixes[i]; temp[i] = (null == suff ? null : suff.toLowerCase()); } @@ -186,7 +186,7 @@ public class CompilerRun implements IAjcRun { return (String[]) result.toArray(new String[0]); } - /** + /** * This checks that the spec is reasonable and does setup: * <ul> * <li>calculate and set sandbox testBaseSrcDir as {Sandbox.testBaseDir}/ @@ -198,7 +198,7 @@ public class CompilerRun implements IAjcRun { * <li>get the list of aspectpath entries to use as the aspectpath as * {Sandbox. testBaseSrcDir} / {Spec.aspectpath..}</li> * </ul> - * All sources must be readable at this time, + * All sources must be readable at this time, * unless spec.badInput is true (for invalid-input tests). * If staging, the source files and source roots are copied * to a separate staging directory so they can be modified @@ -262,7 +262,7 @@ public class CompilerRun implements IAjcRun { } } } - + // validate readable for sources if (!spec.badInput) { if (!validator.canRead(testBaseSrcDir, srcPaths, "sources") @@ -282,7 +282,7 @@ public class CompilerRun implements IAjcRun { || !validator.canRead( testBaseSrcDir, spec.sourceroots, - "sourceroots") + "sourceroots") || !validator.canRead( testBaseSrcDir, spec.extdirs, @@ -334,7 +334,7 @@ public class CompilerRun implements IAjcRun { || !validator.canRead(injarFiles, "injars")) { return false; } - + // hmm - duplicates validation above, verifying getBaseDirFiles? if (!spec.badInput) { if (!validator.canRead(argFiles, "argFiles") @@ -433,7 +433,7 @@ public class CompilerRun implements IAjcRun { return false; } arguments.clear(); - + if (!LangUtil.isEmpty(xlintFiles)) { arguments.add("-Xlintfile"); String sr = FileUtil.flatten(xlintFiles, null); @@ -500,11 +500,11 @@ public class CompilerRun implements IAjcRun { * <li>heed any globals interpreted into a TestSetup by reading * {@link Spec@getOptions()}. For a list of supported globals, see * {@link setupArgs(ArrayList, IMessageHandler}.</li> - * <li>construct a command line, using as classpath + * <li>construct a command line, using as classpath * {@link Sandbox.classpathToString()}<li> * <li>construct a compiler using {@link Spec#compiler} * or any overriding value set in TestSetup.<li> - * <li>Just before running, set the compiler in the sandbox using + * <li>Just before running, set the compiler in the sandbox using * {@link Sandbox.setCompiler(ICommand)}.<li> * <li>After running, report AjcMessageHandler results to the status parameter. * If the AjcMessageHandler reports a failure, then send info messages @@ -583,7 +583,7 @@ public class CompilerRun implements IAjcRun { // add both java/aspectj and argfiles argList.addAll(arguments); - // XXX hack - seek on request as a side effect. reimplement as listener + // XXX hack - seek on request as a side effect. reimplement as listener if (null != setupResult.seek) { String slopPrefix = Spec.SEEK_MESSAGE_PREFIX + " slop - "; PrintStream slop = @@ -627,7 +627,7 @@ public class CompilerRun implements IAjcRun { status, "aborted, but compiler valid?: " + compiler); } else { - // same DirChanges handling for JavaRun, CompilerRun, IncCompilerRun + // same DirChanges handling for JavaRun, CompilerRun, IncCompilerRun // XXX around advice or template method/class if (!LangUtil.isEmpty(spec.dirChanges)) { LangUtil.throwIaxIfFalse( @@ -682,7 +682,7 @@ public class CompilerRun implements IAjcRun { return "CompilerRun(" + spec + ")"; } - /** + /** * Initializer/factory for CompilerRun * any path or file is relative to this test base dir */ @@ -697,7 +697,7 @@ public class CompilerRun implements IAjcRun { /** * Retitle description to title, paths to files, do comment, * staging, badInput, - * do dirChanges, and print no chidren. + * do dirChanges, and print no chidren. */ private static final AbstractRunSpec.XMLNames NAMES = new AbstractRunSpec.XMLNames( @@ -716,8 +716,8 @@ public class CompilerRun implements IAjcRun { /** * If the source version warrants, add a -bootclasspath - * entry to the list of arguments to add. - * This will fail and return an error String if the + * entry to the list of arguments to add. + * This will fail and return an error String if the * required library is not found. * @param sourceVersion the String (if any) describing the -source option * (expecting one of [null, "1.3", "1.4", "1.5"]. @@ -900,7 +900,7 @@ public class CompilerRun implements IAjcRun { } } - /** + /** * Set source roots, deleting any old ones * @param files comma-delimited list of directories * - ignored if null or empty @@ -913,12 +913,12 @@ public class CompilerRun implements IAjcRun { public void setXlintfile(String path) { xlintfile = path; } - + public void setOutjar(String path) { outjar = path; } - /** + /** * Set extension dirs, deleting any old ones * @param files comma-delimited list of directories * - ignored if null or empty @@ -929,7 +929,7 @@ public class CompilerRun implements IAjcRun { } } - /** + /** * Set aspectpath, deleting any old ones * @param files comma-delimited list of aspect jars - ignored if null or * empty @@ -940,7 +940,7 @@ public class CompilerRun implements IAjcRun { } } - /** + /** * Set argfiles, deleting any old ones * @param files comma-delimited list of argfiles - ignored if null or empty */ @@ -958,7 +958,7 @@ public class CompilerRun implements IAjcRun { } return (String[]) copy(argfiles); } - + /** * Make a copy of the array. * @return an array with the same component type as source @@ -966,7 +966,7 @@ public class CompilerRun implements IAjcRun { * @throws IllegalArgumentException if source is null */ public static final Object[] copy(Object[] source) { - LangUtil.throwIaxIfNull(source, "source"); + LangUtil.throwIaxIfNull(source, "source"); final Class c = source.getClass().getComponentType(); Object[] result = (Object[]) Array.newInstance(c, source.length); System.arraycopy(source, 0, result, 0, result.length); @@ -1029,7 +1029,7 @@ public class CompilerRun implements IAjcRun { return "CompilerRun.Spec " + getShortCompilerName(); } - /** + /** * Each non-incremental run, fold the global flags in with * the run flags, which may involve adding or removing from * either list, depending on the flag prefix: @@ -1040,7 +1040,7 @@ public class CompilerRun implements IAjcRun { * </ul> * If there is a force conflict, then the test is skipped * ("skipping" info message, TestSetup.result is false). - * This means an option local to the test which was specified + * This means an option local to the test which was specified * without forcing may be overridden by a globally-forced option. * <p> * There are some flags which are interpreted by the test @@ -1068,19 +1068,19 @@ public class CompilerRun implements IAjcRun { * <li>eclipse does not do -lenient, -strict, -usejavac, -preprocess, * -XOcodeSize, -XSerializable, XaddSafePrefix, * -XserializableAspects,-XtargetNearSource</li> - * <li>ajc does not run in incremental (staging) mode, + * <li>ajc does not run in incremental (staging) mode, * nor with -usejavac if javac is not on the classpath</li> * </ul> * <u>Errors</u>:This will remove an arg not prefixed by [-|!|^] after * providing an info message. - * <u>TestSetup Result</u>: + * <u>TestSetup Result</u>: * If this completes successfully, then TestSetup.result is true, * and commandOptions is not null, and any test flags (ignore warning, * compiler) are reflected in the TestSetup. * If this fails, then TestSetup.result is false, - * and a TestSetup.failreason is set. - * This means the test is skipped. - * @return TestSetup with results + * and a TestSetup.failreason is set. + * This means the test is skipped. + * @return TestSetup with results * (TestSetup result=false if the run should not continue) */ protected TestSetup setupArgs(IMessageHandler handler) { @@ -1122,7 +1122,7 @@ public class CompilerRun implements IAjcRun { getFamily = CRSOPTIONS.ajccompilerOption.getFamily(); Option.Value compiler = values.firstInFamily(getFamily); if (null != compiler) { - result.compilerName + result.compilerName = CRSOPTIONS.compilerClassName(compiler.option); if (null == result.compilerName) { result.failureReason = @@ -1213,7 +1213,7 @@ public class CompilerRun implements IAjcRun { * This skips: * - old 1.0 options, including lenient v. strict * - old ajc options, include !incremental and usejavac w/o javac - * - invalid eclipse options (mostly ajc) + * - invalid eclipse options (mostly ajc) * @param compilerName the String name of the target compiler * @return a String describing any conflicts, or null if none */ @@ -1222,7 +1222,7 @@ public class CompilerRun implements IAjcRun { || ReflectionFactory.OLD_AJC.equals(compilerName) || CRSOptions.AJDE_COMPILER.equals(compilerName) || CRSOptions.AJCTASK_COMPILER.equals(compilerName) - || permitAnyCompiler + || permitAnyCompiler ))) { //|| BUILDER_COMPILER.equals(compilerName)) result.failureReason = @@ -1254,7 +1254,7 @@ public class CompilerRun implements IAjcRun { final Options options = CRSOPTIONS.getOptions(); try { String[] input = getOptionsArray(); - // this handles reading options, + // this handles reading options, // flattening two-String options, etc. localValues = options.acceptInput(input); // all local values should be picked up @@ -1416,11 +1416,11 @@ public class CompilerRun implements IAjcRun { return -1; } - /** + /** * 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) { out.startElement(xmlElementName, false); @@ -1469,7 +1469,7 @@ public class CompilerRun implements IAjcRun { out.endElement(xmlElementName); } - /** + /** * Encapsulate the directives that can be set using * global arguments supplied in {@link Spec.getOptions()}. * This supports changing the compiler and ignoring warnings. @@ -1477,7 +1477,7 @@ public class CompilerRun implements IAjcRun { class TestSetup { /** null unless overriding the compiler to be used */ String compilerName; - /** + /** * true if we should tell AjcMessageHandler whether * to ignore warnings in its result evaluation */ @@ -1543,27 +1543,27 @@ public class CompilerRun implements IAjcRun { * like classpath, aspectpath, files, etc. which are set * using other fields in the test specification, so the options * permitted are a subset of those permitted on the command-line. - * + * * Global options specified on the harness command-line are * adopted for the compiler command-line if they are permitted * in the options field. That means we have to detect each * permitted option, rather than just letting all through * for the compiler. - * + * * Conversely, some options are targeted not at the compiler, - * but at the test itself (e.g., to ignore warnings, or to + * but at the test itself (e.g., to ignore warnings, or to * select a compiler. - * + * * The harness can run many compilers, and they differ in * which options are permitted. You can specify a compiler * as an option (e.g., -eclipse). So the set of constraints * on the list of permitted options can differ from test to test. - * + * * The following code sets up the lists of permitted options * and breaks out subsets for different compiler-variant checks. * Most options are created but not named, but some options - * are named to detect corresponding values for further - * processing. e.g., the compiler options are saved so + * are named to detect corresponding values for further + * processing. e.g., the compiler options are saved so * we can do per-compiler option verification. * */ @@ -1588,7 +1588,7 @@ public class CompilerRun implements IAjcRun { private CRSOptions() { crsOptions = new Options(true); Option.Factory factory = new Option.Factory("CompilerRun"); - // compiler options go in map + // compiler options go in map eclipseOption = factory.create( "eclipse", @@ -1760,7 +1760,7 @@ public class CompilerRun implements IAjcRun { factory.create("XnotReweavable"), factory.create("XserializableAspects") }; - + // among options not permitted: extdirs... for (Option option : options) { @@ -1779,8 +1779,8 @@ public class CompilerRun implements IAjcRun { Options getOptions() { return crsOptions; } - - /** + + /** * @return unmodifiable Set of options sharing the * family "compiler". */ @@ -1846,4 +1846,4 @@ public class CompilerRun implements IAjcRun { } } // CompilerRun.Spec.CRSOptions } // CompilerRun.Spec -} // CompilerRun
\ No newline at end of file +} // CompilerRun diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunSpecTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunSpecTest.java index 7e73a9233..419740329 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunSpecTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunSpecTest.java @@ -1,14 +1,14 @@ /* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC), * 2003 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://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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * Wes Isberg 2003 modifications * ******************************************************************/ @@ -28,7 +28,7 @@ import org.aspectj.util.LangUtil; import junit.framework.TestCase; /** - * + * */ public class CompilerRunSpecTest extends TestCase { @@ -265,7 +265,7 @@ public class CompilerRunSpecTest extends TestCase { OptionChecker optionChecker = new OptionChecker(options); // known failures: extdirs, aspectpath, Xlintfile <file> // progress, time, noExit, repeat <n>, - // help, + // help, String[][] input = new String[][] { new String[] { "-verbose" }, @@ -351,7 +351,7 @@ public class CompilerRunSpecTest extends TestCase { resultContains, messagesContain); } - + /** * Drive option-setting for CompilerRun.Spec, including * expected errors. @@ -558,7 +558,7 @@ public class CompilerRunSpecTest extends TestCase { assertTrue(result, ("[]").equals(result)); // undefined whether global set overrides local set - // for different sibling options + // for different sibling options } finally { if (PRINTING && (0 < handler.numMessages(null, true))) { MessageUtil.print(System.err, handler, "checkSetupArgs: "); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunTest.java index 9de7642bb..ca361f600 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/CompilerRunTest.java @@ -1,12 +1,12 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: * Wes Isberg initial implementation * ******************************************************************/ @@ -40,17 +40,17 @@ public class CompilerRunTest extends TestCase { private static void dummyRunning(String[] args) { dummyReports.add("run: " + Arrays.asList(args)); } - + // private static void dummyRepeating(String[] args) { // dummyReports.add("repeat: " + Arrays.asList(args)); // } private File testBaseDir; - + public CompilerRunTest(String name) { super(name); } - + public void setUp() { testBaseDir = new File("../testing/temp-CompilerRunTest"); File f = new File(testBaseDir, "one"); @@ -65,24 +65,24 @@ public class CompilerRunTest extends TestCase { assertTrue(err, null == err); assertTrue(f.canRead()); } - + public void tearDown() { FileUtil.deleteContents(testBaseDir); testBaseDir.delete(); testBaseDir = null; } - + public void testExtDirs() { // String[] globals = null; CompilerRun.Spec spec = new CompilerRun.Spec(); - spec.setExtdirs("one,two"); + spec.setExtdirs("one,two"); spec.setFiles("Foo.java"); checkCommandLine(testBaseDir, spec, null, "-extdirs"); } - void checkCommandLine( + void checkCommandLine( File testBaseDir, - CompilerRun.Spec spec, + CompilerRun.Spec spec, String[] globals, String expectedInCommand) { assertTrue(0 == dummyReports.size()); @@ -90,12 +90,12 @@ public class CompilerRunTest extends TestCase { assertTrue(dummyReports.toString(), 1 == dummyReports.size()); String command = (String) dummyReports.remove(0); assertTrue(0 == dummyReports.size()); - if ((null == command) + if ((null == command) || (!command.contains(expectedInCommand))) { - assertTrue("expected " - + expectedInCommand + assertTrue("expected " + + expectedInCommand + "got " - + command, + + command, false); } } @@ -103,7 +103,7 @@ public class CompilerRunTest extends TestCase { /** run with dummy compiler */ boolean checkCompilerRun( File testBaseDir, - CompilerRun.Spec spec, + CompilerRun.Spec spec, String[] globals, MessageHandler handler) { LangUtil.throwIaxIfNull(spec, "spec"); @@ -135,7 +135,7 @@ public class CompilerRunTest extends TestCase { } return run(testBaseDir, spec); } - + /** Run the compiler run specified by the spec */ protected boolean run(File testBaseDir, CompilerRun.Spec spec) { @@ -164,14 +164,14 @@ public class CompilerRunTest extends TestCase { validator.deleteTempFiles(true); } } - - + + public static class DummyCompiler implements ICommand { private String[] command; - + public DummyCompiler() { } - + public boolean runCommand( String[] args, IMessageHandler handler) { @@ -179,7 +179,7 @@ public class CompilerRunTest extends TestCase { CompilerRunTest.dummyRunning(command); return true; } - + public boolean repeatCommand(IMessageHandler handler) { CompilerRunTest.dummyRunning(command); return true; diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChanges.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChanges.java index 603373381..7264e2dfb 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChanges.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChanges.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChangesTest.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChangesTest.java index dc3ccec07..07e6a5036 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChangesTest.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/DirChangesTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; @@ -34,10 +34,10 @@ import junit.framework.TestCase; */ public class DirChangesTest extends TestCase { private static final boolean PRINTING = false; - + /** name of file in srcBaseDir with any expected messages */ public static final String EXPECTED_NAME = "expectedMessages.xml"; - + public DirChangesTest(String name) { super(name); } @@ -46,14 +46,14 @@ public class DirChangesTest extends TestCase { * then just iterate over directories in dirChangesTestDir */ - /** - * Uses testdata/dirChangesTestDir/same + /** + * Uses testdata/dirChangesTestDir/same */ public void skip_testSameExpDir() { doCheck("same"); } public void testNothingForAntJUnit() {} - /** + /** * Uses testdata/dirChangesTestDir/diff */ public void skip_testDiffExpDir() { @@ -63,25 +63,25 @@ public class DirChangesTest extends TestCase { public void skip_testWriteEmpty() { DirChanges.Spec spec = new DirChanges.Spec(); String expected = ""; - checkWrite(spec, expected); + checkWrite(spec, expected); } public void skip_testWriteExpDir() { DirChanges.Spec spec = new DirChanges.Spec(); spec.setExpDir("expected directory"); - String expected = - "<dir-changes expDir=\"expected directory\"/>" + String expected = + "<dir-changes expDir=\"expected directory\"/>" + LangUtil.EOL; - checkWrite(spec, expected); + checkWrite(spec, expected); } public void skip_testWriteAdded() { DirChanges.Spec spec = new DirChanges.Spec(); spec.setAdded("one,two,three"); - String expected = - "<dir-changes added=\"one,two,three\"/>" + String expected = + "<dir-changes added=\"one,two,three\"/>" + LangUtil.EOL; - checkWrite(spec, expected); + checkWrite(spec, expected); } /** write spec to XML and compare with expected */ @@ -91,7 +91,7 @@ public class DirChangesTest extends TestCase { spec.writeXml(writer); assertEquals(expected, actual.toString()); } - + private void doCheck(String dir) { DirChanges.Spec spec = new DirChanges.Spec(); File srcBaseDir = new File("testdata/dirChangesTestDir/" + dir); @@ -114,7 +114,7 @@ public class DirChangesTest extends TestCase { // XXX WEAK upgrade to read expected-diffs from file in directory private void checkDirChanges( - DirChanges.Spec spec, + DirChanges.Spec spec, File baseDir, File srcBaseDir, Runnable dirChanger, @@ -207,7 +207,7 @@ public class DirChangesTest extends TestCase { * Find message in array, comparing by contents * but ignoring exceptions thrown and source location XXX. * @param message the IMessage to find - * @param expected the + * @param expected the * @return int */ private int find(IMessage message, IMessage[] expected) { diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java index 696d491a5..0b9d6910e 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/FlatSuiteReader.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; @@ -34,8 +34,8 @@ import org.aspectj.testing.util.UtilLineReader; import org.aspectj.util.FileUtil; import org.aspectj.util.LangUtil; -/** - * SFileReader.Maker implementation to read tests +/** + * SFileReader.Maker implementation to read tests * XXX supports iterative but not yet incremental compiles */ public class FlatSuiteReader implements SFileReader.Maker { @@ -57,7 +57,7 @@ public class FlatSuiteReader implements SFileReader.Maker { /** if true, clean up records before returning from make */ public boolean clean; - + private FlatSuiteReader() { } @@ -71,7 +71,7 @@ public class FlatSuiteReader implements SFileReader.Maker { /** * This constructs an AjcTest.Spec assuming we are at the start of a * test definition in reader and taking the parent directory of - * the reader as the base directory for the test suite root. + * the reader as the base directory for the test suite root. * @return the next AjcTest in reader, or null * @see org.aspectj.testing.harness.bridge.SFileReader.Maker#make(UtilLineReader) */ @@ -223,8 +223,8 @@ public class FlatSuiteReader implements SFileReader.Maker { } return result; } - - /** post-process result + + /** post-process result * - use file name as keyword * - clip / for dir offsets * - extract purejava keyword variants @@ -271,7 +271,7 @@ public class FlatSuiteReader implements SFileReader.Maker { } catch (NumberFormatException e) { throw new Error("unable to convert " + pr + " for " + result + " at " + lineReader); - } + } } input = description.toString(); String error = null; @@ -288,7 +288,7 @@ public class FlatSuiteReader implements SFileReader.Maker { throw new Error(error + " in " + input + " at " + lineReader); } result.description = input; - + ArrayList<String> newOptions = new ArrayList<>(); Iterable<String> optionsCopy = result.getOptionsList(); for (String option: optionsCopy) { @@ -300,7 +300,7 @@ public class FlatSuiteReader implements SFileReader.Maker { } result.setOptionsArray((String[]) newOptions.toArray(new String[0])); } - + private boolean strip(StringBuffer sb, String infix) { String input = sb.toString(); int loc = input.indexOf(infix); @@ -341,11 +341,11 @@ public class FlatSuiteReader implements SFileReader.Maker { return (0 == result.size() ? Collections.<Message>emptyList() : result); } - /** + /** * Read suite spec from a flat .txt file. * @throws AbortException on failure * @return AjcTest.Suite.Spec with any AjcTest.Spec as children - */ + */ public AjcTest.Suite.Spec readSuite(File suiteFile) { LangUtil.throwIaxIfNull(suiteFile, "suiteFile"); if (!suiteFile.isAbsolute()) { @@ -370,7 +370,7 @@ public class FlatSuiteReader implements SFileReader.Maker { IMessage m = MessageUtil.fail("reading " + suiteFile, e); throw new AbortException(m); } - + return result; } } diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/Globals.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/Globals.java index 22e52ec61..1d1602405 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/Globals.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/Globals.java @@ -1,15 +1,15 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC) * 2003 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://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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * Wes Isberg removed unused globals. * ******************************************************************/ @@ -29,7 +29,7 @@ public class Globals { /** map from String version to String class implemented in that version or later */ private static final Map VM_CLASSES; - + public static final String FORK_NAME = "harness.fork"; // XXX in testing-drivers/../package.htm /** name/key of the System property to set to define library dir */ @@ -76,7 +76,7 @@ public class Globals { map.put("1.3", "java.lang.reflect.Proxy"); map.put("1.4", "java.nio.Buffer"); map.put("1.5", "java.lang.annotation.Annotation"); - + VM_CLASSES = Collections.unmodifiableMap(map); } @@ -93,7 +93,7 @@ public class Globals { rtjar = file; } else if (file.isDirectory()) { path = file.getAbsolutePath() + "/jre/lib/rt.jar"; - rtjar = new File(path); + rtjar = new File(path); } if (rtjar.canRead() && rtjar.isFile()) { j2seJar = rtjar; @@ -110,8 +110,8 @@ public class Globals { } /** - * - * @return null if not found, or + * + * @return null if not found, or * String with class path for compiler to load J2SE 1.4 classes from. */ public static String get14Bootclasspath() { @@ -137,12 +137,12 @@ public class Globals { } return result; } - + /** * Detect whether Java version is supported. * @param version String "1.2" or "1.3" or "1.4" - * @return true if the currently-running VM supports the version + * @return true if the currently-running VM supports the version * @throws IllegalArgumentException if version is not known */ public static final boolean supportsJava(String version) { @@ -156,7 +156,7 @@ public class Globals { return true; } catch (Throwable t) { return false; - } + } } } diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/IAjcRun.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/IAjcRun.java index a7a44a75c..6f2a523b3 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/IAjcRun.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/IAjcRun.java @@ -2,9 +2,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/IRunSpec.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/IRunSpec.java index dc35b493d..e7f741a81 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/IRunSpec.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/IRunSpec.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; 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 8ec74ea0b..4921254bf 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 @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java index acc3245ca..93ca14e70 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java @@ -2,9 +2,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/ParseTestCase.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/ParseTestCase.java index b557da6a6..85cdd38f1 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/ParseTestCase.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/ParseTestCase.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: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; @@ -44,9 +44,9 @@ public class ParseTestCase extends TestCase { public ParseTestCase(String name) { super(name); } - + public void testNothingBecauseOthersSkipped() {} - + public void skiptestParse() throws Exception { // XXX failing b/c of iteration Runner runner = new Runner(); IMessageHolder handler = new MessageHandler(); @@ -54,8 +54,8 @@ public class ParseTestCase extends TestCase { Validator validator = new Validator(handler); final File suiteFile = new File("../testing/testdata/suite.xml"); List tests = parseSuite(suiteFile); - Sandbox sandbox = new Sandbox(new File("testdata"), validator); - IRunListener listenerNULL = null; + Sandbox sandbox = new Sandbox(new File("testdata"), validator); + IRunListener listenerNULL = null; ISourceLocation sl = new SourceLocation(suiteFile, 0, 0,0); for (Object o : tests) { status = new RunStatus(handler, runner); @@ -76,22 +76,22 @@ public class ParseTestCase extends TestCase { factory.setValidating(true); factory.setIgnoringElementContentWhitespace(true); factory.setIgnoringComments(true); - + DocumentBuilder builder = factory.newDocumentBuilder(); System.out.println(file.getAbsoluteFile()); Document doc = builder.parse(file); dump(doc.getDocumentElement(), 0); - + List ret = new ArrayList(); Node suiteNode = doc.getDocumentElement(); - + NodeList children = suiteNode.getChildNodes(); for (int i=0; i < children.getLength(); i++) { ret.add(parseTest(children.item(i))); } - + return ret; } @@ -99,7 +99,7 @@ public class ParseTestCase extends TestCase { String title = getAttributeString(node, "title"); String pr = getAttributeString(node, "pr"); String dir = getAttributeString(node, "dir"); - + ISourceLocation sourceLocation = new SourceLocation(new File("Missing"), 0, 0, 0); AjcTest.Spec test = new AjcTest.Spec(); @@ -108,17 +108,17 @@ public class ParseTestCase extends TestCase { test.setBugId(Integer.valueOf(pr)); test.setSourceLocation(sourceLocation); //AjcTest test = new AjcTest(title, dir, pr, sourceLocation); - + System.out.println(test); - + // List ret = new ArrayList(); - + NodeList children = node.getChildNodes(); for (int i=0; i < children.getLength(); i++) { test.addChild(parseIRun(test, children.item(i), dir)); // test.addRunSpec(parseIRun(test, children.item(i), dir)); } - + return test; } @@ -132,7 +132,7 @@ public class ParseTestCase extends TestCase { spec.addOptions((String[]) args.toArray(new String[0])); spec.addPaths((String[]) args.toArray(new String[0])); spec.addMessages(expectedMessages); - spec.testSrcDirOffset = null; // baseDir; + spec.testSrcDirOffset = null; // baseDir; return spec; } else if (kind.equals("run")) { JavaRun.Spec spec = new JavaRun.Spec(); @@ -141,13 +141,13 @@ public class ParseTestCase extends TestCase { /*JavaRun run = */new JavaRun(spec); return spec; } - + return null; } private List parseChildrenMessages(Node node) { List ret = new ArrayList(); - + NodeList children = node.getChildNodes(); for (int i=0; i < children.getLength(); i++) { Node child = children.item(i); @@ -171,13 +171,13 @@ public class ParseTestCase extends TestCase { if (filename != null) { file = new File(filename); } else { - file = new File("XXX"); //XXX + file = new File("XXX"); //XXX } - + int line = Integer.valueOf(getAttributeString(child, "line")); - + ISourceLocation sourceLocation = new SourceLocation(file, line, line, 0); - + return new Message("", kind, null, sourceLocation); } @@ -185,7 +185,7 @@ public class ParseTestCase extends TestCase { private List parseChildrenStrings(Node node, String kind) { List ret = new ArrayList(); - + NodeList children = node.getChildNodes(); for (int i=0; i < children.getLength(); i++) { Node child = children.item(i); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/RunSpecIterator.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/RunSpecIterator.java index e5792236b..fa114beca 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/RunSpecIterator.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/RunSpecIterator.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; @@ -25,11 +25,11 @@ import org.aspectj.testing.run.WrappedRunIterator; import org.aspectj.util.LangUtil; -/** +/** * This wraps an AbstractRunSpec, which has children that - * return IRunIterator, the results of which we return - * from nextRun(..) - * We extract global options from the AbstractRunSpec options + * return IRunIterator, the results of which we return + * from nextRun(..) + * We extract global options from the AbstractRunSpec options * and set the global options in the AbstractRunSpec, * which is responsible for setting them in any children * during makeRun(..). @@ -43,25 +43,25 @@ public class RunSpecIterator implements IRunIterator { * This returns all the run provided by that child iterator * before going to the next child. */ - + /** spec for this test */ public final AbstractRunSpec spec; // XXX reconsider public after debugging - - /** current sandbox by default shared by all children */ + + /** current sandbox by default shared by all children */ Sandbox sandbox; - + /** keep our copy to avoid recopying */ ArrayList childSpecs; - + /** index into child specs of next run */ int specIndex; - + /** child creation until the start of each run */ final Validator validator; - + /** current child iterator */ IRunIterator childIterator; - + final boolean haltOnFailure; private int numIncomplete; @@ -69,7 +69,7 @@ public class RunSpecIterator implements IRunIterator { private final IMessage.Kind failureKind; // private boolean didCleanup; - + /** * Create a RunSpecIterator. * Failure messages are of type IMessage.ABORT if abortOnFailure is true, @@ -79,14 +79,14 @@ public class RunSpecIterator implements IRunIterator { * @param haltOnFailure if true, stop after any failure in providing runs */ public RunSpecIterator( - AbstractRunSpec spec, + AbstractRunSpec spec, Sandbox sandbox, - Validator validator, - boolean haltOnFailure) { - this(spec, sandbox, validator, haltOnFailure, + Validator validator, + boolean haltOnFailure) { + this(spec, sandbox, validator, haltOnFailure, (haltOnFailure ? IMessage.ABORT : IMessage.ERROR)); } - + /** * Create a RunSpecIterator, specifying any failure message kind. * @param spec the AbstractRunSpec whose children we iterate - not null @@ -95,11 +95,11 @@ public class RunSpecIterator implements IRunIterator { * @param failureKind the IMessage.Kind for any failure messages - if null, no messages sent */ public RunSpecIterator( - AbstractRunSpec spec, + AbstractRunSpec spec, Sandbox sandbox, - Validator validator, + Validator validator, boolean haltOnFailure, - IMessage.Kind failureKind) { + IMessage.Kind failureKind) { LangUtil.throwIaxIfNull(spec, "spec"); LangUtil.throwIaxIfNull(sandbox, "sandbox"); LangUtil.throwIaxIfNull(validator, "validator"); @@ -110,7 +110,7 @@ public class RunSpecIterator implements IRunIterator { this.failureKind = failureKind; reset(); } - + /** * @return value set on construction for abortOnError * @see org.aspectj.testing.run.IRunIterator#abortOnFailure() @@ -120,34 +120,34 @@ public class RunSpecIterator implements IRunIterator { } /** reset to start at the beginning of the child specs. */ - public void reset() { + public void reset() { specIndex = 0; childSpecs = spec.getWorkingChildren(); childIterator = null; numIncomplete = 0; } - + /** @return int number of child run attempts that did not produce IRun */ public int getNumIncomplete() { return numIncomplete; } - + /** * @see org.aspectj.testing.run.IRunIterator#hasNextRun() */ public boolean hasNextRun() { return ((specIndex < childSpecs.size()) - || ((null != childIterator) + || ((null != childIterator) && childIterator.hasNextRun())); } /** * Get the next child IRunIterator as an IRun. - * In case of failure to get the next child, + * In case of failure to get the next child, * numIncomplete is incremented, and - * a message of type failureKind is passed to the handler + * a message of type failureKind is passed to the handler * (if failureKind was defined in the contructor). - * @return next child IRunIterator wrapped as an IRun + * @return next child IRunIterator wrapped as an IRun */ public IRun nextRun(final IMessageHandler handler, Runner runner) { validator.pushHandler(handler); @@ -161,12 +161,12 @@ public class RunSpecIterator implements IRunIterator { childSpec = (IRunSpec) childSpecs.get(specIndex++); if (null == childSpec) { error = "unexpected - no more child specs at " + --specIndex; - } else { + } else { Sandbox sandbox = makeSandbox(childSpec, validator); if (null == sandbox) { error = "unable to make sandbox for \"" + childSpec + "\""; childIterator = null; - } else { + } else { IRunIterator iter = childSpec.makeRunIterator(sandbox, validator); if (null == iter) { // client should read reason why from validator @@ -220,18 +220,18 @@ public class RunSpecIterator implements IRunIterator { */ public void iterationCompleted() { } - + public String toString() { return "" + spec; //return "RunSpecIterator(" + specIndex + ", " + spec + ")" ; } - + /* * Subclasses may: * - set the sandbox on construction * - lazily set it on first use * - set it for each child - */ + */ /** * Create the sandbox used for each child. @@ -252,5 +252,5 @@ public class RunSpecIterator implements IRunIterator { LangUtil.throwIaxIfNull(sandbox, "sandbox"); this.sandbox = sandbox; } - + } diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/Sandbox.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/Sandbox.java index 5108444e1..02260853b 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/Sandbox.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/Sandbox.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: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.harness.bridge; @@ -32,9 +32,9 @@ import org.aspectj.util.LangUtil; * setup/cleanup operations (todo XXX). * <p> * AjcTest creates the Sandbox and initializes the final fields. - * To coordinate with each other, run components may set and get values, - * with the sources running first and the sinks second. - * To make the interactions clear + * To coordinate with each other, run components may set and get values, + * with the sources running first and the sinks second. + * To make the interactions clear * (and to avoid accidentally violating these semantics), * setters/getters for a coordinated property are constrained two ways: * <li>Both have an extra (typed) "caller" parameter which must not @@ -46,10 +46,10 @@ import org.aspectj.util.LangUtil; public class Sandbox { /** classes directory token for DirChanges.Spec */ public static final String RUN_DIR = "run"; - + /** run directory token for DirChanges.Spec */ public static final String CLASSES_DIR = "classes"; - + private static boolean canRead(File dir) { return ((null != dir) && dir.isDirectory() && dir.canRead()); } @@ -69,20 +69,20 @@ public class Sandbox { throw new IllegalArgumentException(label + " - " + dir); } } - + /** @throws IllegalStateException(message) if test */ private static void assertState(boolean test, String message) { if (!test) { throw new IllegalStateException(message); } } - - /** + + /** * The (read-only) base of the test sources (which may or may not * be the base of the java sources) */ public final File testBaseDir; - + /** the parent of a temporary workspace, probably includes some others */ public final File sandboxDir; @@ -94,17 +94,17 @@ public class Sandbox { /** a run dir (which will be ignored in non-forking runs) */ public final File runDir; - + /** staging directory for IAjcRun requiring files be copied, deleted, etc. */ public final File stagingDir; - - /** + + /** * This manages creation and deletion of temporary directories. - * We hold a reference so that our clients can signal whether + * We hold a reference so that our clients can signal whether * this should be deleted. */ - private final Validator validator; // XXX required after completing tests? - + private final Validator validator; // XXX required after completing tests? + /** original base of the original java sources, set by CompileRun.setup(..) */ private File testBaseSrcDir; @@ -112,24 +112,24 @@ public class Sandbox { private File[] compileClasspath; private String bootClasspath; - + /** aspectpath entries, set by CompileRun.setup(..) */ private File[] aspectpath; /** track whether classpath getter ran */ private boolean gotClasspath; - + /** command shared between runs using sandbox - i.e., compiler */ private ICommand command; /** track whether command getter ran */ private boolean gotCommand; - + /** cache results of rendering final fields */ private transient String toStringLeader; - + private transient boolean compilerRunInit; - + /** @throws IllegalArgumentException unless validator validates * testBaseDir as readable */ @@ -148,65 +148,65 @@ public class Sandbox { Sandbox.iaxWrite(sandboxDir, "sandboxDir"); // XXX not really iax workingDir = FileUtil.makeNewChildDir(sandboxDir, "workingDir"); - Sandbox.iaxWrite(workingDir, "workingDir"); + Sandbox.iaxWrite(workingDir, "workingDir"); classesDir = FileUtil.makeNewChildDir(sandboxDir, "classes"); - Sandbox.iaxWrite(classesDir, "classesDir"); + Sandbox.iaxWrite(classesDir, "classesDir"); runDir = FileUtil.makeNewChildDir(sandboxDir, "run"); - Sandbox.iaxWrite(runDir, "runDir"); + Sandbox.iaxWrite(runDir, "runDir"); stagingDir = FileUtil.makeNewChildDir(sandboxDir, "staging"); - Sandbox.iaxWrite(stagingDir, "stagingDir"); + Sandbox.iaxWrite(stagingDir, "stagingDir"); - validator.registerSandbox(this); + validator.registerSandbox(this); } private String getToStringLeader() { if (null == toStringLeader) { - toStringLeader = "Sandbox(" + sandboxDir.getName() - + ", " + testBaseSrcDir.getName(); + toStringLeader = "Sandbox(" + sandboxDir.getName() + + ", " + testBaseSrcDir.getName(); } return toStringLeader; } - + /** @return "Sandbox(sandbox, src, classes)" with names only */ public String toString() { return getToStringLeader() + ", " + classesDir.getName() + ")"; } - + /** @return "Sandbox(sandbox, src, classes)" with paths */ public String toLongString() { return getToStringLeader() + ", " + classesDir.getPath() + (null == command ? ", (null command)" : ", " + command) + ")"; } - + void setCommand(ICommand command, CompilerRun caller) { - LangUtil.throwIaxIfNull(caller, "caller"); - LangUtil.throwIaxIfNull(command, "command"); - LangUtil.throwIaxIfFalse(!gotCommand, "no command"); + LangUtil.throwIaxIfNull(caller, "caller"); + LangUtil.throwIaxIfNull(command, "command"); + LangUtil.throwIaxIfFalse(!gotCommand, "no command"); this.command = command; } - + /** When test is completed, clear the compiler to avoid memory leaks */ void clearCommand(AjcTest caller) { - LangUtil.throwIaxIfNull(caller, "caller"); + LangUtil.throwIaxIfNull(caller, "caller"); if (null != command) { // need to add ICommand.quit() if (command instanceof AjcTaskCompileCommand) { // XXX urk! ((AjcTaskCompileCommand) command).quit(); } command = null; } - // also try to clear sandbox/filesystem. + // also try to clear sandbox/filesystem. // If locked by suite, we can't. if (null != validator) { validator.deleteTempFiles(true); } } - -// /** + +// /** // * Populate the staging directory by copying any files in the -// * source directory ending with fromSuffix +// * source directory ending with fromSuffix // * to the staging directory, after renaming them with toSuffix. // * If the source file name starts with "delete", then the // * corresponding file in the staging directory is deleting. @@ -234,7 +234,7 @@ public class Sandbox { // } // MessageHandler compilerMessages = new MessageHandler(); // StringBuffer commandLine = new StringBuffer(); -// for (int i = 1; result && (i < 10); i++) { +// for (int i = 1; result && (i < 10); i++) { // String fromSuffix = "." + i + "0.java"; // // copy files, collecting as we go... // files.clear(); @@ -242,24 +242,24 @@ public class Sandbox { // break; // } // -// -// return (String[]) result.toArray(new String[0]); +// +// return (String[]) result.toArray(new String[0]); // } - + // XXX move to more general in FileUtil void reportClassDiffs( - final IMessageHandler handler, + final IMessageHandler handler, IncCompilerRun caller, long classesDirStartTime, String[] expectedSources) { LangUtil.throwIaxIfFalse(0 < classesDirStartTime, "0 >= " + classesDirStartTime); boolean acceptPrefixes = true; Diffs diffs = org.aspectj.testing.util.FileUtil.dirDiffs( - "classes", - classesDir, - classesDirStartTime, - ".class", - expectedSources, + "classes", + classesDir, + classesDirStartTime, + ".class", + expectedSources, acceptPrefixes); diffs.report(handler, IMessage.ERROR); } @@ -285,7 +285,7 @@ public class Sandbox { // } // } // } -// +// // // gather, normalize paths changed // final ArrayList changed = new ArrayList(); // FileFilter touchedCollector = new FileFilter() { @@ -301,28 +301,28 @@ public class Sandbox { // sources.remove(classPath); // } else { // changed.add(classPath); -// } +// } // } // } // return false; // } -// }; +// }; // classesDir.listFiles(touchedCollector); -// +// // // report any unexpected changes // Diffs diffs = new Diffs("classes", sources, changed, String.CASE_INSENSITIVE_ORDER); // diffs.report(handler, IMessage.ERROR); // } - + ICommand getCommand(CompilerRun caller) { LangUtil.throwIaxIfNull(caller, "caller"); - assertState(null != command, "command never set"); + assertState(null != command, "command never set"); return command; } ICommand getCommand(IncCompilerRun caller) { LangUtil.throwIaxIfNull(caller, "caller"); - assertState(null != command, "command never set"); + assertState(null != command, "command never set"); return command; } @@ -330,7 +330,7 @@ public class Sandbox { LangUtil.throwIaxIfNull(caller, "caller"); return testBaseSrcDir; } - + /** * Get the files with names (case-sensitive) * under the staging or test base directories. @@ -353,7 +353,7 @@ public class Sandbox { LangUtil.throwIaxIfNull(caller, "caller"); return testBaseSrcDir; } - + void defaultTestBaseSrcDir(JavaRun caller) { LangUtil.throwIaxIfNull(caller, "caller"); if (null != testBaseSrcDir) { @@ -361,7 +361,7 @@ public class Sandbox { } testBaseSrcDir = testBaseDir; } - + static boolean readableDir(File dir) { return ((null != dir) && dir.isDirectory() && dir.canRead()); } @@ -380,7 +380,7 @@ public class Sandbox { if ((null != classPath) && (0 < classPath.length)) { setClasspath(classPath, classpathReadable, caller); } - + setBootclasspath(bootclassPath, caller); compilerRunInit = true; } @@ -388,8 +388,8 @@ public class Sandbox { if (!compilerRunInit) { testBaseSrcDir = testBaseDir; // default to aspectjrt.jar? - compileClasspath = new File[0]; - + compileClasspath = new File[0]; + } } @@ -401,10 +401,10 @@ public class Sandbox { } testBaseSrcDir = dir; } - - /** + + /** * Set aspectpath. - * @param readable if true, then throw IllegalArgumentException if not readable + * @param readable if true, then throw IllegalArgumentException if not readable */ private void setAspectpath(File[] files, boolean readable, CompilerRun caller) { LangUtil.throwIaxIfNull(files, "files"); @@ -429,10 +429,10 @@ public class Sandbox { private void setBootclasspath(String bootClasspath, CompilerRun caller) { this.bootClasspath = bootClasspath; } - - /** + + /** * Set compile classpath. - * @param readable if true, then throw IllegalArgumentException if not readable + * @param readable if true, then throw IllegalArgumentException if not readable */ private void setClasspath(File[] files, boolean readable, CompilerRun caller) { LangUtil.throwIaxIfNull(files, "files"); @@ -449,7 +449,7 @@ public class Sandbox { } // /** -// * Get run classpath +// * Get run classpath // * @param caller unused except to restrict usage to non-null JavaRun. // * @throws IllegalStateException if compileClasspath was not set. // * @throws IllegalArgumentException if caller is null @@ -466,16 +466,16 @@ public class Sandbox { // } // return result; // } - - /** + + /** * Get directories for the run classpath by selecting them * from the compile classpath. * This ignores aspectpath since it may contain only jar files. - * @param readable if true, omit non-readable directories + * @param readable if true, omit non-readable directories */ File[] getClasspathDirectories( - boolean readable, - JavaRun caller, + boolean readable, + JavaRun caller, boolean includeOutput) { LangUtil.throwIaxIfNull(caller, "caller"); assertState(null != compileClasspath, "classpath not set"); @@ -486,17 +486,17 @@ public class Sandbox { result.add(f); } } - if (includeOutput && (null != classesDir) + if (includeOutput && (null != classesDir) && (!readable || classesDir.canRead())) { - result.add(classesDir); + result.add(classesDir); } return (File[]) result.toArray(new File[0]); } - /** + /** * Get the jars belonging on the run classpath, including classpath * and aspectpath entries. - * @param readable if true, omit non-readable directories + * @param readable if true, omit non-readable directories */ File[] getClasspathJars(boolean readable, JavaRun caller) { LangUtil.throwIaxIfNull(caller, "caller"); @@ -514,37 +514,37 @@ public class Sandbox { } return (File[]) result.toArray(new File[0]); } - + /** - * Get the list of aspect jars as a String. - * @return String of classpath entries delimited internally by File.pathSeparator + * Get the list of aspect jars as a String. + * @return String of classpath entries delimited internally by File.pathSeparator */ String aspectpathToString(CompilerRun caller) { LangUtil.throwIaxIfNull(caller, "caller"); return FileUtil.flatten(aspectpath, File.pathSeparator); } - - /** + + /** * Get the compile classpath as a String. - * @return String of classpath entries delimited internally by File.pathSeparator + * @return String of classpath entries delimited internally by File.pathSeparator */ String classpathToString(CompilerRun caller) { LangUtil.throwIaxIfNull(caller, "caller"); return FileUtil.flatten(compileClasspath, File.pathSeparator); } - - /** + + /** * Get the bootClasspath as a String. - * @return String of bootclasspath entries delimited internally by File.pathSeparator + * @return String of bootclasspath entries delimited internally by File.pathSeparator */ String getBootclasspath(CompilerRun caller) { LangUtil.throwIaxIfNull(caller, "caller"); return bootClasspath; } - /** + /** * Get the bootClasspath as a String. - * @return String of bootclasspath entries delimited internally by File.pathSeparator + * @return String of bootclasspath entries delimited internally by File.pathSeparator */ String getBootclasspath(JavaRun caller) { LangUtil.throwIaxIfNull(caller, "caller"); diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/Validator.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/Validator.java index 1bda6adda..194488cad 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/Validator.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/Validator.java @@ -2,9 +2,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/run/IRun.java b/testing/src/test/java/org/aspectj/testing/run/IRun.java index e09fcbb9d..e5d71f26a 100644 --- a/testing/src/test/java/org/aspectj/testing/run/IRun.java +++ b/testing/src/test/java/org/aspectj/testing/run/IRun.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/run/IRunIterator.java b/testing/src/test/java/org/aspectj/testing/run/IRunIterator.java index 5035b216f..a450f44eb 100644 --- a/testing/src/test/java/org/aspectj/testing/run/IRunIterator.java +++ b/testing/src/test/java/org/aspectj/testing/run/IRunIterator.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -27,36 +27,36 @@ import org.aspectj.bridge.IMessageHandler; */ public interface IRunIterator { - /** - * @return true if nextRun() would return something non-null - * @throws IllegalStateException if called after + /** + * @return true if nextRun() would return something non-null + * @throws IllegalStateException if called after * <code>iterationCompleted()</code> */ boolean hasNextRun(); - + /** * Get the next run. * IRunIterator which contains child IRunIterator may either return * the children IRun or wrap them using * Runner.wrap(IRunIterator, IRunListener) * @param handler the IMessageHandler to use for error and other messages - * @param runnere the Runner to use to wrap any nested IRunIterator as IRun. + * @param runnere the Runner to use to wrap any nested IRunIterator as IRun. * @return the next run, or null if there are no more. - * @throws IllegalStateException if called after + * @throws IllegalStateException if called after * <code>iterationCompleted()</code> * @see Runner#wrap(IRunIterator, IRunListener) */ IRun nextRun(IMessageHandler handler, Runner runner); - + /** * Signal a runner that further runs should be aborted. Runners * should check this after each failure. * @return true if the runner should stop iterating when an IRun fails - * @throws IllegalStateException if called after + * @throws IllegalStateException if called after * <code>iterationCompleted()</code> */ boolean abortOnFailure(); // XXX supply IRun or IRunStatus? - + /** called when hasNextRun() and nextRun() will no longer be called */ void iterationCompleted(); } diff --git a/testing/src/test/java/org/aspectj/testing/run/IRunListener.java b/testing/src/test/java/org/aspectj/testing/run/IRunListener.java index 4318d618f..d6822fb4e 100644 --- a/testing/src/test/java/org/aspectj/testing/run/IRunListener.java +++ b/testing/src/test/java/org/aspectj/testing/run/IRunListener.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ diff --git a/testing/src/test/java/org/aspectj/testing/run/IRunStatus.java b/testing/src/test/java/org/aspectj/testing/run/IRunStatus.java index 652c1a802..80f5ebd58 100644 --- a/testing/src/test/java/org/aspectj/testing/run/IRunStatus.java +++ b/testing/src/test/java/org/aspectj/testing/run/IRunStatus.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/run/IRunValidator.java b/testing/src/test/java/org/aspectj/testing/run/IRunValidator.java index a341aa167..05175f17c 100644 --- a/testing/src/test/java/org/aspectj/testing/run/IRunValidator.java +++ b/testing/src/test/java/org/aspectj/testing/run/IRunValidator.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -21,7 +21,7 @@ package org.aspectj.testing.run; public interface IRunValidator { /** * Evaluate whether a run has passed. - * @param run the IRunStatus to see if it passed. + * @param run the IRunStatus to see if it passed. * @return true if run has passed */ boolean runPassed(IRunStatus run); diff --git a/testing/src/test/java/org/aspectj/testing/run/RunIterator.java b/testing/src/test/java/org/aspectj/testing/run/RunIterator.java index 1b5c8f307..732a8ebd7 100644 --- a/testing/src/test/java/org/aspectj/testing/run/RunIterator.java +++ b/testing/src/test/java/org/aspectj/testing/run/RunIterator.java @@ -1,17 +1,17 @@ /* ******************************************************************* - * 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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ - + package org.aspectj.testing.run; import java.util.Arrays; @@ -26,11 +26,11 @@ import org.aspectj.util.LangUtil; * Adapt IRun or Run[] or List or ListIterator to RunIteratorI. */ public class RunIterator implements IRunIterator { - + protected String name; protected ListIterator iter; protected IRun run; - + public RunIterator(String name, IRun run) { init(name, run); } @@ -38,7 +38,7 @@ public class RunIterator implements IRunIterator { public RunIterator(String name, List list) { init(name, list); } - + public RunIterator(String name, IRun[] runs) { init(name, Arrays.asList(runs).listIterator()); } @@ -54,13 +54,13 @@ public class RunIterator implements IRunIterator { public void init(String name, IRun[] runs) { init(name, Arrays.asList(runs).listIterator()); } - + /** @return true if the first IRun from nextRun can be the sole IRun */ public boolean isHoistable() { return (null != run); } - - /** + + /** * @param name if null, use iterator.toString(); * @param iterator not null * @throws IllegalArgumentException if iterator is null @@ -71,8 +71,8 @@ public class RunIterator implements IRunIterator { name = (null != name? name : iterator.toString()); run = null; } - - /** + + /** * @param name if null, use run(); * @param run not null * @throws IllegalArgumentException if iterator is null @@ -105,7 +105,7 @@ public class RunIterator implements IRunIterator { public void iterationCompleted() { } - + /** * @see org.aspectj.testing.run.RunIteratorI#nextRun(IMessageHandler, Runner) */ @@ -126,7 +126,7 @@ public class RunIterator implements IRunIterator { } } } - return null; + return null; } /** @return name */ diff --git a/testing/src/test/java/org/aspectj/testing/run/RunListener.java b/testing/src/test/java/org/aspectj/testing/run/RunListener.java index 0d7c9fc76..e130b88c3 100644 --- a/testing/src/test/java/org/aspectj/testing/run/RunListener.java +++ b/testing/src/test/java/org/aspectj/testing/run/RunListener.java @@ -1,17 +1,17 @@ /* ******************************************************************* - * 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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ - + package org.aspectj.testing.run; import java.io.PrintWriter; @@ -22,7 +22,7 @@ import org.aspectj.bridge.MessageUtil; /** * A generic RunListener for easier partial implementations. - * It can take a RunI selector (called on completion) + * It can take a RunI selector (called on completion) * and/or a List to accumulate complete IRunStatus * (if the selector is null or returns true). * It can also take a PrintWriter and String to print traces of each event @@ -33,11 +33,11 @@ public class RunListener implements IRunListener { protected final IRun selector; protected final PrintWriter writer; protected final String prefix; - + protected RunListener() { this((List) null, (IRun) null, (PrintWriter) null, (String) null); } - + /** * @param sink the List sink for any IRunStatus if the selector is null * or returns true for run(IRunStatus) - ignored if null. @@ -56,7 +56,7 @@ public class RunListener implements IRunListener { public RunListener(PrintWriter writer, String prefix) { this((List) null, (IRun) null, writer, prefix); } - + /** * @param sink the List sink for any IRunStatus if the selector is null * or returns true for run(IRunStatus) - ignored if null. @@ -72,13 +72,13 @@ public class RunListener implements IRunListener { this.selector = selector; list = sink; } - + /** * @see org.aspectj.testing.harness.run.IRunListener#addingChild(IRunStatus, IRunStatus) */ public void addingChild(IRunStatus parent, IRunStatus child) { if (null != writer) { - writer.println(prefix + " addingChild(\"" + parent + writer.println(prefix + " addingChild(\"" + parent + "\", \"" + child + "\")"); } } @@ -91,7 +91,7 @@ public class RunListener implements IRunListener { writer.println(prefix + " runStarting(\"" + run + "\")"); } } - + /** * Print to writer (if any), run selector (if any), and add to list * (if any and if selector is null or returns true). diff --git a/testing/src/test/java/org/aspectj/testing/run/RunListeners.java b/testing/src/test/java/org/aspectj/testing/run/RunListeners.java index ebdc227d0..8a630be1c 100644 --- a/testing/src/test/java/org/aspectj/testing/run/RunListeners.java +++ b/testing/src/test/java/org/aspectj/testing/run/RunListeners.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -28,7 +28,7 @@ public class RunListeners extends RunListener implements IRunListener { public RunListeners() { listeners = new ArrayList(); } - + public void addListener(IRunListener listener) { if (null != listener) { listeners.add(listener); @@ -40,7 +40,7 @@ public class RunListeners extends RunListener implements IRunListener { listeners.remove(listener); } } - + /** * Run all listeners with the given status. @@ -50,7 +50,7 @@ public class RunListeners extends RunListener implements IRunListener { if (null == status) { throw new IllegalArgumentException("null RunStatusI"); } - Iterator iter = listeners.iterator(); + Iterator iter = listeners.iterator(); while(!status.aborted() && iter.hasNext()) { IRunListener element = (IRunListener) iter.next(); element.runStarting(status); @@ -65,7 +65,7 @@ public class RunListeners extends RunListener implements IRunListener { if (null == status) { throw new IllegalArgumentException("null RunStatusI"); } - Iterator iter = listeners.iterator(); + Iterator iter = listeners.iterator(); while(!status.aborted() && iter.hasNext()) { IRunListener element = (IRunListener) iter.next(); element.runCompleted(status); @@ -81,7 +81,7 @@ public class RunListeners extends RunListener implements IRunListener { if (null == parent) { throw new IllegalArgumentException("null parent"); } - Iterator iter = listeners.iterator(); + Iterator iter = listeners.iterator(); while(!parent.aborted() && ! child.aborted() && iter.hasNext()) { IRunListener element = (IRunListener) iter.next(); element.addingChild(parent, child); diff --git a/testing/src/test/java/org/aspectj/testing/run/RunStatus.java b/testing/src/test/java/org/aspectj/testing/run/RunStatus.java index c82a61ed1..2cf949f6c 100644 --- a/testing/src/test/java/org/aspectj/testing/run/RunStatus.java +++ b/testing/src/test/java/org/aspectj/testing/run/RunStatus.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.run; @@ -25,7 +25,7 @@ import org.aspectj.util.LangUtil; /** * Default implementation of {@link IRunStatus}. - * + * * @author isberg */ public class RunStatus implements IRunStatus { @@ -83,7 +83,7 @@ public class RunStatus implements IRunStatus { /** * Set identifier associated with this run, if any - * + * * @throws IllegalArgumentException if id is null * @throws IllegalStateException if id has already been set */ @@ -98,7 +98,7 @@ public class RunStatus implements IRunStatus { /** * Set the current validator. - * + * * @param delegate the RunValidatorI to use when calculating runStatus * @throws IllegalArgumentException if delegate is null */ @@ -113,7 +113,7 @@ public class RunStatus implements IRunStatus { /** * Call before any start() or after isCompleted() would return true to reset this to its pre-start state - * + * * @throws IllegalStateException if start() has been called and isCompleted() is not true. */ public void reset() { @@ -123,7 +123,7 @@ public class RunStatus implements IRunStatus { /** * Call before any start() or after isCompleted() would return true to reset this to its pre-start state. Does not affect * validator. - * + * * @param holder the IMessageHolder to use after resetting. * @throws IllegalStateException if start() has been called and isCompleted() is not true. */ @@ -151,7 +151,7 @@ public class RunStatus implements IRunStatus { /** * Call only once to signal this run has started. - * + * * @throws IllegalStateException if start() has been called */ public void start() { @@ -165,7 +165,7 @@ public class RunStatus implements IRunStatus { /** * Call this or thrown only once after start() to signal this run has ended. If this represents a void process, use VOID. - * + * * @param result the Object returned by this run. * @throws IllegalStateException if start() was not called first or if either completed(Object) or thrown(Throwable) have been * called. @@ -181,7 +181,7 @@ public class RunStatus implements IRunStatus { /** * Call to signal this run is ending by request. If this represents a void process, use VOID. If there is no message, use ABORT. - * + * * @param request the Object request to abort, or ABORT if none is available. * @throws IllegalStateException if start() was not called first or if either completed(Object) or thrown(Throwable) have been * called. @@ -197,7 +197,7 @@ public class RunStatus implements IRunStatus { /** * Call this or completed only once after start() to signal this run has ended. - * + * * @throws IllegalStateException if start() was not called first or if either completed(Object) or thrown(Throwable) have been * called. */ @@ -261,7 +261,7 @@ public class RunStatus implements IRunStatus { // ------------------- process messages /** * Call this any time before isCompleted() would return true to signal any messages. - * + * * @throws IllegalStateException if isCompleted(). */ public boolean handleMessage(IMessage message) { @@ -372,7 +372,7 @@ public class RunStatus implements IRunStatus { /** * Add a record for a child run and install self as parent. - * + * * @throws IllegalArgumentException if child is null */ public void addChild(IRunStatus child) { @@ -387,7 +387,7 @@ public class RunStatus implements IRunStatus { /** * Register this as the run parent. (Any run that does addChild(IRunStatus) should register as parent.) - * + * * @throws IllegalArgumentException if parent is null * @throws IllegalStateException if parent exists already */ diff --git a/testing/src/test/java/org/aspectj/testing/run/RunValidator.java b/testing/src/test/java/org/aspectj/testing/run/RunValidator.java index 70131f71a..cf530cd49 100644 --- a/testing/src/test/java/org/aspectj/testing/run/RunValidator.java +++ b/testing/src/test/java/org/aspectj/testing/run/RunValidator.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -24,7 +24,7 @@ import org.aspectj.testing.util.ObjectChecker; * <li>state: fail unless completed and not aborted</li> * <li>messages: fail if any of type ABORT, FAIL - permit ERROR, WARNING, DEBUG... * (which permits expected compiler errors and warnings) </li> - * <li>thrown: if type required, fail unless type thrown; + * <li>thrown: if type required, fail unless type thrown; * if type permitted, fail if wrong type thrown</li> * <li>result: fail unless no ObjectChecker or it validates * and the result is not IRunStatus.FAIL.</li> @@ -50,15 +50,15 @@ public class RunValidator implements IRunValidator { = new RunValidator(IntRange.ZERO); /** expect finished(IRunStatus.PASS) and no thrown, fail, etc. */ - public static final IRunValidator PASS + public static final IRunValidator PASS = new RunValidator(new ObjectChecker() { public boolean isValid(Object o) { return (o == IRunStatus.PASS); } }); - + /** expect finished(IRunStatus.FAIL) */ - public static final IRunValidator FAIL + public static final IRunValidator FAIL = new RunValidator(new ObjectChecker() { public boolean isValid(Object o) { return (o == IRunStatus.FAIL); @@ -67,25 +67,25 @@ public class RunValidator implements IRunValidator { /** range of status values required for passing */ private ObjectChecker resultChecker; - + // XXX replace two exc. classes with one, plus boolean for how to interpret? /** if non-null, passed() permits any thrown assignable to this class */ private Class permittedExceptionsClass; /** if non-null, passed() requires some thrown assignable to this class */ private Class requiredExceptionsClass; - + /** Create result validator that expects a certain int status */ public RunValidator(ObjectChecker resultChecker) { this(resultChecker, null, null); - } - - /** + } + + /** * Create result validator that passes only when completed abruptly by * a Throwable assignable to the specified class. * @throws illegalArgumentException if requiredExceptionsClass is not Throwable */ - public RunValidator(Class requiredExceptionsClass) { + public RunValidator(Class requiredExceptionsClass) { this(null, null, requiredExceptionsClass); } @@ -93,11 +93,11 @@ public class RunValidator implements IRunValidator { * Create a result handler than knows how to evaluate {@link #passed()}. * You cannot specify both permitted and required exception class, * and any exception class specified must be assignable to throwable. - * + * * @param resultChecker {@link #passed()} will return false if * the int status is not accepted by this int validator - if null, * any int status result is accepted. - * @param fastFailErrorClass an Error subclass with a (String) constructor to use to + * @param fastFailErrorClass an Error subclass with a (String) constructor to use to * construct and throw Error from fail(String). If null, then fail(String) * returns normally. * @param permittedExceptionsClass if not null and any exceptions thrown are @@ -120,7 +120,7 @@ public class RunValidator implements IRunValidator { init(resultChecker, permittedExceptionsClass, requiredExceptionsClass); } - + /** subclasses may use this to re-initialize this for re-use */ protected void init( ObjectChecker resultChecker, @@ -128,7 +128,7 @@ public class RunValidator implements IRunValidator { Class requiredExceptionsClass) { this.permittedExceptionsClass = permittedExceptionsClass; this.requiredExceptionsClass = requiredExceptionsClass; - + if (null != resultChecker) { this.resultChecker = resultChecker; } else { @@ -139,21 +139,21 @@ public class RunValidator implements IRunValidator { if (!Throwable.class.isAssignableFrom(permittedExceptionsClass)) { String e = "permitted not throwable: " + permittedExceptionsClass; throw new IllegalArgumentException(e); - } + } } if (null != requiredExceptionsClass) { if (!Throwable.class.isAssignableFrom(requiredExceptionsClass)) { String e = "required not throwable: " + requiredExceptionsClass; throw new IllegalArgumentException(e); - } + } } - if ((null != permittedExceptionsClass) + if ((null != permittedExceptionsClass) && (null != requiredExceptionsClass) ) { String e = "define at most one of required or permitted exceptions"; throw new IllegalArgumentException(e); } } - + /** @return true if this result passes per this validator */ public final boolean runPassed(IRunStatus result) { if (null == result) { @@ -198,7 +198,7 @@ public class RunValidator implements IRunValidator { } } else { return false; - } + } } return dopassed(); } diff --git a/testing/src/test/java/org/aspectj/testing/run/Runner.java b/testing/src/test/java/org/aspectj/testing/run/Runner.java index 58860be6f..1db340a49 100644 --- a/testing/src/test/java/org/aspectj/testing/run/Runner.java +++ b/testing/src/test/java/org/aspectj/testing/run/Runner.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -29,32 +29,32 @@ import org.aspectj.util.LangUtil; * Run IRun, setting status and invoking listeners * for simple and nested runs. * <p> - * This manages baseline IRun status reporting: + * This manages baseline IRun status reporting: * any throwables are caught and reported, and - * the status is started before running and + * the status is started before running and * (if not already completed) completed after. * <p> - * This runs any IRunListeners specified directly in the + * This runs any IRunListeners specified directly in the * run*(..., IRunListener) methods * as well as any specified indirectly by registering listeners per-type - * in {@link registerListener(Class, IRunListener)} + * in {@link registerListener(Class, IRunListener)} * <p> * For correct handling of nested runs, this sets up * status parent/child relationships. * It uses the child result object supplied directly in the * runChild(..., IRunStatus childStatus,..) methods, - * or (if that is null) one obtained from the child IRun itself, - * or (if that is null) a generic IRunStatus. + * or (if that is null) one obtained from the child IRun itself, + * or (if that is null) a generic IRunStatus. * <p> - * For IRunIterator, this uses IteratorWrapper to wrap the + * For IRunIterator, this uses IteratorWrapper to wrap the * iterator as an IRun. Runner and IteratorWrapper coordinate * to handle fast-fail (aborting further iteration when an IRun fails). * The IRunIterator itself may specify fast-fail by returning true - * from {@link IRunIterator#abortOnFailure()}, or clients can + * from {@link IRunIterator#abortOnFailure()}, or clients can * register IRunIterator by Object or type for fast-failure using - * {@link registerFastFailIterator(IRunIterator)} or + * {@link registerFastFailIterator(IRunIterator)} or * {@link registerFastFailIterator(Class)}. - * This also ensures that + * This also ensures that * {@link IRunIterator#iterationCompleted()} is * called after the iteration process has completed. */ @@ -65,25 +65,25 @@ public class Runner { = MessageUtil.fail("Null IRun parameter to Runner.run(IRun..)"); // private static final IMessage FAIL_NORUN_ITERATOR // = MessageUtil.fail("Null IRunterator parameter to Runner.run(IRunterator...)"); - + public Runner() { } - + /** * Do the run, setting run status, invoking - * listener, and aborting as necessary. + * listener, and aborting as necessary. * If the run is null, the status is - * updated, but the listener is never run. + * updated, but the listener is never run. * If the listener is null, then the runner does a lookup * for the listeners of this run type. * Any exceptions thrown by the listener(s) are added - * to the status messages and processing continues. + * to the status messages and processing continues. * unless the status is aborted. * The status will be completed when this method completes. * @param run the IRun to run - if null, issue a FAIL message * to that effect in the result. * @throws IllegalArgumentException if status is null - * @return boolean result returned from IRun + * @return boolean result returned from IRun * or false if IRun did not complete normally * or status.runResult() if aborted. */ @@ -92,46 +92,46 @@ public class Runner { * the run without a status. It ignores exceptions * from the listeners, but does not catch any from the run. */ - public boolean run(IRun run, IRunStatus status, + public boolean run(IRun run, IRunStatus status, IRunListener listener) { return run(run, status, listener, (Class) null); - } - - public boolean run(IRun run, IRunStatus status, - IRunListener listener, Class exceptionClass) { + } + + public boolean run(IRun run, IRunStatus status, + IRunListener listener, Class exceptionClass) { if (!precheck(run, status)) { return false; } RunListeners listeners = getListeners(run, listener); return runPrivate(run, status, listeners, exceptionClass); - + } /** * Run child of parent, handling interceptor registration, etc. * @throws IllegalArgumentException if parent or child status is null */ - public boolean runChild(IRun child, - IRunStatus parentStatus, + public boolean runChild(IRun child, + IRunStatus parentStatus, IRunStatus childStatus, IRunListener listener) { return runChild(child, parentStatus, childStatus, listener, null); } - + /** * Run child of parent, handling interceptor registration, etc. * If the child run is supposed to throw an exception, then pass * the exception class. * After this returns, the childStatus is guaranteed to be completed. - * If an unexpected exception is thrown, an ABORT message + * If an unexpected exception is thrown, an ABORT message * is passed to childStatus. * @param parentStatus the IRunStatus for the parent - must not be null * @param childStatus the IRunStatus for the child - default will be created if null * @param exceptionClass the Class of any expected exception * @throws IllegalArgumentException if parent status is null */ - public boolean runChild(IRun child, - IRunStatus parentStatus, + public boolean runChild(IRun child, + IRunStatus parentStatus, IRunStatus childStatus, IRunListener listener, Class exceptionClass) { @@ -151,7 +151,7 @@ public class Runner { listeners.addingChild(parentStatus, childStatus); } catch (Throwable t) { String m = "RunListenerI.addingChild(..) exception " + listeners; - parentStatus.handleMessage(MessageUtil.abort(m, t)); // XXX + parentStatus.handleMessage(MessageUtil.abort(m, t)); // XXX } } boolean result = false; @@ -167,13 +167,13 @@ public class Runner { if (childResult != result) { childStatus.handleMessage(MessageUtil.info("childResult != result=" + result)); } - return childResult; + return childResult; } public IRunStatus makeChildStatus(IRun run, IRunStatus parent, IMessageHolder handler) { return installChildStatus(run, parent, new RunStatus(handler, this)); } - + /** * Setup the child status before running * @param run the IRun of the child process (not null) @@ -192,19 +192,19 @@ public class Runner { parent.addChild(child); return child; } - + /** * Do a run by running all the subrunners provided by the iterator, * creating a new child status of status for each. * If the iterator is null, the result is - * updated, but the interceptor is never run. + * updated, but the interceptor is never run. * @param iterator the IRunteratorI for all the IRun to run * - if null, abort (if not completed) or message to status. * @throws IllegalArgumentException if status is null */ public boolean runIterator(IRunIterator iterator, IRunStatus status, IRunListener listener) { - LangUtil.throwIaxIfNull(status, "status"); + LangUtil.throwIaxIfNull(status, "status"); if (status.aborted()) { return status.runResult(); } @@ -213,7 +213,7 @@ public class Runner { status.abort(IRunStatus.ABORT_NORUN); } else { status.handleMessage(FAIL_NORUN); - } + } return false; } IRun wrapped = wrap(iterator, listener); @@ -232,7 +232,7 @@ public class Runner { } - /** + /** * Tell Runner to stop iterating over IRun for an IRunIterator * if any IRun.run(IRunStatus) fails. * This overrides a false result from IRunIterator.abortOnFailure(). @@ -243,9 +243,9 @@ public class Runner { throw new UnsupportedOperationException("ignoring " + iterator); } - /** + /** * Tell Runner to stop iterating over IRun for an IRunIterator - * if any IRun.run(IRunStatus) fails, + * if any IRun.run(IRunStatus) fails, * if the IRunIterator is assignable to iteratorType. * This overrides a false result from IRunIterator.abortOnFailure(). * @param iteratorType the IRunIterator Class to fast-fail @@ -255,7 +255,7 @@ public class Runner { public void registerFastFailIteratorTypes(Class iteratorType) { // XXX unimplemented throw new UnsupportedOperationException("ignoring " + iteratorType); } - + /** * Register a run listener for any run assignable to type. * @throws IllegalArgumentException if either is null @@ -269,20 +269,20 @@ public class Runner { } ClassListeners.addListener(type, listener); } - + /** * Wrap this IRunIterator. - * This wrapper takes care of calling + * This wrapper takes care of calling * <code>iterator.iterationCompleted()</code> when done, so - * after running this, clients should not invoker IRunIterator + * after running this, clients should not invoker IRunIterator * methods on this iterator. * @return the iterator wrapped as a single IRun */ public IRun wrap(IRunIterator iterator, IRunListener listener) { LangUtil.throwIaxIfNull(iterator, "iterator"); return new IteratorWrapper(this, iterator, listener); - } - + } + /** * This gets any listeners registered for the run * based on the class of the run (or of the wrapped iterator, @@ -290,7 +290,7 @@ public class Runner { * @return a listener with all registered listener and parm, * or null if parm is null and there are no listeners */ - protected RunListeners getListeners(IRun run, IRunListener listener) { + protected RunListeners getListeners(IRun run, IRunListener listener) { if (null == run) { throw new IllegalArgumentException("null run"); } @@ -309,7 +309,7 @@ public class Runner { return listeners; // XXX implement registration } - /** check status and run before running */ + /** check status and run before running */ private boolean precheck(IRun run, IRunStatus status) { if (null == status) { throw new IllegalArgumentException("null status"); @@ -320,23 +320,23 @@ public class Runner { } else if (status.isCompleted()) { throw new IllegalStateException("status completed before starting"); } - + if (!status.started()) { status.start(); } return true; } - + /** This assumes precheck has happened and listeners have been obtained */ - private boolean runPrivate(IRun run, IRunStatus status, + private boolean runPrivate(IRun run, IRunStatus status, RunListeners listeners, Class exceptionClass) { - IRunListener listener = listeners; + IRunListener listener = listeners; if (null != listener) { try { listener.runStarting(status); } catch (Throwable t) { String m = listener + " RunListenerI.runStarting(..) exception"; - IMessage mssg = new Message(m, IMessage.WARNING, t, null); + IMessage mssg = new Message(m, IMessage.WARNING, t, null); // XXX need IMessage.EXCEPTION - WARNING is ambiguous status.handleMessage(mssg); } @@ -352,13 +352,13 @@ public class Runner { status.handleMessage(MessageUtil.FAIL_INCOMPLETE); } return false; - } - + } + boolean result = false; try { result = run.run(status); - if (!status.isCompleted()) { - status.finish(result?IRunStatus.PASS: IRunStatus.FAIL); + if (!status.isCompleted()) { + status.finish(result?IRunStatus.PASS: IRunStatus.FAIL); } } catch (Throwable thrown) { if (!status.isCompleted()) { @@ -377,8 +377,8 @@ public class Runner { } } } - - + + try { if ((null != listener) && !status.aborted()) { listener.runCompleted(status); @@ -391,15 +391,15 @@ public class Runner { } //---------------------------------- nested classes - /** - * Wrap an IRunIterator as a IRun, coordinating + /** + * Wrap an IRunIterator as a IRun, coordinating * fast-fail IRunIterator and Runner - */ + */ public static class IteratorWrapper implements IRun { final Runner runner; public final IRunIterator iterator; final IRunListener listener; - + public IteratorWrapper(Runner runner, IRunIterator iterator, IRunListener listener) { LangUtil.throwIaxIfNull(iterator, "iterator"); LangUtil.throwIaxIfNull(runner, "runner"); @@ -409,10 +409,10 @@ public class Runner { } /** @return null */ - public IRunStatus makeStatus() { - return null; + public IRunStatus makeStatus() { + return null; } - + /** @return true unless one failed */ public boolean run(IRunStatus status) { boolean result = true; @@ -425,7 +425,7 @@ public class Runner { MessageUtil.debug(status, "null run " + i + " from " + iterator); continue; } - + int newMessages = status.numMessages(IMessage.FAIL, IMessageHolder.ORGREATER); if (newMessages > numMessages) { numMessages = newMessages; @@ -439,7 +439,7 @@ public class Runner { if (result) { result = false; } - if (iterator.abortOnFailure() + if (iterator.abortOnFailure() || runner.abortOnFailure(iterator, run)) { break; } @@ -461,11 +461,11 @@ public class Runner { return s; } } - + /** per-class collection of IRun */ - static class ClassListeners extends RunListeners { + static class ClassListeners extends RunListeners { private static final Hashtable known = new Hashtable(); - + static RunListeners getListeners(Class c) { // XXX costly and stupid Enumeration keys = known.keys(); RunListeners many = new RunListeners(); @@ -477,7 +477,7 @@ public class Runner { } return many; } - + private static RunListeners makeListeners(Class c) { RunListeners result = (ClassListeners) known.get(c); if (null == result) { @@ -486,7 +486,7 @@ public class Runner { } return result; } - + static void addListener(Class c, IRunListener listener) { if (null == listener) { throw new IllegalArgumentException("null listener"); @@ -496,15 +496,15 @@ public class Runner { } makeListeners(c).addListener(listener); } - + Class clazz; - + ClassListeners(Class clazz) { this.clazz = clazz; } - + public String toString() { return clazz.getName() + " ClassListeners: " + super.toString(); } - } + } } diff --git a/testing/src/test/java/org/aspectj/testing/run/WrappedRunIterator.java b/testing/src/test/java/org/aspectj/testing/run/WrappedRunIterator.java index 75be92cb7..3a8b4b214 100644 --- a/testing/src/test/java/org/aspectj/testing/run/WrappedRunIterator.java +++ b/testing/src/test/java/org/aspectj/testing/run/WrappedRunIterator.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.run; @@ -20,10 +20,10 @@ import org.aspectj.util.LangUtil; public class WrappedRunIterator implements IRunIterator { protected final Object id; protected IRun run; - + /** * @param id the Object used for toString(), if set - * @param run the IRun returned from the first call to + * @param run the IRun returned from the first call to * nextRun(IMessageHandler handler, Runner runner) */ public WrappedRunIterator(Object id, IRun run) { @@ -68,5 +68,5 @@ public class WrappedRunIterator implements IRunIterator { /** @return name */ public String toString() { return (null == id ? run : id).toString(); - } + } } diff --git a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommand.java b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommand.java index 09798850c..24299778a 100644 --- a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommand.java +++ b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommand.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ package org.aspectj.testing.taskdefs; @@ -37,7 +37,7 @@ import org.aspectj.util.LangUtil; * but incremental compiles require running the compiler * in another thread using an incremental tag file. * This is imprecise because it assumes - * incremental compiles are complete + * incremental compiles are complete * when messages stop coming from the compiler. * Also, the client should call quit() when done compiling * to halt the process. @@ -45,12 +45,12 @@ import org.aspectj.util.LangUtil; * to avoid the kludge workarounds */ public class AjcTaskCompileCommand implements ICommand { - /** - * 20 seconds of quiet in message holder - * before we assume incremental compile is done + /** + * 20 seconds of quiet in message holder + * before we assume incremental compile is done */ public static int COMPILE_SECONDS_WITHOUT_MESSAGES = 20; - + /** 5 minutes maximum time to wait for a compile to complete */ public static int COMPILE_MAX_SECONDS = 300; @@ -67,7 +67,7 @@ public class AjcTaskCompileCommand implements ICommand { * seconds => timeoutSeconds */ static boolean waitUntilMessagesQuiet( - IMessageHolder holder, + IMessageHolder holder, int seconds, int timeoutSeconds) { LangUtil.throwIaxIfNull(holder, "holder"); @@ -102,7 +102,7 @@ public class AjcTaskCompileCommand implements ICommand { } catch (InterruptedException e) { // ignore } - curTime = System.currentTimeMillis(); + curTime = System.currentTimeMillis(); } int newNumMessages = holder.numMessages(null, true); if (newNumMessages != numMessages) { @@ -112,14 +112,14 @@ public class AjcTaskCompileCommand implements ICommand { } return (curTime >= (numMessagesTime + targetQuietTime)); } - + // single-threaded driver MessageHandler messages = new MessageHandler(); AjcTask ajcTask; File incrementalFile; Thread incrementalCompileThread; - /** + /** * Stop waiting for any further incremental compiles. * Safe to call in non-incremental modes. */ @@ -128,7 +128,7 @@ public class AjcTaskCompileCommand implements ICommand { if (null != task) { task.quit(); // signal task to quit, thread to die ajcTask = null; // XXX need for cleanup? - } + } updateIncrementalFile(false, true); Thread thread = incrementalCompileThread; if (null != thread) { @@ -146,10 +146,10 @@ public class AjcTaskCompileCommand implements ICommand { incrementalCompileThread = null; } } - + // --------- ICommand interface public boolean runCommand(String[] args, IMessageHandler handler) { - return (makeAjcTask(args, handler) + return (makeAjcTask(args, handler) && doCommand(handler, false)); } @@ -162,7 +162,7 @@ public class AjcTaskCompileCommand implements ICommand { public boolean repeatCommand(IMessageHandler handler) { return doCommand(handler, true); } - + protected boolean doCommand(IMessageHandler handler, boolean repeat) { messages.clearMessages(); if (null == ajcTask) { @@ -208,7 +208,7 @@ public class AjcTaskCompileCommand implements ICommand { } finally { MessageUtil.handleAll(handler, messages, false); } - return (0 == messages.numMessages(IMessage.ERROR, true)); + return (0 == messages.numMessages(IMessage.ERROR, true)); } @@ -240,9 +240,9 @@ public class AjcTaskCompileCommand implements ICommand { if (incremental) { args = (String[]) newArgs.toArray(new String[0]); } - + result.readArguments(args); - + if (incremental || result.isInIncrementalMode()) { // these should be impossible... if (result.isInIncrementalFileMode()) { @@ -270,13 +270,13 @@ public class AjcTaskCompileCommand implements ICommand { } return (null != ajcTask); } - + protected boolean updateIncrementalFile(boolean create, boolean delete) { File file = incrementalFile; if (delete) { try { return (null == file) - || !file.exists() + || !file.exists() || file.delete(); } finally { incrementalFile = null; @@ -295,6 +295,6 @@ public class AjcTaskCompileCommand implements ICommand { } } } - + } diff --git a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java index 645a9c7df..94ed0767d 100644 --- a/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java +++ b/testing/src/test/java/org/aspectj/testing/taskdefs/AjcTaskCompileCommandTest.java @@ -2,9 +2,9 @@ * Copyright (c) 2003 Contributors. * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Wes Isberg initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/util/AccumulatingFileFilter.java b/testing/src/test/java/org/aspectj/testing/util/AccumulatingFileFilter.java index b4d7fbf38..277843540 100644 --- a/testing/src/test/java/org/aspectj/testing/util/AccumulatingFileFilter.java +++ b/testing/src/test/java/org/aspectj/testing/util/AccumulatingFileFilter.java @@ -1,13 +1,13 @@ /* ******************************************************************* - * Copyright (c) 1999-2000 Xerox 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 - * - * Contributors: - * Xerox/PARC initial implementation + * Copyright (c) 1999-2000 Xerox Corporation. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -16,7 +16,7 @@ package org.aspectj.testing.util; import java.io.File; import java.util.Vector; -/** +/** * A FileFilter that accumulates the results when called if they exist. * Subclasses override accumulate to determine whether it should be * accumulated. @@ -30,17 +30,17 @@ public class AccumulatingFileFilter extends ValidFileFilter { return true; } - /** + /** * This implementation accumulates everything. * Subclasses should override to implement filter - * @param file a File guaranteed to exist - * @return true if file should be accumulated. + * @param file a File guaranteed to exist + * @return true if file should be accumulated. */ public boolean accumulate(File f) { return true; } /** - * @return list of files currently accumulated + * @return list of files currently accumulated */ public File[] getFiles() { int numFiles = files.size(); diff --git a/testing/src/test/java/org/aspectj/testing/util/BridgeUtil.java b/testing/src/test/java/org/aspectj/testing/util/BridgeUtil.java index 7013160dc..0e75a7c8b 100644 --- a/testing/src/test/java/org/aspectj/testing/util/BridgeUtil.java +++ b/testing/src/test/java/org/aspectj/testing/util/BridgeUtil.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -26,7 +26,7 @@ import org.aspectj.testing.run.RunValidator; import org.aspectj.util.FileUtil; /** - * + * */ public class BridgeUtil { @@ -34,18 +34,18 @@ public class BridgeUtil { /** result value when writeMessage is passed null */ private static final String NULL_MESSAGE_OUTPUT = "<null message output>"; - + /** result value when readMessage is passed null */ private static final IMessage NULL_MESSAGE_INPUT = null; - + private static final String KIND_DELIM = ": \""; private static final String MESSAGE_DELIM = "\" - "; - + public static ISourceLocation makeSourceLocation(UtilLineReader reader) { LangUtil.throwIaxIfNull(reader, "reader"); int line = reader.getLineNumber(); - + return new SourceLocation(reader.getFile(), line, line, 0); } @@ -58,11 +58,11 @@ public class BridgeUtil { private static ISourceLocation readSourceLocation(String sourceLocStr) { return BridgeUtil.makeSourceLocation(sourceLocStr); } -// public static IMessage makeMessage(String message, IMessage.Kind kind, +// public static IMessage makeMessage(String message, IMessage.Kind kind, // Throwable thrown, LineReader reader) { // ISourceLocation sl = (null == reader ? null : MessageUtil.makeSourceLocation(reader)); // if (null == kind) kind = IMessage.INFO; -// return new Message(message, kind, thrown, sl); +// return new Message(message, kind, thrown, sl); // } /** @@ -89,7 +89,7 @@ public class BridgeUtil { ISourceLocation loc = readSourceLocation(sourceLocStr); return new Message(text, kind, null, loc); } - + /** * Write a message to a string to be read by readMessage(String) @@ -100,13 +100,13 @@ public class BridgeUtil { if (null == message) { return NULL_MESSAGE_OUTPUT; } - return message.getKind() - + KIND_DELIM - + message.getMessage() + return message.getKind() + + KIND_DELIM + + message.getMessage() + MESSAGE_DELIM + message.getSourceLocation(); // XXX implement } - + public static class Comparators { /** @@ -115,12 +115,12 @@ public class BridgeUtil { * 1 if one is null and two is not null, * 0 otherwise. */ - static int compareNull(Object one, Object two) { + static int compareNull(Object one, Object two) { return (null == one ? (null == two ? 0 : 1) : (null == two ? -1 : 0)); } - + /** * Soft comparison of String returns 0 if either is empty * or a substring of the other, and the case-insensitive @@ -141,19 +141,19 @@ public class BridgeUtil { return String.CASE_INSENSITIVE_ORDER.compare(lhs_s, rhs_s); } - /** + /** * This returns 0 if one file path is a suffix of the other * or a case-insensitive string comparison otherwise. - * WARNING: it returns 0 if either file is - * ISourceLocation.NO_FILE to permit tests to + * WARNING: it returns 0 if either file is + * ISourceLocation.NO_FILE to permit tests to * not specify file paths. - * + * * Use only for sorts, not to maintain maps. */ public static final Comparator<File> WEAK_File = new Comparator<File>() { public int compare(File o1, File o2) { - if ((o1 == o2) - || (o1 == ISourceLocation.NO_FILE) + if ((o1 == o2) + || (o1 == ISourceLocation.NO_FILE) || (o2 == ISourceLocation.NO_FILE) ) { return 0; } @@ -175,10 +175,10 @@ public class BridgeUtil { return 0; } return String.CASE_INSENSITIVE_ORDER.compare(s1, s2); - + } }; - /** + /** * Ordering only uses line number. * Use only for sorts, not to maintain maps. */ @@ -194,13 +194,13 @@ public class BridgeUtil { ISourceLocation one = (ISourceLocation) o1; ISourceLocation two = (ISourceLocation) o2; int i1 = one.getLine(); - int i2 = two.getLine(); + int i2 = two.getLine(); return i1 - i2; } }; - - /** - * Like WEAK_ISourceLocation, except it also + + /** + * Like WEAK_ISourceLocation, except it also * uses WEAK_FILE on the sourceFile. * Use only for sorts, not to maintain maps. */ @@ -223,9 +223,9 @@ public class BridgeUtil { return WEAK_File.compare(one.getSourceFile(), two.getSourceFile()); } }; - - /** - * Ordering uses kind and weak source location, + + /** + * Ordering uses kind and weak source location, * and ignores message * so use only for sorts, not to maintain maps */ @@ -250,9 +250,9 @@ public class BridgeUtil { ISourceLocation sl2 = two.getSourceLocation(); return WEAK_ISourceLocation.compare(sl1, sl2); } - }; + }; - /** + /** * Ordering uses line and weak filename and message * (message matches if either is a substring of the other, * or if either is empty, i.e., none specified). @@ -276,18 +276,18 @@ public class BridgeUtil { String rhs_s = rhs_m.getMessage(); return compareStringsSoftly(lhs_s, rhs_s); } - }; + }; } public static SourceLocation makeSourceLocation(String input) { // XXX only for testing, not production return makeSourceLocation(input, (File) null); } - - public static SourceLocation makeSourceLocation(String input, String path) { - return makeSourceLocation(input, (null == path ? null : new File(path))); + + public static SourceLocation makeSourceLocation(String input, String path) { + return makeSourceLocation(input, (null == path ? null : new File(path))); } - + /** attempt to create a source location from the input */ - public static SourceLocation makeSourceLocation(String input, File defaultFile) { + public static SourceLocation makeSourceLocation(String input, File defaultFile) { /* * Forms interpreted: * # - line @@ -306,19 +306,19 @@ public class BridgeUtil { } } input = input.trim(); - + String path = null; int line = 0; int endLine = 0; int column = 0; // String message = null; - + // first try line only line = convert(input); if (-1 != line) { return new SourceLocation(defaultFile, line, line, 0); } - + // if not a line - must be > 2 characters if (3 > input.length()) { return null; // throw new IllegalArgumentException("too short: " + input); @@ -361,7 +361,7 @@ public class BridgeUtil { if (path.startsWith(fixTag)) { int len = fixTag.length(); - path = path.substring(len, 1+len) + ":" + + path = path.substring(len, 1+len) + ":" + path.substring(1+len); } if ((endLine == 0) && (line != 0)) { @@ -376,34 +376,34 @@ public class BridgeUtil { * Convert String to int using ascii and optionally * tolerating text * @param s the String to convert - * @param permitText if true, pick a sequence of numbers + * @param permitText if true, pick a sequence of numbers * within a possibly non-numeric String * @param last if permitText, then if this is true the * last sequence is used - otherwise the first is used * XXX only default u.s. encodings.. - * @return -1 or value if a valid, totally-numeric positive string 0..MAX_WIDTH + * @return -1 or value if a valid, totally-numeric positive string 0..MAX_WIDTH */ private static int convert(String s) { return convert(s, false, false); } - + // XXX reconsider convert if used in production code /** * Convert String to int using ascii and optionally * tolerating text * @param s the String to convert - * @param permitText if true, pick a sequence of numbers + * @param permitText if true, pick a sequence of numbers * within a possibly non-numeric String * @param last if permitText, then if this is true the * last sequence is used - otherwise the first is used * XXX only default u.s. encodings.. - * @return -1 or value if a valid, positive string 0..MAX_WIDTH + * @return -1 or value if a valid, positive string 0..MAX_WIDTH */ - private static int convert(String s, boolean permitText, - boolean first) { + private static int convert(String s, boolean permitText, + boolean first) { int result = -1; int last = -1; - int max = s.length(); + int max = s.length(); boolean reading = false; for (int i = 0; i < max; i++) { char c = s.charAt(i); diff --git a/testing/src/test/java/org/aspectj/testing/util/BridgeUtilTest.java b/testing/src/test/java/org/aspectj/testing/util/BridgeUtilTest.java index 83a8b96a3..0d776d964 100644 --- a/testing/src/test/java/org/aspectj/testing/util/BridgeUtilTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/BridgeUtilTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -22,7 +22,7 @@ import org.aspectj.testing.run.Runner; import junit.framework.TestCase; /** - * + * */ public class BridgeUtilTest extends TestCase { @@ -50,7 +50,7 @@ public class BridgeUtilTest extends TestCase { checkChildString(id, 0, 0, 1, 3, expect); expect = "PASS " + id + " 1 tests (1 passed)"; checkChildString(id, 0, 0, 0, 1, expect); - + // "incomplete" variants expect = "PASS " + id + " 5 tests (5 incomplete)"; checkChildString(id, 0, 5, 0, 0, expect); @@ -69,8 +69,8 @@ public class BridgeUtilTest extends TestCase { expect = "PASS " + id + " 6 tests (5 incomplete, 1 passed)"; checkChildString(id, 0, 5, 0, 1, expect); } - - void checkChildString(String id, int numSkips, int numIncomplete, int numFails, int numPasses, + + void checkChildString(String id, int numSkips, int numIncomplete, int numFails, int numPasses, String expected) { Runner runner = new Runner(); MessageHandler holder = new MessageHandler(); @@ -86,10 +86,10 @@ public class BridgeUtilTest extends TestCase { }; final Object result = (numFails > 0 ? IRunStatus.FAIL : IRunStatus.PASS); while (numFails-- > 0) { - runner.runChild(failer,status, null, null); + runner.runChild(failer,status, null, null); } while (numPasses-- > 0) { - runner.runChild(passer,status, null, null); + runner.runChild(passer,status, null, null); } status.finish(result); String actual = BridgeUtil.childString(status, numSkips, numIncomplete); diff --git a/testing/src/test/java/org/aspectj/testing/util/CollectorFileFilter.java b/testing/src/test/java/org/aspectj/testing/util/CollectorFileFilter.java index 7c63c3b6c..ea5147223 100644 --- a/testing/src/test/java/org/aspectj/testing/util/CollectorFileFilter.java +++ b/testing/src/test/java/org/aspectj/testing/util/CollectorFileFilter.java @@ -1,13 +1,13 @@ /* ******************************************************************* - * Copyright (c) 1999-2000 Xerox 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 - * - * Contributors: - * Xerox/PARC initial implementation + * Copyright (c) 1999-2000 Xerox Corporation. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -19,12 +19,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -/** - * Wrap FileFilter to collect any accepted +/** + * Wrap FileFilter to collect any accepted */ public class CollectorFileFilter implements FileFilter { /** returned from getFiles() when there are no files to get */ - public static final List EMPTY + public static final List EMPTY = Collections.unmodifiableList(new ArrayList(0)); /** used for collecting filters */ @@ -33,8 +33,8 @@ public class CollectorFileFilter implements FileFilter { /** filter delegate - may be null */ protected final FileFilter filter; - /** return false from accept only when !alwaysTrue - * and filter is null or fails + /** return false from accept only when !alwaysTrue + * and filter is null or fails */ protected final boolean alwaysTrue; @@ -45,8 +45,8 @@ public class CollectorFileFilter implements FileFilter { /* * @param filter the FileFilter delegate - may be null - * @param alwaysTrue return false from accept only when !alwaysTrue - * and filter is null or fails + * @param alwaysTrue return false from accept only when !alwaysTrue + * and filter is null or fails */ public CollectorFileFilter(FileFilter filter, boolean alwaysTrue){ this.filter = filter; @@ -54,8 +54,8 @@ public class CollectorFileFilter implements FileFilter { } /** - * Accept file into collection if filter is null or passes. - * @return false only when !alwaysTrue and filter fails. + * Accept file into collection if filter is null or passes. + * @return false only when !alwaysTrue and filter fails. */ public boolean accept(File f) { if ((null == filter) || filter.accept(f)) { @@ -75,8 +75,8 @@ public class CollectorFileFilter implements FileFilter { } } - /** - * return clone of gathered-files + /** + * return clone of gathered-files * @return EMPTY if no files or a clone of the collection otherwise */ public synchronized List getFiles() { 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 acefa78c8..64dcd7ff0 100644 --- a/testing/src/test/java/org/aspectj/testing/util/Diffs.java +++ b/testing/src/test/java/org/aspectj/testing/util/Diffs.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/util/FileUtil.java b/testing/src/test/java/org/aspectj/testing/util/FileUtil.java index 4f9f56424..6aea81dfa 100644 --- a/testing/src/test/java/org/aspectj/testing/util/FileUtil.java +++ b/testing/src/test/java/org/aspectj/testing/util/FileUtil.java @@ -1,13 +1,13 @@ /* ******************************************************************* - * Copyright (c) 1999-2000 Xerox 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 - * - * Contributors: - * Xerox/PARC initial implementation + * Copyright (c) 1999-2000 Xerox Corporation. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -33,7 +33,7 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; -/** +/** * misc file utilities */ public class FileUtil { @@ -42,7 +42,7 @@ public class FileUtil { public static final String DEFAULT_URL_FILENAME = "index.html"; /** - * @param args the String[] + * @param args the String[] * <code>{ "-copy", "-srcFile" | "-srcUrl", {src}, "-destFile", {destFile} }</code> */ public static void main (String[] args) { @@ -74,34 +74,34 @@ public class FileUtil { if (0 < errs.length()) { System.err.println("Error copying " + src + " to " + destFile); System.err.println(errs.toString()); - + } } } // ("-copy".equals(args[i])){ - } + } } // end of main () - + /** - * Generate a list of missing and extra files by comparison to a + * Generate a list of missing and extra files by comparison to a * timestamp, optionally excluding certain files. * This is a call to select all files after a given time: - * - * <pre>Diffs d = dirDiffs(dir, givenTime, null, null, null);</pre> - * + * + * <pre>Diffs d = dirDiffs(dir, givenTime, null, null, null);</pre> + * * Given files * <pre>classes/Foo.class * classes/bar/Bash.class * classes/Old.class * classes/one/Unexpected.class * classes/start.gif</pre> - * where only Old.class predated startTime, this is a call that + * where only Old.class predated startTime, this is a call that * reports "one/Unexpected.class" as unexpected and "Foo" * as missing: * <pre>String requireSuffix = ".class"; * String[] expectedPaths = new String[] { "Foo", "bar/Bas" }; * File file = new File("classes"); - * Diffs d = dirDiffs(dir, startTime, requireSuffix,expectedPaths, true);</pre> - * + * Diffs d = dirDiffs(dir, startTime, requireSuffix,expectedPaths, true);</pre> + * * @param label the String to use for the Diffs label * @param dir the File for the dir to search * @param startTime collect files modified after this time @@ -116,15 +116,15 @@ public class FileUtil { */ public static Diffs dirDiffs( // XXX too complicated, weak prefix checking final String label, - final File dir, - final long startTime, - final String requiredSuffix, - final String[] expectedPaths, + final File dir, + final long startTime, + final String requiredSuffix, + final String[] expectedPaths, final boolean acceptFilePrefix) { - + LangUtil.throwIaxIfNull(dir, "dir"); final boolean checkExpected = !LangUtil.isEmpty(expectedPaths); - + // normalize sources to ignore final List expected = (!checkExpected ? null : new ArrayList()); if (checkExpected) { @@ -134,22 +134,22 @@ public class FileUtil { } } } - + // gather, normalize paths changed FileFilter touchedCollector = new FileFilter() { - /** + /** * For files complying with time and suffix rules, - * return true (accumulate - unexpected) + * return true (accumulate - unexpected) * unless they match expected files, * (deleting any matches from sources * so the remainder is missing). * @return true for unexpected files after date */ public boolean accept(File file) { if (file.isFile() - && ((0 > startTime) + && ((0 > startTime) || (startTime < file.lastModified()))) { String path = file.getPath(); - if ((null == requiredSuffix) || path.endsWith(requiredSuffix)) { + if ((null == requiredSuffix) || path.endsWith(requiredSuffix)) { path = org.aspectj.util.FileUtil.weakNormalize(path); if (checkExpected) { if (!acceptFilePrefix) { @@ -157,8 +157,8 @@ public class FileUtil { if (expected.contains(path)) { expected.remove(path); // found - do not add to unexpected - return false; - } + return false; + } } else { for (Object o : expected) { String exp = (String) o; @@ -182,7 +182,7 @@ public class FileUtil { } }; List unexp = new ArrayList(Arrays.asList(dir.listFiles(touchedCollector))); - + // report any unexpected changes return Diffs.makeDiffs(label, expected, unexp, String.CASE_INSENSITIVE_ORDER); } @@ -196,13 +196,13 @@ public class FileUtil { public static void visitZipEntries(ZipFile zipfile, StringVisitor visitor) { visitZipEntries(zipfile, visitor, (StringBuffer) null); } - + /** * Visit the entries in a zip file, halting when visitor balks. * Errors are reported in errs, if not null. * @throws IllegalArgumentException if zipfile or visitor is null */ - public static void visitZipEntries(ZipFile zipfile, StringVisitor visitor, + public static void visitZipEntries(ZipFile zipfile, StringVisitor visitor, StringBuffer errs) { if (null == zipfile) throw new IllegalArgumentException("null zipfile"); if (null == visitor) throw new IllegalArgumentException("null visitor"); @@ -216,9 +216,9 @@ public class FileUtil { break; } } - } catch (Throwable e) { + } catch (Throwable e) { if (null != errs) { - errs.append("FileUtil.visitZipEntries error accessing entry " + index + errs.append("FileUtil.visitZipEntries error accessing entry " + index + ": " + e.getMessage()); StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); @@ -226,7 +226,7 @@ public class FileUtil { } } finally { if (null != zipfile) { - try { zipfile.close(); } + try { zipfile.close(); } catch (IOException x) {} // ignore } } @@ -260,7 +260,7 @@ public class FileUtil { * }}, false);</code></pre> * To list files/dir from root using user recursion: * <code><pre>descendFileTree(new File("/"), new FileFilter() { - * public boolean run(File f){ + * public boolean run(File f){ * System.out.println(f.getAbsolutePath()); * if (f.isDirectory() && (-1 == f.getName().indexOf("CVS"))) * return descendFileTree(f, this, true); @@ -272,16 +272,16 @@ public class FileUtil { * @return false if any fileFilter.accept(File) did. * @throws IllegalArgumentException if file or fileFilter is null */ - public static boolean descendFileTree(File file, FileFilter fileFilter, + public static boolean descendFileTree(File file, FileFilter fileFilter, boolean userRecursion) { if (null == file) {throw new IllegalArgumentException("parm File"); } if (null == fileFilter){throw new IllegalArgumentException("parm FileFilter");} if (!file.isDirectory()) { return fileFilter.accept(file); - } else if (file.canRead()) { + } else if (file.canRead()) { // go through files first - File[] files = file.listFiles(ValidFileFilter.FILE_EXISTS); + File[] files = file.listFiles(ValidFileFilter.FILE_EXISTS); if (null != files) { for (File value : files) { if (!fileFilter.accept(value)) { @@ -304,7 +304,7 @@ public class FileUtil { } } } - } // readable directory (ignore unreadable ones) + } // readable directory (ignore unreadable ones) return true; } // descendFiles @@ -317,7 +317,7 @@ public class FileUtil { * There are no guarantees about ordering. * @param dir the File to list for * @param results the Collection to use for the results (may be null) - * @throws IllegalArgumentException if null == dir + * @throws IllegalArgumentException if null == dir * @return a Collection of String of paths, including paths inside jars */ public static Collection<String> directoryToString(File dir, Collection results) { @@ -349,7 +349,7 @@ public class FileUtil { * applying policies for whitespace, etc. * @param file the File to enumerate ZipEntry for * @param results the Colection to use to return the FileLine - may be null - * @return FileLines with string as text and + * @return FileLines with string as text and * canonical as string modified by any canonicalizing policies. */ public static Collection zipFileToString(final File zipfile, Collection results) { @@ -386,7 +386,7 @@ public class FileUtil { if ((null == f) || (null == (s = f.getPath()))) { return false; } else { - return (f.canRead() && !f.isDirectory() + return (f.canRead() && !f.isDirectory() && (s.endsWith(".zip") || (s.endsWith(".jar")))); } @@ -403,7 +403,7 @@ public class FileUtil { /** * Write all files in directory out to jarFile - * @param jarFile the File to create and write to + * @param jarFile the File to create and write to * @param directory the File representing the directory to read * @param mainClass the value of the main class attribute - may be null */ @@ -412,7 +412,7 @@ public class FileUtil { String label = "createJarFile("+jarFile +","+directory +","+mainClass +","+filter + "): "; Log.signal(label + " start"); - if (null == directory) + if (null == directory) throw new IllegalArgumentException("null directory"); Manifest manifest = createManifest(mainClass); Log.signal(label + " manifest=" + manifest); @@ -422,7 +422,7 @@ public class FileUtil { if (null == jarFileDir) { Log.signal(label + " null jarFileDir"); } else if (!jarFileDir.exists() && !jarFileDir.mkdirs()) { // XXX convert to Error - Log.signal(label + " unable to create jarFileDir: " + jarFileDir); + Log.signal(label + " unable to create jarFileDir: " + jarFileDir); } OutputStream os = new FileOutputStream(jarFile); out = (null == manifest ? new JarOutputStream(os) @@ -441,9 +441,9 @@ public class FileUtil { catch (IOException e) {} // todo ignored } } - + return false; - } + } protected static Manifest createManifest(String mainClass) { final String mainKey = "Main-Class"; @@ -459,7 +459,7 @@ public class FileUtil { attributes.putValue(mainKey, mainClass); main = attributes.getValue(mainKey); if (null == main) { - Log.signal("createManifest unable to set main " + Log.signal("createManifest unable to set main " + mainClass); } } @@ -473,7 +473,7 @@ public class FileUtil { /** read a file out to the zip stream */ protected static void addFileToZip(File in, File parent, - ZipOutputStream out) + ZipOutputStream out) throws IOException { String path = in.getCanonicalPath(); String parentPath = parent.getCanonicalPath(); @@ -498,9 +498,9 @@ public class FileUtil { out.write(buf, 0, count); } } finally { - if (null != input) input.close(); + if (null != input) input.close(); } - } + } public static void returnTempDir(File dir) { @@ -529,7 +529,7 @@ public class FileUtil { err.append(sw.toString()); } - private static boolean report(StringBuffer err, String context, String status, + private static boolean report(StringBuffer err, String context, String status, Throwable throwable) { boolean failed = ((null != status) || (null != throwable)); if ((null != err) && (failed)) { @@ -546,7 +546,7 @@ public class FileUtil { return failed; } - /** + /** * Copy file. * @param src the File to copy - must exist * @param dest the File for the target file or directory (will not create directories) @@ -565,7 +565,7 @@ public class FileUtil { } if (ValidFileFilter.FILE_EXISTS.accept(dest)) { label = "dest file exists"; - } + } boolean closeWhenDone = true; result = copy(new FileInputStream(src), new FileOutputStream(dest), @@ -575,12 +575,12 @@ public class FileUtil { } catch (Throwable t) { throwable = t; } - String context = "FileUtil.copyFile(src, dest, err)"; - boolean report = report(err, context, label, throwable); + String context = "FileUtil.copyFile(src, dest, err)"; + boolean report = report(err, context, label, throwable); return (result && !report); } - /** + /** * Copy URL to file. * @param src the URL to copy - must exist * @param dest the File for the target file or directory (will not create directories) @@ -600,7 +600,7 @@ public class FileUtil { } if (ValidFileFilter.FILE_EXISTS.accept(dest)) { label = "dest file exists"; - } + } boolean closeWhenDone = true; result = copy(url.openConnection().getInputStream(), new FileOutputStream(dest), @@ -610,18 +610,18 @@ public class FileUtil { throwable = t; } String context = "FileUtil.copyURL(src, dest, err)"; // add actual parm to labels? - boolean report = report(err, context, label, throwable); + boolean report = report(err, context, label, throwable); return (result && report); } - /** + /** * Copy input to output - does not close either * @param src the InputStream to copy - must exist - * @param dest the OutputStream for the target + * @param dest the OutputStream for the target * @param close if true, close when done */ - public static boolean copy(InputStream src, OutputStream dest, - boolean close) + public static boolean copy(InputStream src, OutputStream dest, + boolean close) throws IOException { boolean result = false; IOException throwable = null; @@ -636,11 +636,11 @@ public class FileUtil { throwable = t; } finally { if (close) { - try { if (null != src) src.close(); } + try { if (null != src) src.close(); } catch (IOException e) { if (null == throwable) { throwable = e; } } - try { if (null != dest) dest.close(); } + try { if (null != dest) dest.close(); } catch (IOException i) { if (null == throwable) { throwable = i; } } @@ -654,7 +654,7 @@ public class FileUtil { * @return true if dir was an existing directory that is now deleted */ protected static boolean deleteDirectory(File dir) { - return ((null != dir) + return ((null != dir) && dir.exists() && dir.isDirectory() && FileUtil.descendFileTree(dir, DELETE_FILES, false) @@ -670,7 +670,7 @@ public class FileUtil { return result; } - //-------- first-order, input and visible interface + //-------- first-order, input and visible interface protected static final FileFilter DELETE_DIRS = new FileFilter() { public boolean accept(File file) { @@ -687,8 +687,8 @@ public class FileUtil { } // class FileUtil -/** - * Localize FileUtil log/signals for now +/** + * Localize FileUtil log/signals for now * ordinary signals are ignored, * but exceptions are printed to err * and errors are thrown as Error diff --git a/testing/src/test/java/org/aspectj/testing/util/FileUtilTest.java b/testing/src/test/java/org/aspectj/testing/util/FileUtilTest.java index ddafcfb53..06617b5d4 100644 --- a/testing/src/test/java/org/aspectj/testing/util/FileUtilTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/FileUtilTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -16,7 +16,7 @@ package org.aspectj.testing.util; import junit.framework.TestCase; /** - * + * */ public class FileUtilTest extends TestCase { diff --git a/testing/src/test/java/org/aspectj/testing/util/IntRange.java b/testing/src/test/java/org/aspectj/testing/util/IntRange.java index 4181e7018..f57b93718 100644 --- a/testing/src/test/java/org/aspectj/testing/util/IntRange.java +++ b/testing/src/test/java/org/aspectj/testing/util/IntRange.java @@ -1,13 +1,13 @@ /* ******************************************************************* - * Copyright (c) 1999-2000 Xerox 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 - * - * Contributors: - * Xerox/PARC initial implementation + * Copyright (c) 1999-2000 Xerox Corporation. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -38,34 +38,34 @@ public class IntRange implements IntValidator, ObjectChecker, Serializable { /** any int number permitted except Integer.MAX_VALUE */ public static final IntRange ANY = new IntRange(Integer.MIN_VALUE, Integer.MAX_VALUE); - /** + /** * Make an IntRange that accepts this value * (using existing if available). * @throws IllegalArgumentException if value is Integer.MAX_VALUE. */ public static final IntRange make(int value) { switch (value) { - case (1) : return ONE; - case (0) : return ZERO; - case (Integer.MAX_VALUE) : - throw new IllegalArgumentException("illegal " + value); - default : + case (1) : return ONE; + case (0) : return ZERO; + case (Integer.MAX_VALUE) : + throw new IllegalArgumentException("illegal " + value); + default : return new IntRange(value, value + 1); } } - + public final int min; public final int max; private transient String cache; - /** use only for serialization + /** use only for serialization * @deprecated IntRange(int, int) */ protected IntRange() { min = 0; max = 0; - } - + } + /** * @param min minimum permitted value, inclusive * @param max maximum permitted value, exclusive @@ -78,27 +78,27 @@ public class IntRange implements IntValidator, ObjectChecker, Serializable { } toString(); // create cache to view during debugging } - + /** @return true if integer instanceof Integer with acceptable intValue */ public final boolean isValid(Object integer) { return ((integer instanceof Integer) && (acceptInt((Integer) integer))); } - + /** @return true if min <= value < max */ public final boolean acceptInt(int value) { return ((value >= min) && (value < max)); } - - /** + + /** * @deprecated acceptInt(int) - * @return true if min <= value < max + * @return true if min <= value < max */ public final boolean inRange(int value) { return acceptInt(value); } - /** + /** * @return true if, for any int x s.t. other.inRange(x) * is true, this.inRange(x) is also true */ @@ -106,9 +106,9 @@ public class IntRange implements IntValidator, ObjectChecker, Serializable { return ((null != other) && (other.min >= min) && (other.max <= max)); } - - // XXX equals(Object) - + + // XXX equals(Object) + public String toString() { if (null == cache) { cache = "IntRange [" + min + ".." + max + "]"; diff --git a/testing/src/test/java/org/aspectj/testing/util/IntValidator.java b/testing/src/test/java/org/aspectj/testing/util/IntValidator.java index 6b0766e4e..dc3ea8abc 100644 --- a/testing/src/test/java/org/aspectj/testing/util/IntValidator.java +++ b/testing/src/test/java/org/aspectj/testing/util/IntValidator.java @@ -2,9 +2,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/util/IteratorWrapper.java b/testing/src/test/java/org/aspectj/testing/util/IteratorWrapper.java index 5b7c13af9..a5e21f5ef 100644 --- a/testing/src/test/java/org/aspectj/testing/util/IteratorWrapper.java +++ b/testing/src/test/java/org/aspectj/testing/util/IteratorWrapper.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -16,8 +16,8 @@ package org.aspectj.testing.util; import java.util.Iterator; import java.util.List; -/** - * This iterates in order through the permutations of Lists. +/** + * This iterates in order through the permutations of Lists. * Order and numericity depend on the underlying list iterators * and the order in which the lists are supplied to the constructor. * @author isberg @@ -26,26 +26,26 @@ public class IteratorWrapper implements Iterator { final List[] lists; final Iterator[] iterators; - final Object[] current; + final Object[] current; Object[] next; - + /** number of elements in each array */ final int maxDepth; - /** + /** * Current level being iterated. * Set to 0 whenever depth is incremented. * Incremented when iterator for the level has no more elements. */ - int currentLevel; - - /** + int currentLevel; + + /** * Maximum depth iterated-to thus far. * Set to 0 on initialization. * Incremented when incrementing currentLevel brings it past depth. * Run completes when depth = maxDepth or any new iterator has no elements */ - int depth; + int depth; /** @throws IllegalArgumentException if lists or any element null */ @@ -68,7 +68,7 @@ public class IteratorWrapper implements Iterator { iterators = new Iterator[maxDepth]; reset(); } - + /** Reset to the initial state of the iterator */ public void reset() { next = null; @@ -95,7 +95,7 @@ public class IteratorWrapper implements Iterator { return (null != next); } - /** + /** * @return Object[] with each element from the iterator of the * corresponding list which was passed to the constructor for this. */ @@ -110,7 +110,7 @@ public class IteratorWrapper implements Iterator { System.arraycopy(current, 0, result, 0, maxDepth); return result; } - + private Object[] getNext() { int initialLevel = currentLevel; while (depth < maxDepth) { @@ -120,7 +120,7 @@ public class IteratorWrapper implements Iterator { currentLevel = 0; } return getCurrent(); - } else { // pop + } else { // pop // reset this level iterators[currentLevel] = lists[currentLevel].iterator(); if (!iterators[currentLevel].hasNext()) { // empty iterator - quit @@ -128,7 +128,7 @@ public class IteratorWrapper implements Iterator { return null; } current[currentLevel] = iterators[currentLevel].next(); - + // do the next level currentLevel++; if (currentLevel > depth) { @@ -143,5 +143,5 @@ public class IteratorWrapper implements Iterator { return "IteratorWrapper(currentLevel=" + currentLevel + ", maxLevel=" + depth + ", size=" + maxDepth + ")"; - } + } } diff --git a/testing/src/test/java/org/aspectj/testing/util/IteratorWrapperTest.java b/testing/src/test/java/org/aspectj/testing/util/IteratorWrapperTest.java index a079a2685..6eeec0e82 100644 --- a/testing/src/test/java/org/aspectj/testing/util/IteratorWrapperTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/IteratorWrapperTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -20,7 +20,7 @@ import java.util.List; import junit.framework.TestCase; /** - * + * */ public class IteratorWrapperTest extends TestCase { @@ -39,10 +39,10 @@ public class IteratorWrapperTest extends TestCase { in = new List[] {Collections.EMPTY_LIST}; checkIteratorWrapper(in, exp); - + in = new List[] {Collections.EMPTY_LIST, Collections.EMPTY_LIST}; checkIteratorWrapper(in, exp); - + Object[] ra1 = new Object[] { "1" }; List one = Collections.unmodifiableList(Arrays.asList(ra1)); in = new List[] {one}; @@ -56,79 +56,79 @@ public class IteratorWrapperTest extends TestCase { Object[] RA_ab = new String[] { "a", "b" }; List List_ab = Collections.unmodifiableList(Arrays.asList(RA_ab)); in = new List[] {List_ab}; - exp = new Object[][] { - new Object[] { "a" }, - new Object[] { "b" } + exp = new Object[][] { + new Object[] { "a" }, + new Object[] { "b" } }; checkIteratorWrapper(in, exp); in = new List[] {one, List_ab}; - exp = new Object[][] { - new Object[] { "1", "a" }, + exp = new Object[][] { + new Object[] { "1", "a" }, new Object[] { "1", "b" }, }; checkIteratorWrapper(in, exp); Object[] RA_cd = new String[] { "c", "d" }; List List_cd = Collections.unmodifiableList(Arrays.asList(RA_cd)); - + in = new List[] {List_ab, List_cd}; - exp = new Object[][] { - new Object[] { "a", "c" }, - new Object[] { "b", "c" }, - new Object[] { "a", "d" }, + exp = new Object[][] { + new Object[] { "a", "c" }, + new Object[] { "b", "c" }, + new Object[] { "a", "d" }, new Object[] { "b", "d" } }; checkIteratorWrapper(in, exp); - + in = new List[] {one, one, one}; - exp = new Object[][] { - new Object[] { "1", "1", "1" } + exp = new Object[][] { + new Object[] { "1", "1", "1" } }; checkIteratorWrapper(in, exp); - + in = new List[] {List_ab, List_ab, List_ab}; - exp = new Object[][] { - new Object[] { "a", "a", "a" }, - new Object[] { "b", "a", "a" }, - new Object[] { "a", "b", "a" }, - new Object[] { "b", "b", "a" }, + exp = new Object[][] { + new Object[] { "a", "a", "a" }, + new Object[] { "b", "a", "a" }, + new Object[] { "a", "b", "a" }, + new Object[] { "b", "b", "a" }, new Object[] { "a", "a", "b" }, new Object[] { "b", "a", "b" }, new Object[] { "a", "b", "b" }, new Object[] { "b", "b", "b" } }; checkIteratorWrapper(in, exp); - + in = new List[] {one, List_ab, List_ab}; - exp = new Object[][] { - new Object[] { "1", "a", "a" }, + exp = new Object[][] { + new Object[] { "1", "a", "a" }, new Object[] { "1", "b", "a" }, - new Object[] { "1", "a", "b" }, + new Object[] { "1", "a", "b" }, new Object[] { "1", "b", "b" }, }; - checkIteratorWrapper(in, exp); - + checkIteratorWrapper(in, exp); + in = new List[] {one, List_ab, one}; - exp = new Object[][] { - new Object[] { "1", "a", "1" }, + exp = new Object[][] { + new Object[] { "1", "a", "1" }, new Object[] { "1", "b", "1" } }; checkIteratorWrapper(in, exp); - + in = new List[] {List_ab, one, List_ab}; - exp = new Object[][] { - new Object[] { "a", "1", "a" }, + exp = new Object[][] { + new Object[] { "a", "1", "a" }, new Object[] { "b", "1", "a" }, - new Object[] { "a", "1", "b" }, + new Object[] { "a", "1", "b" }, new Object[] { "b", "1", "b" } }; checkIteratorWrapper(in, exp); - + in = new List[] {List_ab, one, List_ab, List_ab, Collections.EMPTY_LIST}; exp = new Object[][] {}; checkIteratorWrapper(in, exp); - + } void checkIteratorWrapper(List[] lists, Object[][] exp) { diff --git a/testing/src/test/java/org/aspectj/testing/util/LangUtil.java b/testing/src/test/java/org/aspectj/testing/util/LangUtil.java index b4acc5ce3..c156962df 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LangUtil.java +++ b/testing/src/test/java/org/aspectj/testing/util/LangUtil.java @@ -1,13 +1,13 @@ /* ******************************************************************* - * Copyright (c) 1999-2000 Xerox 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 - * - * Contributors: - * Xerox/PARC initial implementation + * Copyright (c) 1999-2000 Xerox Corporation. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -37,7 +37,7 @@ import org.aspectj.bridge.AbortException; import org.aspectj.bridge.IMessage; -/** +/** * misc lang utilities */ public class LangUtil { @@ -55,10 +55,10 @@ public class LangUtil { public static final String CLASSPATH_SEP; private static final String[] NONE = new String[0]; - + /** bad: hard-wired unix, windows, mac path separators */ private static final char[] SEPS = new char[] { '/', '\\', ':' }; - + static { // XXX this has to be the wrong way to get system-dependent classpath separator String ps = ";"; @@ -80,8 +80,8 @@ public class LangUtil { } finally { CLASSPATH_SEP = ps; } - } - + } + /** * @return input if any are empty or no target in input, * or input with escape prefixing all original target @@ -94,9 +94,9 @@ public class LangUtil { escape(input, target, escape, sink); return sink.toString(); } - - - /** + + + /** * Append escaped input to sink. * Cheap form of arbitrary escaping does not escape the escape String * itself, but unflatten treats it as significant only before the target. @@ -120,16 +120,16 @@ public class LangUtil { } /** - * Flatten a List to String by first converting to String[] + * Flatten a List to String by first converting to String[] * (using toString() if the elements are not already String) * and calling flatten(String[]...). */ public static void flatten( - List list, - String prefix, - String nullFlattened, + List list, + String prefix, + String nullFlattened, String escape, - String delim, + String delim, String suffix, StringBuffer sink) { throwIaxIfNull(list, "list"); @@ -157,7 +157,7 @@ public class LangUtil { final FlattenSpec s = spec; flatten(input, s.prefix, s.nullFlattened, s.escape, s.delim,s.suffix, sink); } - + @@ -180,11 +180,11 @@ public class LangUtil { * @return null if sink is not null (results added to sink) or rendering otherwise */ public static void flatten( - String[] strings, - String prefix, - String nullFlattened, + String[] strings, + String prefix, + String nullFlattened, String escape, - String delim, + String delim, String suffix, StringBuffer sink) { throwIaxIfNull(strings, "strings"); @@ -212,7 +212,7 @@ public class LangUtil { if (haveDelim && (i > 0)) { sink.append(delim); } - + if (escaping) { escape(s, delim, escape, sink); } else { @@ -224,7 +224,7 @@ public class LangUtil { sink.append(suffix); } } - + /** * Get indexes of any invalid entries in array. * @param ra the Object[] entries to check @@ -232,7 +232,7 @@ public class LangUtil { * @param superType the Class, if any, to verify that * any entries are assignable. * @return null if all entries are non-null, assignable to superType - * or comma-delimited error String, with components + * or comma-delimited error String, with components * <code>"[#] {null || not {superType}"</code>, * e.g., "[3] null, [5] not String" */ @@ -248,7 +248,7 @@ public class LangUtil { for (int i = 0; i < ra.length; i++) { if (null == ra[i]) { result.append(", [" + i + "] null"); - } else if ((null != superType) + } else if ((null != superType) && !superType.isAssignableFrom(ra[i].getClass())) { result.append(", [" + i + "] not " + cname); } @@ -259,7 +259,7 @@ public class LangUtil { return result.toString().substring(2); } } - + /** @return ((null == ra) || (0 == ra.length)) */ public static boolean isEmpty(Object[] ra) { return ((null == ra) || (0 == ra.length)); @@ -270,17 +270,17 @@ public class LangUtil { return ((null == s) || (0 == s.length())); } - + /** * Throw IllegalArgumentException if any component in input array * is null or (if superType is not null) not assignable to superType. - * The exception message takes the form + * The exception message takes the form * <code>{name} invalid entries: {invalidEntriesResult}</code> * @throws IllegalArgumentException if any components bad * @see #invalidComponents(Object[], Class) */ public static final void throwIaxIfComponentsBad( - final Object[] input, + final Object[] input, final String name, final Class superType) { String errs = invalidComponents(input, superType); @@ -298,10 +298,10 @@ public class LangUtil { throw new IllegalArgumentException(message); } } - + /** * Shorthand for "if null, throw IllegalArgumentException" - * @throws IllegalArgumentException "null {name}" if o is null + * @throws IllegalArgumentException "null {name}" if o is null */ public static final void throwIaxIfNull(final Object o, final String name) { if (null == o) { @@ -321,9 +321,9 @@ public class LangUtil { * handling prefixes, suffixes, escapes, etc. * Any prefix or suffix is stripped from the input * (or, if not found, an IllegalArgumentException is thrown). - * If delim is null or empty or input contains no delim, + * If delim is null or empty or input contains no delim, * then return new String[] {stripped input}. - * + * * XXX fix comments * prefixing with leader (if not null), * using nullRendering for null entries (skipped if null), @@ -345,11 +345,11 @@ public class LangUtil { * or if any suffix does not end the input */ public static ArrayList unflatten( - String input, - String prefix, - String nullFlattened, + String input, + String prefix, + String nullFlattened, String escape, - String delim, + String delim, String suffix, String emptyUnflattened) { throwIaxIfNull(input, "input"); @@ -381,7 +381,7 @@ public class LangUtil { result.add(input); return result; } - + StringTokenizer st = new StringTokenizer(input, delim, true); // StringBuffer cur = new StringBuffer(); // boolean lastEndedWithEscape = false; @@ -396,8 +396,8 @@ public class LangUtil { } return result; } - - /** combine two string arrays, removing null and duplicates + + /** combine two string arrays, removing null and duplicates * @return concatenation of both arrays, less null in either or dups in two * @see Util#combine(Object[], Object[]) */ @@ -420,7 +420,7 @@ public class LangUtil { } return (String[]) result.toArray(NONE); } - + public static Properties combine(Properties dest, Properties add, boolean respectExisting) { // XXX if (null == add) return dest; if (null == dest) return add; @@ -443,7 +443,7 @@ public class LangUtil { public static List arrayAsList(Object[] ra) { return org.aspectj.util.LangUtil.arrayAsList(ra); } - + /** * return the fully-qualified class names * inferred from the file names in dir @@ -464,12 +464,12 @@ public class LangUtil { for (int i = 0; i < result.length; i++) { if (!it.hasNext()) { throw new Error("unexpected end of list at " + i); - } + } result[i] = fileToClassname((File) it.next(), dirPrefix); - } + } return result; } - + /** * Convert String[] to String by using conventions for * split. Will ignore any entries containing SPLIT_DELIM @@ -477,7 +477,7 @@ public class LangUtil { * @param input the String[] to convert * @param errs the StringBuffer for error messages (if any) */ - public static String unsplit(String[] input, StringBuffer errs) { + public static String unsplit(String[] input, StringBuffer errs) { StringBuffer sb = new StringBuffer(); sb.append(SPLIT_START); for (int i = 0; i < input.length; i++) { @@ -495,9 +495,9 @@ public class LangUtil { } sb.append(SPLIT_END); return sb.toString(); - + } - + /** * Split input into substrings on the assumption that it is * either only one string or it was generated using List.toString(), @@ -526,7 +526,7 @@ public class LangUtil { result.add(s.substring(start)); return (String[]) result.toArray(new String[0]); } - + public static String[] strip(String[] src, String[] toStrip) { if (null == toStrip) { return strip(src, NONE); @@ -536,13 +536,13 @@ public class LangUtil { List slist = org.aspectj.util.LangUtil.arrayAsList(src); List tlist = org.aspectj.util.LangUtil.arrayAsList(toStrip); slist.removeAll(tlist); - return (String[]) slist.toArray(NONE); + return (String[]) slist.toArray(NONE); } - + /** * Load all classes specified by args, logging success to out * and fail to err. - */ + */ public static void loadClasses(String[] args, StringBuffer out, StringBuffer err) { if (null != args) { @@ -562,13 +562,13 @@ public class LangUtil { } } } - + } - } - + } + private static String fileToClassname(File f, String prefix) { // this can safely assume file exists, starts at base, ends with .class - // this WILL FAIL if full path with drive letter on windows + // this WILL FAIL if full path with drive letter on windows String path = f.getPath(); if (!path.startsWith(prefix)) { String err = "!\"" + path + "\".startsWith(\"" + prefix + "\")"; @@ -581,7 +581,7 @@ public class LangUtil { } return path; } - + public static void main (String[] args) { // todo remove as testing StringBuffer err = new StringBuffer(); StringBuffer out = new StringBuffer(); @@ -596,7 +596,7 @@ public class LangUtil { if (0 < out.length()) { System.out.println(out.toString()); } - } + } public static String render (String[] args) { // todo move as testing if ((null == args) || (1 > args.length)) { @@ -609,12 +609,12 @@ public class LangUtil { for (int i = 0; i < args.length; i++) { if (0 < i) sb.append(sep); sb.append(args[i]); - } + } sb.append(longFormat ? "\n" : "]"); return sb.toString(); - } - - + } + + /** * @param thrown the Throwable to render */ @@ -633,8 +633,8 @@ public class LangUtil { PrintWriter writer = new PrintWriter(buf); writer.println(thrown.getMessage()); thrown.printStackTrace(writer); - try { buf.close(); } - catch (IOException ioe) {} + try { buf.close(); } + catch (IOException ioe) {} return buf.toString(); } @@ -645,7 +645,7 @@ public class LangUtil { public static String debugStr(Object o) { return debugStr(o, false); } - + /** * Render standard debug string for an object in normal, default form. * @param source the Object to render @@ -713,7 +713,7 @@ public class LangUtil { names[i] = field.getName(); // collapse to String Object value = privilegedGetField(field,o); - if (null == value) { + if (null == value) { values[i] = "null"; } else if (rendering.contains(value)) { values[i] = "<recursion>"; @@ -739,9 +739,9 @@ public class LangUtil { }); } catch (PrivilegedActionException e) { return "<IllegalAccessException>"; - } + } } - + private static Field[] nonStaticFields(Field[] fields) { if (null == fields) { return new Field[0]; @@ -767,7 +767,7 @@ public class LangUtil { return fields; } - /** <code> debugStr(source, names, items, null, null, null, null)<code> */ + /** <code> debugStr(source, names, items, null, null, null, null)<code> */ public static String debugStr(Class source, String[] names, Object[] items) { return debugStr(source, null, names, null, items, null, null); } @@ -793,7 +793,7 @@ public class LangUtil { * @param suffix the String to delimit the end of the name/value instances * used only if classname exists */ - public static String debugStr(Class source, String prefix, String[] names, + public static String debugStr(Class source, String prefix, String[] names, String infix, Object[] items, String delimiter, String suffix) { if (null == delimiter) { @@ -819,7 +819,7 @@ public class LangUtil { if (null == items) { items = NONE; } - final int MAX + final int MAX = (names.length > items.length ? names.length : items.length); for (int i = 0; i < MAX; i++) { if (i > 0) { @@ -833,20 +833,20 @@ public class LangUtil { sb.append(infix); } sb.append(items[i] + ""); - } + } } sb.append(suffix); return sb.toString(); } - /** + /** * @return a String with the unqualified class name of the object (or "null") */ public static String unqualifiedClassName(Object o) { return unqualifiedClassName(null == o ? null : o.getClass()); } - /** + /** * @return a String with the unqualified class name of the class (or "null") */ public static String unqualifiedClassName(Class c) { @@ -859,8 +859,8 @@ public class LangUtil { name = name.substring(1 + loc); return name; } - - /** + + /** * Calculate exact diffs and report missing and extra items. * This assumes the input List are not modified concurrently. * @param expectedListIn the List of expected results - treated as empty if null @@ -905,8 +905,8 @@ public class LangUtil { } } // XXX unit test for makeSoftDiffs - /** - * Calculate potentially "soft" diffs using + /** + * Calculate potentially "soft" diffs using * Comparator.compare(expected, actual). * This shallow-copies and sorts the input Lists. * @param expectedListIn the List of expected results - treated as empty if null @@ -943,16 +943,16 @@ public class LangUtil { List actual = new ArrayList(actualListIn); actual.sort(comparator); - Iterator actualIter = actual.iterator(); + Iterator actualIter = actual.iterator(); Object act = null; - + if (missingListOut != null) { missingListOut.addAll(expectedListIn); } if (extraListOut != null) { extraListOut.addAll(actualListIn); } - + // AMC: less efficient, but simplified implementation. Needed since messages can // now match on text content too, and the old algorithm did not cope with two expected // messages on the same line, but with different text content. @@ -971,7 +971,7 @@ public class LangUtil { } } } - + // while (((null != act) || actualIter.hasNext()) // && ((null != exp) || expectedIter.hasNext())) { // if (null == act) { @@ -1019,31 +1019,31 @@ public class LangUtil { // extraListOut.add(actualIter.next()); // } // } - } + } public static class FlattenSpec { - /** + /** * This tells unflatten(..) to throw IllegalArgumentException * if it finds two contiguous delimiters. */ - public static final String UNFLATTEN_EMPTY_ERROR + public static final String UNFLATTEN_EMPTY_ERROR = "empty items not permitted when unflattening"; - /** + /** * This tells unflatten(..) to skip empty items when unflattening * (since null means "use null") */ - public static final String UNFLATTEN_EMPTY_AS_NULL + public static final String UNFLATTEN_EMPTY_AS_NULL = "unflatten empty items as null"; - - /** + + /** * This tells unflatten(..) to skip empty items when unflattening * (since null means "use null") */ public static final String SKIP_EMPTY_IN_UNFLATTEN = "skip empty items when unflattening"; - - /** + + /** * For Ant-style attributes: "item,item" (with escaped commas). - * There is no way when unflattening to distinguish + * There is no way when unflattening to distinguish * values which were empty from those which were null, * so all are unflattened as empty. */ @@ -1051,13 +1051,13 @@ public class LangUtil { = new FlattenSpec(null, "", "\\", ",", null, "") { public String toString() { return "FlattenSpec.COMMA"; } }; - + /** this attempts to mimic ((List)l).toString() */ public static final FlattenSpec LIST = new FlattenSpec("[", "", null, ", ", "]", UNFLATTEN_EMPTY_ERROR) { public String toString() { return "FlattenSpec.LIST"; } }; - + /** how toString renders null values */ public static final String NULL = "<null>"; private static String r(String s) { @@ -1070,13 +1070,13 @@ public class LangUtil { public final String delim; public final String suffix; public final String emptyUnflattened; - private transient String toString; + private transient String toString; public FlattenSpec( - String prefix, - String nullRendering, + String prefix, + String nullRendering, String escape, - String delim, + String delim, String suffix, String emptyUnflattened) { this.prefix = prefix; @@ -1087,7 +1087,7 @@ public class LangUtil { this.emptyUnflattened = emptyUnflattened; throwIaxIfNull(emptyUnflattened, "use UNFLATTEN_EMPTY_AS_NULL"); } - + public String toString() { if (null == toString) { toString = "FlattenSpec(" @@ -1107,7 +1107,7 @@ public class LangUtil { // --------- java runs using Ant // /** // * Run a Java command separately. -// * @param className the fully-qualified String name of the class +// * @param className the fully-qualified String name of the class // * with the main method to run // * @param classpathFiles the File to put on the classpath // * @param args to the main method of the class @@ -1123,15 +1123,15 @@ public class LangUtil { // Path classpath = new Path(project, classpathFiles[0].getAbsolutePath()); // for (int i = 1; i < classpathFiles.length; i++) { // classpath.addExisting(new Path(project, classpathFiles[i].getAbsolutePath())); -// } +// } // // Commandline cmds = new Commandline(); // cmds.addArguments(new String[] {className}); -// cmds.addArguments(args); +// cmds.addArguments(args); // // ExecuteJava runner = new ExecuteJava(); // runner.setClasspath(classpath); -// runner.setJavaCommand(cmds); +// runner.setJavaCommand(cmds); // if (null != outSink) { // runner.setOutput(outSink); // XXX todo // } @@ -1145,14 +1145,14 @@ public class LangUtil { // String[] args, // PrintStream outSink) { // StringBuffer sb = new StringBuffer(); -// +// // sb.append("c:/apps/jdk1.3.1/bin/java.exe -classpath \""); // for (int i = 0; i < classpathFiles.length; i++) { // if (i < 0) { // sb.append(";"); // } -// sb.append(classpathFiles[i].getAbsolutePath()); -// } +// sb.append(classpathFiles[i].getAbsolutePath()); +// } // sb.append("\" -verbose " + className); // for (int i = 0; i < args.length; i++) { // sb.append(" " + args[i]); @@ -1173,14 +1173,14 @@ public class LangUtil { // String[] args, // PrintStream outSink) throws Throwable { // StringBuffer sb = new StringBuffer(); -// +// // sb.append("c:\\apps\\jdk1.3.1\\bin\\java.exe -classpath \""); // for (int i = 0; i < classpathFiles.length; i++) { // if (i > 0) { // sb.append(";"); // } -// sb.append(classpathFiles[i].getAbsolutePath()); -// } +// sb.append(classpathFiles[i].getAbsolutePath()); +// } // sb.append("\" -verbose " + className); // for (int i = 0; i < args.length; i++) { // sb.append(" " + args[i]); @@ -1189,8 +1189,8 @@ public class LangUtil { // System.err.println("launching process: " + command); // Process process = Runtime.getRuntime().exec(command); // // huh? err/out -// InputStream errStream = null; -// InputStream outStream = null; +// InputStream errStream = null; +// InputStream outStream = null; // Throwable toThrow = null; // int result = -1; // try { diff --git a/testing/src/test/java/org/aspectj/testing/util/LangUtilTest.java b/testing/src/test/java/org/aspectj/testing/util/LangUtilTest.java index 853e51f50..e5f991544 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LangUtilTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/LangUtilTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -25,12 +25,12 @@ import junit.framework.TestResult; import junit.textui.TestRunner; /** - * + * * @author isberg */ public class LangUtilTest extends TestCase { - private static final String ME + private static final String ME = "org.aspectj.testing.util.LangUtilTest"; /** @param args ignored */ @@ -45,7 +45,7 @@ public class LangUtilTest extends TestCase { System.err.println(r.errorCount() + "/" + r.failureCount()); } } - + /** * Constructor for LangUtilTest. * @param name @@ -63,37 +63,37 @@ public class LangUtilTest extends TestCase { } assertTrue(l, !st.hasMoreTokens()); } - + void checkUnflatten(FTest test) { String[] exp = test.unflattened; List result = LangUtil.unflatten(test.toUnflatten, test.spec); String label = test + " -> " + result; assertNotNull(label, result); - - assertEquals(label, exp.length, result.size()); + + assertEquals(label, exp.length, result.size()); for (int i = 0; i < exp.length; i++) { assertEquals(label, exp[i], result.get(i)); } } - + public void skiptestUnflatten() { // LangUtil.FlattenSpec COMMA = LangUtil.FlattenSpec.COMMA; LangUtil.FlattenSpec LIST = LangUtil.FlattenSpec.LIST; - + FTest[] tests = new FTest[] { new FTest("[]", new String[0], LIST) , new FTest("[1]", new String[] {"1"}, LIST) , new FTest("[1, 2]", new String[] {"1", "2"}, LIST) , new FTest("[1,2]", new String[] {"1,2"}, LIST) - , new FTest("[1, 2, 3]", new String[] {"1","2","3"}, LIST) + , new FTest("[1, 2, 3]", new String[] {"1","2","3"}, LIST) }; for (FTest test : tests) { checkUnflatten(test); } } - + public void testArrayList() { List l = new ArrayList(); @@ -104,33 +104,33 @@ public class LangUtilTest extends TestCase { assertTrue(2 == l.size()); assertEquals("[null, null]", "" + l); } - + public void testCombineStrings() { String[] one = new String[]{}; String[] two = new String[]{}; String[] expect = new String[]{}; checkCombineStrings(one, two, expect); - + one = new String[]{null}; two = new String[]{null}; expect = new String[]{}; checkCombineStrings(one, two, expect); - + one = new String[]{"1"}; two = new String[]{null}; expect = new String[]{"1"}; checkCombineStrings(one, two, expect); - + one = new String[]{null}; two = new String[]{"2"}; expect = new String[]{"2"}; checkCombineStrings(one, two, expect); - + one = new String[]{"1"}; two = new String[]{"2"}; expect = new String[]{"1", "2"}; checkCombineStrings(one, two, expect); - + one = new String[]{null, null, "1", null, null}; two = new String[]{null, "2", null}; expect = new String[]{"1", "2"}; @@ -140,7 +140,7 @@ public class LangUtilTest extends TestCase { two = new String[]{"5", null, "6"}; expect = new String[]{"1", "2", "3", "4", "5", "6"}; checkCombineStrings(one, two, expect); - + } void checkCombineStrings(String[] one, String[] two, String[] expected) { String[] actual = LangUtil.combine(one, two); @@ -149,7 +149,7 @@ public class LangUtilTest extends TestCase { String both = "actual=\"" + aString + "\" expected=\"" + eString + "\""; assertTrue(both, aString.equals(eString)); } - + final String[] sABCDE = new String[] {"A", "B", "C", "D", "E" }; final String[] sABC = new String[] {"A", "B", "C" }; final String[] sDE = new String[] {"D", "E" }; @@ -209,10 +209,10 @@ public class LangUtilTest extends TestCase { Collections.shuffle(rl79); Collections.shuffle(rl24); Collections.shuffle(rl0); - Collections.shuffle(rl068); + Collections.shuffle(rl068); } - - + + public void testDiffsEmptyIdentities() { checkDiff(l02468, null, l02468, NONE); checkDiff(null, l02468, NONE, l02468); @@ -243,14 +243,14 @@ public class LangUtilTest extends TestCase { checkDiff(l02468, l12345, l068, l135); checkDiff(rl02468, rl12345, rl068, rl135); } - + public void testDiffsOdds() { checkDiff(l13579, l12345, l79, l24); checkDiff(rl13579, rl12345, rl79, rl24); checkDiff(l13579, rl12345, l79, rl24); checkDiff(rl13579, l12345, rl79, l24); } - + public void testSoftDiffs() { checkDiffSoft(labcde, lABCDE, NONE, NONE); checkDiffSoft(lABC, labc, NONE, NONE); @@ -273,7 +273,7 @@ public class LangUtilTest extends TestCase { return list; } } - + /** check both hard and soft - assuming list contain String */ void checkDiff(List expected, List actual, List missing, List extra) { List extraOut = new ArrayList(); @@ -283,13 +283,13 @@ public class LangUtilTest extends TestCase { checkSame(extra, extraOut); extraOut.clear(); missingOut.clear(); - + LangUtil.makeSoftDiffs(expected, actual, missingOut, extraOut, String.CASE_INSENSITIVE_ORDER); checkSame(missing, missingOut); // XXX does not detect bad order - checkSame(extra, extraOut); + checkSame(extra, extraOut); } - + void checkSame(Collection one, Collection two) { // just convert and string-compare? String label = one + "?=" + two; assertTrue(label, (null == one) == (null == two)); @@ -306,7 +306,7 @@ public class LangUtilTest extends TestCase { LangUtil.makeSoftDiffs(expected, actual, missingOut, extraOut, String.CASE_INSENSITIVE_ORDER); checkSameSoft(missing, missingOut); - checkSameSoft(extra, extraOut); + checkSameSoft(extra, extraOut); } /** @param one modifiable List of String @@ -326,7 +326,7 @@ public class LangUtilTest extends TestCase { assertTrue(label, sone.equals(stwo)); } } - + static class FTest { String toUnflatten; String[] unflattened; @@ -337,7 +337,7 @@ public class LangUtilTest extends TestCase { this.spec = spec; } public String toString() { - return "FTest(" + return "FTest(" + "toUnflatten=" + toUnflatten + ", unflattened=" + Arrays.asList(unflattened) + ", spec=" + spec @@ -345,5 +345,5 @@ public class LangUtilTest extends TestCase { } } - + } diff --git a/testing/src/test/java/org/aspectj/testing/util/LineReader.java b/testing/src/test/java/org/aspectj/testing/util/LineReader.java index 0c75aa9d1..b8a29ebdd 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LineReader.java +++ b/testing/src/test/java/org/aspectj/testing/util/LineReader.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -28,25 +28,25 @@ import java.util.ArrayList; public class LineReader extends LineNumberReader { /** delimited multi-line output of readToBlankLine */ public static final String RETURN= "\n\r"; - + private static final String[] NONE = new String[0]; private static final String cSCRIPT = "#"; private static final String cJAVA = "//"; private static final String[] TESTER_LEAD = new String[] {cSCRIPT, cJAVA}; - - /** + + /** * Convenience factory for tester suite files * @return null if IOException or IllegalArgumentException thrown */ public static final LineReader createTester(File file) { return create(file, TESTER_LEAD, null); } - - /** - * convenience factory + + /** + * convenience factory * @return null if IOException or IllegalArgumentException thrown */ - public static final LineReader create(File file, + public static final LineReader create(File file, String[] leadComments, String[] eolComments) { try { FileReader reader = new FileReader(file); @@ -56,11 +56,11 @@ public class LineReader extends LineNumberReader { } return null; } - + final private File file; final private String[] eolComments; final private String[] leadComments; - + /** * @param file the File used to open the FileReader * @param leadComments the String[] to be taken as the start of @@ -71,9 +71,9 @@ public class LineReader extends LineNumberReader { *@throws IllegalArgumentException if any String in * leadComments or eolComments is null. */ - public LineReader(FileReader reader, File file, + public LineReader(FileReader reader, File file, String[] leadComments, String[] eolComments) { - super(reader); + super(reader); this.file = file; this.eolComments = normalize(eolComments); this.leadComments = normalize(leadComments); @@ -81,12 +81,12 @@ public class LineReader extends LineNumberReader { public LineReader(FileReader reader, File file) { this(reader, file, null, null); } - + /** @return file:line */ public String toString() { return file.getPath() + ":" + getLineNumber(); } - + /** @return underlying file */ public File getFile() { return file; } @@ -96,9 +96,9 @@ public class LineReader extends LineNumberReader { * reader has not read past the first line and there are last lines * and there are no IOExceptions during reads. * @param first the first line to read - if negative, use 0 - * @param last the last line to read (inclusive) + * @param last the last line to read (inclusive) * - if less than first, use first - * @return String[] of first..last (inclusive) lines read or + * @return String[] of first..last (inclusive) lines read or */ public String[] readLines(int first, int last) { if (0 > first) first = 0; @@ -106,13 +106,13 @@ public class LineReader extends LineNumberReader { ArrayList list = new ArrayList(); try { String line = null; - while (getLineNumber() < first) { + while (getLineNumber() < first) { line = readLine(); if (null == line) { - break; + break; } } - if (getLineNumber() > first) { + if (getLineNumber() > first) { // XXX warn? something else read past line } if ((null != line) && (first == getLineNumber())) { @@ -130,8 +130,8 @@ public class LineReader extends LineNumberReader { } return (String[]) list.toArray(NONE); } - - /** Skip to next blank line + + /** Skip to next blank line * @return the String containing all lines skipped (delimited with RETURN) */ public String readToBlankLine() throws IOException { diff --git a/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java b/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java index 973f57b97..103d201d2 100644 --- a/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java +++ b/testing/src/test/java/org/aspectj/testing/util/LinkCheck.java @@ -1,13 +1,13 @@ /* ******************************************************************* - * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * Copyright (c) 2003 Contributors. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -50,7 +50,7 @@ public class LinkCheck { * - https MalformedUrlExceptions on redirect * - Swing won't quit without System.exit * - single-threaded - */ + */ static final URL COMMAND_LINE; static { URL commandLine = null; @@ -63,8 +63,8 @@ public class LinkCheck { /** @param args file {-logFile {file} | -printInfo } */ public static void main(String[] args) { - final String syntax = "java " - + LinkCheck.class.getName() + final String syntax = "java " + + LinkCheck.class.getName() + " file {-log <file> | -printInfo}.."; if ((null == args) || (0 >= args.length)) { System.err.println(syntax); @@ -80,7 +80,7 @@ public class LinkCheck { printInfo = true; } else { System.err.println(syntax); - System.exit(1); + System.exit(1); } } final boolean useSystemOut = (null == logFile); @@ -90,7 +90,7 @@ public class LinkCheck { mh = new MessageHandler(); out = null; } else { - + try { out = new FileOutputStream(logFile); } catch (FileNotFoundException e) { @@ -109,9 +109,9 @@ public class LinkCheck { }; } - Link.Check exists + Link.Check exists = Link.getProtocolChecker(new String[] {"file", "http"}); - Link.Check contents + Link.Check contents = Link.getProtocolChecker(new String[] {"file"}); LinkCheck me = new LinkCheck(mh, exists, contents); me.addLinkToCheck(COMMAND_LINE, startingURL); // pwd as base? @@ -141,7 +141,7 @@ public class LinkCheck { try { if (null != out) { out.flush(); - } + } } catch (IOException e) { // ignore } @@ -162,23 +162,23 @@ public class LinkCheck { // private static boolean isCheckedFileType(URL url) { // if (null == url) { // return false; -// } +// } // String file = url.getFile(); // return !FileUtil.hasZipSuffix(file) // && !file.endsWith(".pdf"); // } - + private final Messages messages; private final HTMLEditorKit.Parser parser; // XXX untested - stateful private final List<Link> linksToCheck; private final List<String> checkedUrls; // String (URL.toString) private final List<String> validRefs; // String (URL.toString) private final List<String> refsToCheck; // String (URL.toString) - + private final Link.Check checkExists; private final Link.Check checkContents; - public LinkCheck(IMessageHandler handler, + public LinkCheck(IMessageHandler handler, Link.Check checkExists, Link.Check checkContents) { LangUtil.throwIaxIfNull(handler, "handler"); @@ -277,7 +277,7 @@ public class LinkCheck { } URL url = link.url; InputStream input = null; - try { + try { URLConnection connection = url.openConnection(); if (null == connection) { messages.cantOpenConnection(url); @@ -342,16 +342,16 @@ public class LinkCheck { } catch (MalformedURLException e) { messages.malformedUrl(doc, namedRef, e); return false; - } + } } - + private class Messages { private final IMessageHandler handler; private Messages(IMessageHandler handler) { LangUtil.throwIaxIfNull(handler, "handler"); this.handler = handler; } - + private void info(String label, Object more) { MessageUtil.info(handler, label + " " + more); } @@ -404,15 +404,15 @@ public class LinkCheck { private void malformedUrl(URL doc, String link, MalformedURLException e) { fail("malformedUrl", "doc=" + doc + " link=" + link, e); } - + private void cantOpenConnection(URL url) { fail("cantOpenConnection", url, null); } - + private void exceptionReading(Link link, IOException e) { // only info if redirect from http to https String m = e.getMessage(); - if ((m != null) + if ((m != null) && (m.contains("protocol")) && (m.contains("https")) && "http".equals(link.url.getProtocol())) { @@ -421,11 +421,11 @@ public class LinkCheck { } fail("exceptionReading", link, e); } - + private void nullLink(URL doc, Tag tag) { // ignore - many tags do not have links } - + private void emptyLink(URL doc, Tag tag) { fail("emptyLink", "doc=" + doc + " tag=" + tag, null); } @@ -458,7 +458,7 @@ public class LinkCheck { if (!addingLinks) { return; } - Object key = HTML.Tag.FRAME == tag + Object key = HTML.Tag.FRAME == tag ? HTML.Attribute.SRC : HTML.Attribute.HREF; String link = (String) attributes.getAttribute(key); @@ -475,21 +475,21 @@ public class LinkCheck { addLinkToCheck(doc, link); } } - + private boolean registerIfNamedAnchor( HTML.Tag tag, MutableAttributeSet attributes) { if (HTML.Tag.A.equals(tag)) { - String name + String name = (String) attributes.getAttribute(HTML.Attribute.NAME); if (null != name) { addKnownNamedAnchor(doc, name); return true; - } + } } return false; } - + } private static class Link { @@ -498,7 +498,7 @@ public class LinkCheck { public boolean check(URL url) { return false; } }; private static Check getProtocolChecker(String[] protocols) { - final String[] input + final String[] input = (String[]) LangUtil.safeCopy(protocols, protocols); if (0 == input.length) { return FALSE_CHECKER; @@ -522,7 +522,7 @@ public class LinkCheck { public boolean equals(Object o) { if (null == o) { return false; - } + } if (this == o) { return true; } @@ -533,12 +533,12 @@ public class LinkCheck { return doc.equals(other) && url.equals(other); //return toString().equals(o.toString()); } - + public int hashCode() { // XXX return doc.hashCode() + (url.hashCode() >> 4); // return toString.hashCode(); } - + public String toString() { if (null == toString) { toString = url + " linked from " + doc; diff --git a/testing/src/test/java/org/aspectj/testing/util/MessageUtilTest.java b/testing/src/test/java/org/aspectj/testing/util/MessageUtilTest.java index 178cb88bb..e1ae649d5 100644 --- a/testing/src/test/java/org/aspectj/testing/util/MessageUtilTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/MessageUtilTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -31,18 +31,18 @@ import org.aspectj.bridge.SourceLocation; import junit.framework.TestCase; /** - * + * */ public class MessageUtilTest extends TestCase { public MessageUtilTest(String s) { super(s); } - + MessageHandler samples; List /* Exception */ exceptions; List /*ISourceLocation*/ locations; List /*String */ messageTexts; - + public void testMessageRendering() { MessageHandler messages = getSampleMessages(); @@ -76,7 +76,7 @@ public class MessageUtilTest extends TestCase { } return messageTexts; } - + List getSampleExceptions() { if (null == exceptions) { List result = new ArrayList(); @@ -119,5 +119,5 @@ public class MessageUtilTest extends TestCase { } return result; } - + } diff --git a/testing/src/test/java/org/aspectj/testing/util/Node.java b/testing/src/test/java/org/aspectj/testing/util/Node.java index 9439e57e4..9cbf1304f 100644 --- a/testing/src/test/java/org/aspectj/testing/util/Node.java +++ b/testing/src/test/java/org/aspectj/testing/util/Node.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -23,14 +23,14 @@ import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; -/** +/** * A node in a tree containing other Node or SpecElements items. */ public class Node { // XXX render public static final Node[] EMPTY_NODES = new Node[0]; public static final Object[] EMPTY_ITEMS = new Object[0]; - /** + /** * Visit all the SpecElements (and Node) reachable from node * in depth-first order, halting if checker objects. * @param node the Node to pass to checker @@ -48,7 +48,7 @@ public class Node { // XXX render Node[] nodes = node.getNodes(); for (int i = 0; result && (i < nodes.length); i++) { - result = (null == nodeVisitor + result = (null == nodeVisitor ? visit(nodes[i], itemChecker, null) : nodeVisitor.isValid(nodes[i])); } @@ -82,7 +82,7 @@ public class Node { // XXX render this(name, type, name); } /** */ - public Node(String name, Class type, Object key) { + public Node(String name, Class type, Object key) { if (null == name) { throw new IllegalArgumentException("null name"); } @@ -100,14 +100,14 @@ public class Node { // XXX render typeArray = (Object[]) Array.newInstance(type, 0); } - /** + /** * clear all items and nodes. */ public void clear() { // XXX synchronize nodes.clear(); items.clear(); } - + /** * Add item to list of items * unless it is null, of the wrong type, or the collection fails to add diff --git a/testing/src/test/java/org/aspectj/testing/util/NullPrintStream.java b/testing/src/test/java/org/aspectj/testing/util/NullPrintStream.java index 686c9c8e2..7a96c9c1b 100644 --- a/testing/src/test/java/org/aspectj/testing/util/NullPrintStream.java +++ b/testing/src/test/java/org/aspectj/testing/util/NullPrintStream.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ diff --git a/testing/src/test/java/org/aspectj/testing/util/ObjectChecker.java b/testing/src/test/java/org/aspectj/testing/util/ObjectChecker.java index 284014e4f..b25d533d0 100644 --- a/testing/src/test/java/org/aspectj/testing/util/ObjectChecker.java +++ b/testing/src/test/java/org/aspectj/testing/util/ObjectChecker.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/util/ProxyPrintStream.java b/testing/src/test/java/org/aspectj/testing/util/ProxyPrintStream.java index 5c5bbe9de..cb6979186 100644 --- a/testing/src/test/java/org/aspectj/testing/util/ProxyPrintStream.java +++ b/testing/src/test/java/org/aspectj/testing/util/ProxyPrintStream.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; diff --git a/testing/src/test/java/org/aspectj/testing/util/RunUtils.java b/testing/src/test/java/org/aspectj/testing/util/RunUtils.java index 21e1b6ebf..0e60ca6d6 100644 --- a/testing/src/test/java/org/aspectj/testing/util/RunUtils.java +++ b/testing/src/test/java/org/aspectj/testing/util/RunUtils.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/util/SFileReader.java b/testing/src/test/java/org/aspectj/testing/util/SFileReader.java index 1dc5352df..feaade283 100644 --- a/testing/src/test/java/org/aspectj/testing/util/SFileReader.java +++ b/testing/src/test/java/org/aspectj/testing/util/SFileReader.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/util/StandardObjectChecker.java b/testing/src/test/java/org/aspectj/testing/util/StandardObjectChecker.java index bc2f520ad..e11544f2a 100644 --- a/testing/src/test/java/org/aspectj/testing/util/StandardObjectChecker.java +++ b/testing/src/test/java/org/aspectj/testing/util/StandardObjectChecker.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -34,7 +34,7 @@ public class StandardObjectChecker implements ObjectChecker { private final ObjectChecker delegate; private final List collector; private final boolean collectionResult; - + /** * Create one with no delegate. * @param type the Class of the type required of the input @@ -42,7 +42,7 @@ public class StandardObjectChecker implements ObjectChecker { public StandardObjectChecker(Class type) { this(type, ANY, (List) null, true); } - + /** * @param type the Class of the type required of the input * @param delegate the ObjectChecker to delegate to after @@ -60,7 +60,7 @@ public class StandardObjectChecker implements ObjectChecker { public StandardObjectChecker(Class type, List collector) { this(type, ANY, collector, true); } - + /** * @param type the Class of the type required of the input * @param collector the list to collect valid entries @@ -69,12 +69,12 @@ public class StandardObjectChecker implements ObjectChecker { public StandardObjectChecker(Class type, List collector, boolean collectionResult) { this(type, ANY, collector, collectionResult); } - + /** * @param type the Class of the type required of the input * @param collector the list to collect valid entries */ - public StandardObjectChecker(Class type, ObjectChecker delegate, + public StandardObjectChecker(Class type, ObjectChecker delegate, List collector, boolean collectionResult) { if (null == type) throw new IllegalArgumentException("null type"); this.type = type; @@ -82,14 +82,14 @@ public class StandardObjectChecker implements ObjectChecker { this.collector = collector; this.collectionResult = collectionResult; } - + /** * Check if object is valid by confirming is is non-null and of the * right type, then delegating to any delegate or calling doIsValid(), * then (if true) passing to any collector, and returning * false if the collector failed or the collection result otherwise. * @see ObjectChecker#isValid(Object) - * @return true unless input is null or wrong type + * @return true unless input is null or wrong type * or if one of subclass (doIsValid(..)) or delegates * (list, collector) returns false. */ @@ -100,7 +100,7 @@ public class StandardObjectChecker implements ObjectChecker { if (!delegate.isValid(input)) { return false; } - } + } if (!doIsValid(input)) { return false; } @@ -112,7 +112,7 @@ public class StandardObjectChecker implements ObjectChecker { return collectionResult; } } - + /** * Delegate of isValid guarantees that the input * is not null as is assignable to the specified type. diff --git a/testing/src/test/java/org/aspectj/testing/util/StreamGrabberTest.java b/testing/src/test/java/org/aspectj/testing/util/StreamGrabberTest.java index 80ff2ea1a..44ba1722d 100644 --- a/testing/src/test/java/org/aspectj/testing/util/StreamGrabberTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/StreamGrabberTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -26,13 +26,13 @@ import junit.framework.TestResult; import junit.textui.TestRunner; /** - * + * * @author isberg */ public class StreamGrabberTest extends TestCase { - private static final String ME + private static final String ME = "org.aspectj.testing.util.StreamGrabberTest"; /** @param args ignored */ @@ -49,16 +49,16 @@ public class StreamGrabberTest extends TestCase { } public StreamGrabberTest(String s) { super(s); } - + public void testHide() { PrintStream restore = System.out; System.setOut(new PrintStream(NullPrintStream.NULL_OutputStream)); System.out.println("OutputStream should not print!!!!!!!!!!!!!!!!!!!"); System.setOut(new PrintStream(NullPrintStream.NULL_PrintStream)); System.out.println("PrintStream should not print!!!!!!!!!!!!!!!!!!!"); - System.setOut(restore); + System.setOut(restore); } - + /** * Test StreamSniffer by setting up a delegate System.out * and a normal System.out (delegating to System.out) @@ -77,7 +77,7 @@ public class StreamGrabberTest extends TestCase { printLoop("f", buf, delegate); printLoop("now is the time for all good men...", buf, delegate); printlnLoop("f", buf, delegate); - printlnLoop("now is the time for all good men...", buf, delegate); + printlnLoop("now is the time for all good men...", buf, delegate); } private void printLoop(String expect, StringBuffer buf, StringBuffer delegate) { @@ -89,7 +89,7 @@ public class StreamGrabberTest extends TestCase { buf.setLength(0); delegate.setLength(0); System.out.print(expect); - + actual = buf.toString(); delegateActual = delegate.toString(); assertTrue(expect + "=" + actual, expect.equals(actual)); @@ -97,7 +97,7 @@ public class StreamGrabberTest extends TestCase { buf.setLength(0); delegate.setLength(0); } - + private void printlnLoop(String expect, StringBuffer buf, StringBuffer delegate) { // copy/paste of printLoop, using println expect = expect.trim(); @@ -108,7 +108,7 @@ public class StreamGrabberTest extends TestCase { assertTrue(expect + "=" + delegateActual, expect.equals(delegateActual)); buf.setLength(0); delegate.setLength(0); - + System.out.println(expect); actual = buf.toString().trim(); delegateActual = delegate.toString().trim(); diff --git a/testing/src/test/java/org/aspectj/testing/util/StreamSniffer.java b/testing/src/test/java/org/aspectj/testing/util/StreamSniffer.java index cb143604e..bc39f7025 100644 --- a/testing/src/test/java/org/aspectj/testing/util/StreamSniffer.java +++ b/testing/src/test/java/org/aspectj/testing/util/StreamSniffer.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -31,7 +31,7 @@ public class StreamSniffer extends FilterOutputStream { StringBuffer buffer; /** have to use delegate, not super, because super we will double-count input */ final OutputStream delegate; - + public StreamSniffer(OutputStream stream) { super(stream); delegate = stream; @@ -42,11 +42,11 @@ public class StreamSniffer extends FilterOutputStream { buffer = sb; } - //---------------- FilterOutputStream + //---------------- FilterOutputStream public void write(int b) throws IOException { StringBuffer sb = buffer; if (null != sb) { - if ((b > Character.MAX_VALUE) + if ((b > Character.MAX_VALUE) || (b < Character.MIN_VALUE)) { throw new Error("don't know double-byte"); // XXX } else { @@ -55,7 +55,7 @@ public class StreamSniffer extends FilterOutputStream { } delegate.write(b); } - + public void write(byte[] b) throws IOException { StringBuffer sb = buffer; if (null != sb) { @@ -64,7 +64,7 @@ public class StreamSniffer extends FilterOutputStream { } delegate.write(b); } - + public void write(byte[] b, int offset, int length) throws IOException { StringBuffer sb = buffer; if (null != sb) { diff --git a/testing/src/test/java/org/aspectj/testing/util/StreamsHandler.java b/testing/src/test/java/org/aspectj/testing/util/StreamsHandler.java index fc69d9900..c4cea7e80 100644 --- a/testing/src/test/java/org/aspectj/testing/util/StreamsHandler.java +++ b/testing/src/test/java/org/aspectj/testing/util/StreamsHandler.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -51,7 +51,7 @@ public class StreamsHandler { /** if logToOut, then out, else err */ private final PrintStream log; - + /** true if the last logged item was a newline */ private boolean loggedLine; @@ -80,7 +80,7 @@ public class StreamsHandler { /** * @param listen possible to sniff streams only if true - * @param logToOut if true, then log methods go to System.out -- otherwise, System.err. + * @param logToOut if true, then log methods go to System.out -- otherwise, System.err. */ public StreamsHandler( boolean listen, @@ -125,7 +125,7 @@ public class StreamsHandler { public PrintStream getLogStream() { return log; } - + /** log item without newline. */ public void log(String s) { log.print(s); @@ -134,9 +134,9 @@ public class StreamsHandler { } } - /** + /** * Log item with newline. - * If previous log did not have a newline, + * If previous log did not have a newline, * then this prepends a newline. */ public void lnlog(String s) { @@ -146,7 +146,7 @@ public class StreamsHandler { log.println(s); } - /** + /** * Start listening to both streams. * Tosses any old data captured. * (Has no effect if not listening.) @@ -170,7 +170,7 @@ public class StreamsHandler { } } - /** + /** * End listening to both streams and return data captured. * Must call startListening() first. * @throws IllegalStateException if called when not listening @@ -181,10 +181,10 @@ public class StreamsHandler { return endListening(true); } - /** + /** * End listening to both streams and return data captured. * Must call startListening() first. - * @param getResult if false, return Result.EMPTY + * @param getResult if false, return Result.EMPTY * and avoid converting buffer to String. * @throws IllegalStateException if called when not listening * @return Result with sniffed output and error String @@ -201,7 +201,7 @@ public class StreamsHandler { : new Result(outListener.toString(), errListener.toString())); errListener = null; outListener = null; - return result; + return result; } /** output and error String */ diff --git a/testing/src/test/java/org/aspectj/testing/util/StringAccumulator.java b/testing/src/test/java/org/aspectj/testing/util/StringAccumulator.java index 234592386..9ab2b6383 100644 --- a/testing/src/test/java/org/aspectj/testing/util/StringAccumulator.java +++ b/testing/src/test/java/org/aspectj/testing/util/StringAccumulator.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -39,14 +39,14 @@ public class StringAccumulator implements ObjectChecker { public StringAccumulator(String delimiter) { this(delimiter, null, null, ""); } - + /** - * Constructor for StringAccumulator which specifies how to + * Constructor for StringAccumulator which specifies how to * process each result, optionally postfixing or prefixing * or infixing (adding index plus infix to prefix). e.g., * for prefix="[", infix="]\"", postfix="\"\n", then each entry * becomes a line: <pre>"[{index}]"{entry}"\n</pre> - * + * * @param prefix if not null, prepend to each result * @param infix if not null, the add index and infix before each result, after prefix * @param postfix if not null, append to each result @@ -60,10 +60,10 @@ public class StringAccumulator implements ObjectChecker { this.nullString = nullString; sb = new StringBuffer(); } - + /** Clear buffer and index */ - public synchronized void clear() { - sb.setLength(0); + public synchronized void clear() { + sb.setLength(0); index = 0; } @@ -85,7 +85,7 @@ public class StringAccumulator implements ObjectChecker { if (null != suffix) sb.append(suffix); return true; } - + /** @return result accumulated so far */ public String toString() { return sb.toString(); diff --git a/testing/src/test/java/org/aspectj/testing/util/StringVisitor.java b/testing/src/test/java/org/aspectj/testing/util/StringVisitor.java index 02f7459c3..e8e2b03b1 100644 --- a/testing/src/test/java/org/aspectj/testing/util/StringVisitor.java +++ b/testing/src/test/java/org/aspectj/testing/util/StringVisitor.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/util/StructureModelUtil.java b/testing/src/test/java/org/aspectj/testing/util/StructureModelUtil.java index 8bde398ed..e49f11b24 100644 --- a/testing/src/test/java/org/aspectj/testing/util/StructureModelUtil.java +++ b/testing/src/test/java/org/aspectj/testing/util/StructureModelUtil.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -44,7 +44,7 @@ public class StructureModelUtil { /** * Check the properties of the current model. The parameter string lists properties of the model that should be correct. If any * of the properties are incorrect, a ModelIncorrectException is thrown. - * + * * @param toCheck comma separated list of name=value pairs that should be found in the ModelInfo object * @throws ModelIncorrectException thrown if any of the name=value pairs in toCheck are not found */ @@ -76,9 +76,9 @@ public class StructureModelUtil { /** * This method returns a map from affected source lines in a class to a List of aspects affecting that line. Based on method of * same name by mik kirsten. To be replaced when StructureModelUtil corrects its implementation - * + * * @param the full path of the source file to get a map for - * + * * @return a Map from line numbers to a List of ProgramElementNodes. */ public static Map getLinesToAspectMap(String sourceFilePath) { @@ -139,7 +139,7 @@ public class StructureModelUtil { /** * This method is copied from StructureModelUtil inoder for it to use the working version of getLineToAspectMap() - * + * * @return the set of aspects with advice that affects the specified package */ public static Set getAspectsAffectingPackage(IProgramElement packageNode) { @@ -206,7 +206,7 @@ public class StructureModelUtil { // SortArrayComparator comparator = new SortArrayComparator(); // // Arrays.sort(temp, comparator); - // + // // List newElements = Arrays.asList(temp); // // return newElements; diff --git a/testing/src/test/java/org/aspectj/testing/util/StructureModelUtilTest.java b/testing/src/test/java/org/aspectj/testing/util/StructureModelUtilTest.java index 0b9d7ef41..0a25826cf 100644 --- a/testing/src/test/java/org/aspectj/testing/util/StructureModelUtilTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/StructureModelUtilTest.java @@ -1,14 +1,14 @@ /* ******************************************************************* * 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: + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: * Xerox/PARC initial implementation - * Helen Hawkins Converted to new interface (bug 148190) + * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ package org.aspectj.testing.util; @@ -55,9 +55,9 @@ public class StructureModelUtilTest extends AjdeCoreTestCase { // Map lineAdviceMap = StructureModelUtil.getLinesToAspectMap( // ((IProgramElement)files.get(0)).getSourceLocation().getSourceFile().getAbsolutePath() // ); - // + // // assertTrue("line->advice map not null", lineAdviceMap != null); - // + // // Set aspects = StructureModelUtil.getAspectsAffectingPackage(packageNode); // assertTrue("aspect list not null", aspects != null); } diff --git a/testing/src/test/java/org/aspectj/testing/util/TestClassLoader.java b/testing/src/test/java/org/aspectj/testing/util/TestClassLoader.java index cac9816cd..2de72e6d6 100644 --- a/testing/src/test/java/org/aspectj/testing/util/TestClassLoader.java +++ b/testing/src/test/java/org/aspectj/testing/util/TestClassLoader.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -35,28 +35,28 @@ public class TestClassLoader extends URLClassLoader { /** save URL[] only for toString */ private URL[] urlsForDebugString; - + public TestClassLoader(URL[] urls, File[] dirs) { super(urls); this.urlsForDebugString = urls; LangUtil.throwIaxIfComponentsBad(dirs, "dirs", null); List dcopy = new ArrayList(); - + if (!LangUtil.isEmpty(dirs)) { dcopy.addAll(Arrays.asList(dirs)); } this.dirs = Collections.unmodifiableList(dcopy); } - + public URL getResource(String name) { return ClassLoader.getSystemResource(name); } - + public InputStream getResourceAsStream(String name) { return ClassLoader.getSystemResourceAsStream(name); - } - + } + /** We don't expect test classes to have prefixes java, org, or com */ protected boolean maybeTestClassName(String name) { return (null != name) @@ -64,10 +64,10 @@ public class TestClassLoader extends URLClassLoader { && !name.startsWith("org.") && !name.startsWith("com."); } - + public synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - // search the cache, our dirs (if maybe test), + // search the cache, our dirs (if maybe test), // the system, the superclass (URL[]), // and our dirs again (if not maybe test) ClassNotFoundException thrown = null; @@ -83,10 +83,10 @@ public class TestClassLoader extends URLClassLoader { } // handle ClassFormatError? } if (null == result) { - try { - result = findSystemClass(name); - } catch (ClassNotFoundException e) { - thrown = e; + try { + result = findSystemClass(name); + } catch (ClassNotFoundException e) { + thrown = e; } } if (null == result) { @@ -96,16 +96,16 @@ public class TestClassLoader extends URLClassLoader { thrown = e; } if (null != result) { // resolved by superclass - return result; + return result; } } if ((null == result) && !maybeTestClass) { byte[] data = readClass(name); if (data != null) { result = defineClass(name, data, 0, data.length); - } // handle ClassFormatError? + } // handle ClassFormatError? } - + if (null == result) { throw (null != thrown ? thrown : new ClassNotFoundException(name)); } @@ -114,7 +114,7 @@ public class TestClassLoader extends URLClassLoader { } return result; } - + /** @return null if class not found or byte[] of class otherwise */ private byte[] readClass(String className) throws ClassNotFoundException { final String fileName = className.replace('.', '/')+".class"; @@ -124,9 +124,9 @@ public class TestClassLoader extends URLClassLoader { return getClassData(file); } } - return null; + return null; } - + private byte[] getClassData(File f) { try { FileInputStream stream= new FileInputStream(f); @@ -143,10 +143,10 @@ public class TestClassLoader extends URLClassLoader { } return null; } - + /** @return String with debug info: urls and classes used */ public String toString() { - return "TestClassLoader(urls=" + return "TestClassLoader(urls=" + Arrays.asList(urlsForDebugString) + ", dirs=" + dirs 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 bdb66dc08..00f53a052 100644 --- a/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java +++ b/testing/src/test/java/org/aspectj/testing/util/TestDiffs.java @@ -3,9 +3,9 @@ * 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 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/util/TestDiffsTest.java b/testing/src/test/java/org/aspectj/testing/util/TestDiffsTest.java index a0c5e115f..5d1680520 100644 --- a/testing/src/test/java/org/aspectj/testing/util/TestDiffsTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/TestDiffsTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -26,7 +26,7 @@ import org.aspectj.util.FileUtil; import junit.framework.TestCase; /** - * + * */ public class TestDiffsTest extends TestCase { @@ -47,7 +47,7 @@ public class TestDiffsTest extends TestCase { pw.println("FAIL not in actual (missing-fail)"); pw.flush(); writer.close(); - + writer = new FileWriter(actual); pw = new PrintWriter(writer); pw.println("PASS passed in actual (fixed)"); @@ -63,7 +63,7 @@ public class TestDiffsTest extends TestCase { } finally { if (null != writer) { try { writer.close(); } - catch (IOException e) { } // ignore + catch (IOException e) { } // ignore } } } diff --git a/testing/src/test/java/org/aspectj/testing/util/UtilLineReader.java b/testing/src/test/java/org/aspectj/testing/util/UtilLineReader.java index f077eba52..b46db2ae1 100644 --- a/testing/src/test/java/org/aspectj/testing/util/UtilLineReader.java +++ b/testing/src/test/java/org/aspectj/testing/util/UtilLineReader.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -20,32 +20,32 @@ import java.io.IOException; import java.io.LineNumberReader; import java.util.ArrayList; -/** - * LineNumberReader which absorbs comments and blank lines - * and renders as file:line +/** + * LineNumberReader which absorbs comments and blank lines + * and renders as file:line */ public class UtilLineReader extends LineNumberReader { /** delimited multi-line output of readToBlankLine */ public static final String RETURN= "\n\r"; - + private static final String[] NONE = new String[0]; private static final String cSCRIPT = "#"; private static final String cJAVA = "//"; private static final String[] TESTER_LEAD = new String[] {cSCRIPT, cJAVA}; - - /** + + /** * Convenience factory for tester suite files * @return null if IOException or IllegalArgumentException thrown */ public static final UtilLineReader createTester(File file) { return create(file, TESTER_LEAD, null); } - - /** - * convenience factory + + /** + * convenience factory * @return null if IOException or IllegalArgumentException thrown */ - public static final UtilLineReader create(File file, + public static final UtilLineReader create(File file, String[] leadComments, String[] eolComments) { try { FileReader reader = new FileReader(file); @@ -55,12 +55,12 @@ public class UtilLineReader extends LineNumberReader { } return null; } - + final private File file; final private String[] eolComments; final private String[] leadComments; transient String lastLine; - + /** * @param file the File used to open the FileReader * @param leadComments the String[] to be taken as the start of @@ -71,9 +71,9 @@ public class UtilLineReader extends LineNumberReader { *@throws IllegalArgumentException if any String in * leadComments or eolComments is null. */ - public UtilLineReader(FileReader reader, File file, + public UtilLineReader(FileReader reader, File file, String[] leadComments, String[] eolComments) { - super(reader); + super(reader); this.file = file; this.eolComments = normalize(eolComments); this.leadComments = normalize(leadComments); @@ -81,12 +81,12 @@ public class UtilLineReader extends LineNumberReader { public UtilLineReader(FileReader reader, File file) { this(reader, file, null, null); } - + /** @return file:line */ public String toString() { return file.getPath() + ":" + getLineNumber(); } - + /** @return underlying file */ public File getFile() { return file; } @@ -96,9 +96,9 @@ public class UtilLineReader extends LineNumberReader { * reader has not read past the first line and there are last lines * and there are no IOExceptions during reads. * @param first the first line to read - if negative, use 0 - * @param last the last line to read (inclusive) + * @param last the last line to read (inclusive) * - if less than first, use first - * @return String[] of first..last (inclusive) lines read or + * @return String[] of first..last (inclusive) lines read or */ public String[] readLines(int first, int last) { if (0 > first) first = 0; @@ -106,13 +106,13 @@ public class UtilLineReader extends LineNumberReader { ArrayList list = new ArrayList(); try { String line = null; - while (getLineNumber() < first) { + while (getLineNumber() < first) { line = readLine(); if (null == line) { - break; + break; } } - if (getLineNumber() > first) { + if (getLineNumber() > first) { // XXX warn? something else read past line } if ((null != line) && (first == getLineNumber())) { @@ -130,8 +130,8 @@ public class UtilLineReader extends LineNumberReader { } return (String[]) list.toArray(NONE); } - - /** Skip to next blank line + + /** Skip to next blank line * @return the String containing all lines skipped (delimited with RETURN) */ public String readToBlankLine() throws IOException { @@ -143,15 +143,15 @@ public class UtilLineReader extends LineNumberReader { } return sb.toString(); } - - /** + + /** * lastLine is set only by readClippedLine, not readLine. - * @return the last line read, after clipping + * @return the last line read, after clipping */ public String lastLine() { return lastLine; } - + /** * Get the next line from the input stream, stripping eol and * leading comments. @@ -199,7 +199,7 @@ public class UtilLineReader extends LineNumberReader { lastLine = result; return result; } - + private String[] normalize(String[] input) { if ((null == input) || (0 == input.length)) return NONE; String[] result = new String[input.length]; diff --git a/testing/src/test/java/org/aspectj/testing/util/ValidFileFilter.java b/testing/src/test/java/org/aspectj/testing/util/ValidFileFilter.java index db0e12f5a..ced587b49 100644 --- a/testing/src/test/java/org/aspectj/testing/util/ValidFileFilter.java +++ b/testing/src/test/java/org/aspectj/testing/util/ValidFileFilter.java @@ -1,13 +1,13 @@ /* ******************************************************************* - * Copyright (c) 1999-2000 Xerox 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 - * - * Contributors: - * Xerox/PARC initial implementation + * Copyright (c) 1999-2000 Xerox Corporation. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -17,7 +17,7 @@ import java.io.FileFilter; /** * FileFilter that accepts existing files - * with static singleton variants + * with static singleton variants * made from inner subclasses. */ public class ValidFileFilter implements FileFilter { @@ -31,7 +31,7 @@ public class ValidFileFilter implements FileFilter { //----------------------------- members protected final FileFilter delegate; - protected ValidFileFilter(){ + protected ValidFileFilter(){ this(null); } protected ValidFileFilter(FileFilter delegate){ @@ -39,7 +39,7 @@ public class ValidFileFilter implements FileFilter { } /** - * Implement <code>FileFilter.accept(File)</code> by checking + * Implement <code>FileFilter.accept(File)</code> by checking * taht input is not null, exists, and is accepted by any delegate. */ public boolean accept(File f) { @@ -72,13 +72,13 @@ public class ValidFileFilter implements FileFilter { protected final boolean ignoreCase; /** true if one of the String specifiers is not null */ protected final boolean haveSpecifier; - public StringFileFilter(String prefix, String substring, + public StringFileFilter(String prefix, String substring, String suffix, boolean ignoreCase) { this.ignoreCase = ignoreCase; this.prefix = preprocess(prefix); this.substring = preprocess(substring); this.suffix = preprocess(suffix); - haveSpecifier = ((null != prefix) || (null != substring) + haveSpecifier = ((null != prefix) || (null != substring) || (null != suffix)); } private final String preprocess(String input) { @@ -104,7 +104,7 @@ public class ValidFileFilter implements FileFilter { if ((null != suffix) && (!(path.endsWith(suffix)))) { return false; } - } + } return true; } } // class StringFileFilter diff --git a/testing/src/test/java/org/aspectj/testing/util/WebInstall.java b/testing/src/test/java/org/aspectj/testing/util/WebInstall.java index 3433d55b6..805703ddb 100644 --- a/testing/src/test/java/org/aspectj/testing/util/WebInstall.java +++ b/testing/src/test/java/org/aspectj/testing/util/WebInstall.java @@ -1,13 +1,13 @@ /* ******************************************************************* - * Copyright (c) 1999-2000 Xerox 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 - * - * Contributors: - * Xerox/PARC initial implementation + * Copyright (c) 1999-2000 Xerox Corporation. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ @@ -19,7 +19,7 @@ import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; -/** +/** * Install programmatically using http URL. * (Very strange that java tool classpath does not accept http URL's.) * @@ -31,9 +31,9 @@ import java.net.URLClassLoader; * <p>You can omit the <code>-text install.properties</code> if there is * a file called "install.properties" in the current directory. * - * <p>The properties file must define the properties + * <p>The properties file must define the properties * <code>output.dir</code> and <code>context.javaPath</code> - * in properties- and platform specifie ways. + * in properties- and platform specifie ways. * For property values, a backslash must be escaped with another backslash, * and directory separators should be valid. E.g., on Windows: * <pre>output.dir=c:\\output\\dir @@ -42,7 +42,7 @@ import java.net.URLClassLoader; * For an installer to complete programmatically, * the output directory must be empty of colliding files. * This will fail with a stack trace if anything goes wrong, except for - * simple input errors. + * simple input errors. * * <p>You may also use this as a driver for the known installers * by specifying the following options (-baseurl must be first):<pre> @@ -53,7 +53,7 @@ import java.net.URLClassLoader; * -outdir {path to outDir} (actual form) </pre> * such that URL= * <code>{baseurl}<packagePrefix>{version}<packageSuffix>.jar</code> - * and paths to context.javaPath and output.dir are specified in + * and paths to context.javaPath and output.dir are specified in * properties-compliant format * * @see ant script test-product.xml for example of installing from files @@ -61,20 +61,20 @@ import java.net.URLClassLoader; */ public class WebInstall { private static final String EOL = "\n"; // todo where is this defined? - public static final String SYNTAX + public static final String SYNTAX = "java WebInstall url {args}" + EOL + " url - to installer" + EOL + " args - normally -text install.properties" + EOL + " (if n/a, use install.properties)" + EOL; - /** default arguments assume file <code>install.properties</code> + /** default arguments assume file <code>install.properties</code> * is in current directory */ - private static final String[] ARGS = new String[] + private static final String[] ARGS = new String[] { "-text", "install.properties" }; /** @param args the String[] <code>{ "<url>" {, "-text", "<propsPath>" }</code> */ public static void main(String[] args) throws Exception { - if ((null != args) && (args.length > 0) + if ((null != args) && (args.length > 0) && ("-baseurl".equals(args[0]))) { driver(args); } else { @@ -84,14 +84,14 @@ public class WebInstall { System.err.println("Error installing args "); for (int i = 0; i < args.length; i++) { System.err.println(" " + i + ": " + args[i]); - } + } t.printStackTrace(System.err); } } } /** known .jar packages {(prefix, suffix}...} */ - protected static String[] packages = new String[] + protected static String[] packages = new String[] { "aspectj-tools-", "" , "aspectj-docs-", "" , "ajde-forteModule-", "" @@ -108,7 +108,7 @@ public class WebInstall { * -outdir {path to outDir} (actual form) </pre> * such that URL= * <code>{baseurl}<packagePrefix>{version}<packageSuffix>.jar</code> - * and paths to context.javaPath and output.dir are specified in + * and paths to context.javaPath and output.dir are specified in * properties-compliant format */ protected static void driver(String[] args) throws Exception { @@ -146,12 +146,12 @@ public class WebInstall { fw = new FileWriter(props); fw.write("output.dir=" + outputDir + name + "\n"); fw.write("context.javaPath=" + jdk + "\n"); - fw.close(); + fw.close(); fw = null; ARGS[0] = baseurl + name + ".jar"; main(ARGS); } finally { - try { if (null != fw) fw.close(); } + try { if (null != fw) fw.close(); } catch (java.io.IOException e) {} // ignore } } @@ -169,7 +169,7 @@ public class WebInstall { * construct the installer, and invoke it using remaining arguments (or default args). */ protected void install(String[] args) throws Exception { - if ((null == args) || (args.length < 1) + if ((null == args) || (args.length < 1) || (null == args[0]) || (1 > args[0].length())) { if (printError("expecting installer URL")) return; } diff --git a/testing/src/test/java/org/aspectj/testing/util/options/Option.java b/testing/src/test/java/org/aspectj/testing/util/options/Option.java index 5d3ec4ba6..f4ff1c628 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/Option.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/Option.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ package org.aspectj.testing.util.options; @@ -26,21 +26,21 @@ import org.aspectj.util.LangUtil; /** * Immutable schema for an input (command-line) option. * The schema contains the expected name/label, - * the family (for comparison purposes), + * the family (for comparison purposes), * and permitted prefixes. * This has operations to accept input values and compare options. - * Options cannot be created directly; for that, use an + * Options cannot be created directly; for that, use an * <code>Option.Factory</code>, since it enforces uniqueness * within the families and options created by the factory. * <p> * Option is used with related nested classes to implement relations: * <ul> * <li>Option.Factory produces Option</li> - * <li>An Option has a set of Option.Prefixes, - * which are variants of Option.Prefix + * <li>An Option has a set of Option.Prefixes, + * which are variants of Option.Prefix * valid for the option (e.g., on/set, force-off, and force-on)</li> * <li>Option evaluates input, produces Option.Value</li> - * <li>Related instances of Option share an Option.Family, + * <li>Related instances of Option share an Option.Family, * which enforce option exclusion, etc.</li> * </ul> * The classes are nested as "friends" in order to hide private @@ -77,9 +77,9 @@ public class Option implements Comparable { /** if true, then match on input that has extra suffix beyond prefix and name */ private final boolean acceptSuffixedInput; - /** - * If true, no collision if there are multiple values - * that share the same family but not the same literal value + /** + * If true, no collision if there are multiple values + * that share the same family but not the same literal value */ private final boolean permitMultipleValues; @@ -167,7 +167,7 @@ public class Option implements Comparable { /** * If this value String represents a valid input for this option, * then create and return the associated Value. - * + * * @param value the Value created, or null if invalid * @return Value if this value is permitted by this option */ @@ -202,17 +202,17 @@ public class Option implements Comparable { return name; } - /** + /** * Called when ignoreSuffix is off but we got value with suffix. */ protected Value rejectingSuffixedInput(String value) { return null; } - /** + /** * Verify that the input is permitted at this position. * @param input the String input to check for validity - * @param position the int proposed position (0-based) + * @param position the int proposed position (0-based) * for the input (position 0 is for first argument) * @return null if this input is valid at this position, * or a String error message otherwise. @@ -267,7 +267,7 @@ public class Option implements Comparable { * Option families may permit or avoid option collisions. * <p> * For subclasses to permit some collisions and not others, - * they should set permitMultipleFamilyValues to false + * they should set permitMultipleFamilyValues to false * and implement <code>doCollision(Option, Option)</code>. * <p> * This relies on Factory to ensure that familyName is @@ -334,11 +334,11 @@ public class Option implements Comparable { /** * Subclasses implement this to resolve collisions on - * a case-by-case basis. Input are guaranteed to be + * a case-by-case basis. Input are guaranteed to be * non-null, different, and to share this family. * This implementation returns * <code>!permitMultipleFamilyValues</code>. - * + * * @param lhs the Option to compare * @param rhs the other Option to compare * @return true if there is a collision. @@ -348,7 +348,7 @@ public class Option implements Comparable { } } - /** + /** * A factory enforces a namespace on options. * All options produced from a given factory are unique, * as are all families. @@ -372,7 +372,7 @@ public class Option implements Comparable { } /** - * Ensure that the family with this name has the + * Ensure that the family with this name has the * specified permission. If the family does not exist, * it is created. If it does, the permission is checked. * If this returns false, there is no way to change the @@ -492,13 +492,13 @@ public class Option implements Comparable { /** * The actual input value for an option. - * When an option takes arguments, all the arguments + * When an option takes arguments, all the arguments * are absorbed/flattened into its value. */ public static class Value { private static final String FLATTEN_DELIM = "_"; - private static final int NOTARGUMENT = -1; + private static final int NOTARGUMENT = -1; private static String flatten(String prefix, String suffix) { return prefix + FLATTEN_DELIM + suffix; @@ -570,8 +570,8 @@ public class Option implements Comparable { this.argIndex); } - /** - * + /** + * * @param other * @return true if other == this for purposes of collisions */ @@ -655,7 +655,7 @@ public class Option implements Comparable { this.prefixLength = prefix.length(); } - /** + /** * Render a value for input if this is set. * @param value the String to render as an input value * @return null if value is null or option is not set, diff --git a/testing/src/test/java/org/aspectj/testing/util/options/OptionChecker.java b/testing/src/test/java/org/aspectj/testing/util/options/OptionChecker.java index 6c30f97b1..d529cf6cf 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/OptionChecker.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/OptionChecker.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ package org.aspectj.testing.util.options; @@ -20,8 +20,8 @@ import org.junit.Assert; /** * Drivers to test a given set of Options. - * They now throw AssertionFailedError on failure, - * but subclasses can reimplement + * They now throw AssertionFailedError on failure, + * but subclasses can reimplement * <code>assertionFailed(String)</code> * to handle failures differently. */ @@ -36,10 +36,10 @@ public class OptionChecker { /** * Subclasses override this to throw different exceptions * on assertion failures. - * This implementation delegates to + * This implementation delegates to * <code>Assert.assertTrue(label, false)</code>. * @param label the String message for the assertion - * + * */ public void assertionFailed(String label) { Assert.assertTrue(label, false); diff --git a/testing/src/test/java/org/aspectj/testing/util/options/Options.java b/testing/src/test/java/org/aspectj/testing/util/options/Options.java index 03b3a6d51..873b00786 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/Options.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/Options.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ package org.aspectj.testing.util.options; @@ -21,7 +21,7 @@ import org.aspectj.util.LangUtil; /** * A bunch of options that handle search boilerplate. * This enforces an initialization phase by permitting - * options to be added only until frozen, and + * options to be added only until frozen, and * permitting matching only after frozen. */ public class Options { @@ -67,11 +67,11 @@ public class Options { public Options(boolean stopAtFirstMatch) { this.stopAtFirstMatch = stopAtFirstMatch; } - + public void freeze() { if (frozen != FROZEN) { frozen = FROZEN; - } + } } public boolean isFrozen() { diff --git a/testing/src/test/java/org/aspectj/testing/util/options/OptionsTest.java b/testing/src/test/java/org/aspectj/testing/util/options/OptionsTest.java index f0f4f066c..b7d851f92 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/OptionsTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/OptionsTest.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ package org.aspectj.testing.util.options; @@ -271,7 +271,7 @@ public class OptionsTest extends TestCase { public void testMissedMatches() throws InvalidInputException { checkMissedMatches(new int[0], Values.EMPTY); - checkMissedMatches(new int[] { 0 }, + checkMissedMatches(new int[] { 0 }, Values.wrapValues(new Option.Value[1])); // null in [0] checkMissedMatches( new int[] { 0, 1, 2 }, @@ -323,11 +323,11 @@ public class OptionsTest extends TestCase { checkMissedMatches(new int[] { 2 }, result); } - + void checkMissedMatches(int[] expected, Values actual) { int[] result = actual.indexMissedMatches(); boolean failed = (result.length != expected.length); - + for (int i = 0; !failed && (i < result.length); i++) { failed = (result[i] != expected[i]); } diff --git a/testing/src/test/java/org/aspectj/testing/util/options/Values.java b/testing/src/test/java/org/aspectj/testing/util/options/Values.java index de35c8c67..c1ded7fab 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/Values.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/Values.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ package org.aspectj.testing.util.options; @@ -54,7 +54,7 @@ public class Values { LangUtil.throwIaxIfNull(input, "values"); } else { int length = 0; - for (int i = 0; i < values.length; i++) { + for (int i = 0; i < values.length; i++) { if (values[i] == null) { LangUtil.throwIaxIfNull(null, "null value[" + i + "]"); } @@ -71,7 +71,7 @@ public class Values { } return new Values(input); } - + static int[] invert(int[] missed, int length) { final int MAX = length; final int len = MAX - missed.length; @@ -107,7 +107,7 @@ public class Values { * is a matching force-on, then this will return an error. * Next, for any force-on value, it is converted to set-on, * and any other matching set-on value is removed. - * Finally, this signals a collision if two values share + * Finally, this signals a collision if two values share * the same option family and the family reports that this is * a collision. * In all cases, only the first error detected is reported. @@ -145,26 +145,26 @@ public class Values { } /** - * Resolve all related options into one + * Resolve all related options into one * by nullifying or modifying the values. - * - * First, for any force-off value, - * remove all identical set-on - * and the force-off itself, + * + * First, for any force-off value, + * remove all identical set-on + * and the force-off itself, * and alert on any identical force-on. * - * Next, for any force-on value, + * Next, for any force-on value, * convert to set-on, * throw Error on any same-family force-off value, * remove any identical force-on or set-on value, * alert on any other non-identical same-family force-on value, * remove any same-family set-on value, * and alert on any same-family set-off value. - * - * Finally, alert if any two remaining values share + * + * Finally, alert if any two remaining values share * the same option family, unless the option is marked * as permitting multiple values. - * + * * @param input the Option.Value[] matching the input * @param matches the int[] list of indexes into input for * values for related by option @@ -241,9 +241,9 @@ public class Values { } /** - * For any force-off value, + * For any force-off value, * remove all set-on or force-off with same value - * (including the force-off itself), + * (including the force-off itself), * and alert on any identical force-on. * @param input the Option.Value[] matching the input * @param value the force-off Option.Value to remove @@ -356,7 +356,7 @@ public class Values { } return result.getList(); } - + static int nullify(Option.Value[] values, Selector selector) { LangUtil.throwIaxIfNull(selector, "selector"); int changed = 0; @@ -425,7 +425,7 @@ public class Values { } /** - * Emit as String[] the non-null values. + * Emit as String[] the non-null values. * @return String[] of matched entries (never null, elements not null) */ public String[] render() { @@ -450,7 +450,7 @@ public class Values { /** * Create index into values of missed input, - * taking into account that matched arguments are + * taking into account that matched arguments are * represented as null. * @return int[] of elements in values that are null * or optionally represent option arguments @@ -496,7 +496,7 @@ public class Values { } /** - * + * * @param selector the Selector to pick out entries to nullify * (should throw STOP to halt processing) * @return Values resulting from nullifying entries, @@ -509,11 +509,11 @@ public class Values { Value[] temp = asArray(); int changed = nullify(temp, selector); if (0 == changed) { - return this; + return this; } - return new Values(temp); + return new Values(temp); } - + /** * Resolve options, removing duplicates by force if necessary. * If any error is returned, then the values are left unchanged. @@ -636,7 +636,7 @@ public class Values { /** * add index if value is null - * unless skipArguments + * unless skipArguments */ protected boolean accept(Value value) { index++; diff --git a/testing/src/test/java/org/aspectj/testing/util/options/ValuesTest.java b/testing/src/test/java/org/aspectj/testing/util/options/ValuesTest.java index e1a3b3c01..454dad00b 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/ValuesTest.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/ValuesTest.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ package org.aspectj.testing.util.options; @@ -37,7 +37,7 @@ public class ValuesTest extends TestCase { checkInvert(new int[] {1,2,5,6,9},10, new int[] {0,3,4,7,8}); // start, 2 middle run checkInvert(new int[] {0,1,2,5,6},10, new int[] {3,4,7,8,9}); // middle, end run } - + void checkInvert(int[] missed, int length, int[] expected) { int[] actual = Values.invert(missed, length); assertTrue(null != actual); diff --git a/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReader.java b/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReader.java index 421d37584..9cdf4239b 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReader.java +++ b/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReader.java @@ -4,9 +4,9 @@ * 2003 Contributors. * All rights reserved. * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 + * under the terms of the Eclipse Public License v 2.0 * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt * * Contributors: * Xerox/PARC initial implementation diff --git a/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.java b/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.java index b60e56470..4ed0fba64 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.java +++ b/testing/src/test/java/org/aspectj/testing/xml/AjcSpecXmlReaderTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.xml; @@ -32,7 +32,7 @@ import org.aspectj.util.LangUtil; import junit.framework.TestCase; /** - * + * */ public class AjcSpecXmlReaderTest extends TestCase { @@ -59,7 +59,7 @@ public class AjcSpecXmlReaderTest extends TestCase { } } } - + /** test that all AjcSpecXmlReader.me.expectedProperties() are bean-writable */ public void testBeanInfo() throws IntrospectionException { // AjcSpecXmlReader me = AjcSpecXmlReader.getReader(); @@ -85,25 +85,25 @@ public class AjcSpecXmlReaderTest extends TestCase { assertTrue("no such property: " + fqn, gotIt); } } - + } -// public void testAjcTests() throws IOException { +// public void testAjcTests() throws IOException { // checkXmlRoundTrip("../tests/ajcTests"); // } - public void testAjcTests10() throws IOException { + public void testAjcTests10() throws IOException { checkXmlRoundTrip("../tests/ajcTests10"); } - public void testAjcTestsBroken() throws IOException { + public void testAjcTestsBroken() throws IOException { checkXmlRoundTrip("../tests/ajcTestsBroken"); } - public void testAjcTestsAttic() throws IOException { + public void testAjcTestsAttic() throws IOException { checkXmlRoundTrip("../tests/ajcTestsAttic"); } - - public void testAjcHarnessTests() throws IOException { + + public void testAjcHarnessTests() throws IOException { checkXmlRoundTrip("../tests/ajcHarnessTests"); } @@ -127,7 +127,7 @@ public class AjcSpecXmlReaderTest extends TestCase { AjcTest.Suite.Spec suite2 = writer.readAjcSuite(file1); assertNotNull(suite2); AjcSpecTest.sameAjcSuiteSpec(suite1, suite2, this); - + // check clone while we're here try { Object clone = (AjcTest.Suite.Spec) suite1.clone(); @@ -159,7 +159,7 @@ public class AjcSpecXmlReaderTest extends TestCase { AjcTest.Suite.Spec suite0 = null; if (file0.canRead()) { System.out.println("reading " + file0); - suite0 = FlatSuiteReader.ME.readSuite(file0); + suite0 = FlatSuiteReader.ME.readSuite(file0); String warning = writer.writeSuiteToXmlFile(file1, suite0); toDelete.add(file1); assertTrue(warning, null == warning); @@ -174,7 +174,7 @@ public class AjcSpecXmlReaderTest extends TestCase { } } assertNotNull(suite0); - + //System.err.println("----------------------- suite0 " + txtPath); //suite0.printAll(System.err, ""); assertTrue("" + file1, file1.canRead()); @@ -208,7 +208,7 @@ public class AjcSpecXmlReaderTest extends TestCase { // ------------------- XXX retry execution round-trips when eclipse working //AjcSpecTest.sameAjcTestSpec(txtList, xmlSpec, this); - + // List xmlList = writer.readAjcTests(xmlFile); // AjcSpecTest.sameAjcTestLists(txtList, xmlList, this); // List xml2List = writer.readAjcTests(xmlFile); @@ -221,8 +221,8 @@ public class AjcSpecXmlReaderTest extends TestCase { // IRunStatus xmlStatus = runFile(xmlPath, xmlHandler); // MessageHandler txtHandler = new MessageHandler(); // IRunStatus txtStatus = runFile(txtPath, txtHandler); -// -// +// +// // // both should pass or fail.. // IRunValidator v = RunValidator.NORMAL; // boolean xmlPassed = v.runPassed(xmlStatus); @@ -239,5 +239,5 @@ public class AjcSpecXmlReaderTest extends TestCase { // IRunStatus runFile(String path, MessageHandler handler) throws IOException { // Main runner = new Main(new String[] {path}, handler); // String id = "AjcSpecXmlReaderTest.runFile(" + path + ")"; -// return runner.runMain(id, handler, System.err); +// return runner.runMain(id, handler, System.err); // } diff --git a/testing/src/test/java/org/aspectj/testing/xml/IXmlWritable.java b/testing/src/test/java/org/aspectj/testing/xml/IXmlWritable.java index a11b32be3..b2f37bbef 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/IXmlWritable.java +++ b/testing/src/test/java/org/aspectj/testing/xml/IXmlWritable.java @@ -1,23 +1,23 @@ /* ******************************************************************* - * 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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.xml; /** - * + * */ public interface IXmlWritable { - /** + /** * Write self out to XML. * @param out the XMLWriter to write to */ diff --git a/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReader.java b/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReader.java index cde5e99dd..48b22f19c 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReader.java +++ b/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReader.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ package org.aspectj.testing.xml; @@ -28,8 +28,8 @@ import org.aspectj.bridge.MessageUtil; import org.aspectj.util.LangUtil; import org.xml.sax.SAXException; -/** - * Read a list of messages in xml form. +/** + * Read a list of messages in xml form. * Input files should comply with DOCTYPE */ public class MessageListXmlReader { @@ -37,11 +37,11 @@ public class MessageListXmlReader { static { final String EOL = LangUtil.EOL; final StringBuffer r = new StringBuffer(); - + r.append("<!DOCTYPE "); r.append(MessageList.XMLNAME); r.append(" ["); - r.append(EOL + " <!ELEMENT " + MessageList.XMLNAME + r.append(EOL + " <!ELEMENT " + MessageList.XMLNAME + " (" + SoftMessage.XMLNAME + "+) >"); String name = SoftMessage.XMLNAME; r.append(EOL + " <!ELEMENT " + name + " (" + SoftSourceLocation.XMLNAME + ")*>"); @@ -55,13 +55,13 @@ public class MessageListXmlReader { r.append(EOL + " <!ATTLIST " + name + " sourceFile CDATA #IMPLIED >"); r.append(EOL + "] >"); - INLINE_DOCTYPE = r.toString(); - } + INLINE_DOCTYPE = r.toString(); + } private static final String[] LOG = new String[] {"info", "debug", "trace" }; - + private int logLevel; - + /** * Print IMessage[] to the output file as XML. * @param output the File to write to - overwritten @@ -82,7 +82,7 @@ public class MessageListXmlReader { writer.close(); return null; } - + /** @param level 0..2, info..trace */ public void setLogLevel(int level) { if (level < 0) { @@ -91,10 +91,10 @@ public class MessageListXmlReader { if (level > 2) { level = 2; } - logLevel = level; + logLevel = level; } - - /** + + /** * Read the specifications for a list of IMessage from an XML file. * @param file the File must be readable, comply with DOCTYPE. * @return IMessage[] read from file @@ -107,7 +107,7 @@ public class MessageListXmlReader { final Digester digester = new Digester(); setupDigester(digester); - + MessageListHolder holder = new MessageListHolder(); digester.push(holder); FileInputStream input = new FileInputStream(file); @@ -119,13 +119,13 @@ public class MessageListXmlReader { if (null != input) { input.close(); input = null; - } + } } return (null == holder.list ? new IMessage[0] : holder.list.getMessages()); } - + /** set up the mapping between the xml and Java. */ private void setupDigester(Digester digester) { // XXX supply sax parser to ignore white space? @@ -141,32 +141,32 @@ public class MessageListXmlReader { digester.addObjectCreate(messageListX, MessageList.class.getName()); digester.addObjectCreate(messageX, SoftMessage.class.getName()); digester.addObjectCreate(messageSrcLocX, SoftSourceLocation.class.getName()); - + // ---- set bean properties for sub-elements created automatically // -- some remapped - warnings // - if property exists, map will not be used - digester.addSetProperties(messageListX); + digester.addSetProperties(messageListX); digester.addSetProperties(messageX); digester.addSetProperties(messageSrcLocX); digester.addSetProperties(messageX, "kind", "kindAsString"); digester.addSetProperties(messageX, "line", "lineAsString"); - // ---- when subelements are created, add to parent + // ---- when subelements are created, add to parent digester.addSetNext(messageListX, "addMessage", IMessage.class.getName()); digester.addSetNext(messageX, "setSourceLocation", ISourceLocation.class.getName()); - + // can set parent, but prefer to have "knows-about" flow down only... } // ------------------------------------------------------------ testing code - /** + /** * This is only to do compile-time checking for the APIs impliedly * used in setupDigester(..). * The property setter checks are redundant with tests based on * expectedProperties(). */ -// private static void setupDigesterCompileTimeCheck() { +// private static void setupDigesterCompileTimeCheck() { // if (true) { throw new Error("never invoked"); } // // MessageListHolder holder = new MessageListHolder(); @@ -179,16 +179,16 @@ public class MessageListXmlReader { // m.setSourceLocation(sl); // m.setText((String) null); // m.setKindAsString((String) null); -// -// sl.setFile((String) null); -// sl.setLine((String) null); -// sl.setColumn((String) null); -// sl.setEndLine((String) null); -// +// +// sl.setFile((String) null); +// sl.setLine((String) null); +// sl.setColumn((String) null); +// sl.setEndLine((String) null); +// // // add attribute setters to validate? // } - // inner classes, to make public for bean utilities + // inner classes, to make public for bean utilities /** a list of messages */ public static class MessageList { public static final String XMLNAME = "message-list"; @@ -208,8 +208,8 @@ public class MessageListXmlReader { this.list = list; } } - + } - + diff --git a/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReaderTest.java b/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReaderTest.java index 3201d4288..5fc7a22c5 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReaderTest.java +++ b/testing/src/test/java/org/aspectj/testing/xml/MessageListXmlReaderTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.xml; @@ -24,7 +24,7 @@ import org.aspectj.util.LangUtil; import junit.framework.TestCase; /** - * + * */ public class MessageListXmlReaderTest extends TestCase { @@ -48,9 +48,9 @@ public class MessageListXmlReaderTest extends TestCase { } } public void testNothingOthersSkipped() {} - - public void skiptestMessageReading() throws Exception { - + + public void skiptestMessageReading() throws Exception { + //assertTrue("XXX need better XML wrapping - has < character", false); //checkXmlRoundTrip("testdata/dirChangesTestDir/diff/expectedMessages"); //checkXmlRoundTrip("testdata/dirChangesTestDir/same/expectedMessages"); diff --git a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java index 594c4b395..a223a3453 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java +++ b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.xml; @@ -52,8 +52,8 @@ public class SoftMessage implements IMessage { return new SoftMessage(message, IMessage.FAIL, thrown, null); } - /** - * Print messages. + /** + * Print messages. * @param messages List of IMessage */ public static void writeXml(XMLWriter out, IMessageHolder messages) { @@ -68,9 +68,9 @@ public class SoftMessage implements IMessage { } } - /** - * Print messages. - * @param messages IMessage[] + /** + * Print messages. + * @param messages IMessage[] */ public static void writeXml(XMLWriter out, IMessage[] messages) { if ((null == out) || (null == messages)) { @@ -81,7 +81,7 @@ public class SoftMessage implements IMessage { } } - /** print message as an element + /** print message as an element * XXX has to sync with ajcTests.dtd * @throws IllegalArgumentException if message.getThrown() is not null */ @@ -212,13 +212,13 @@ public class SoftMessage implements IMessage { return kind == IMessage.USAGE; } - /** - * @return true if kind == IMessage.INFO + /** + * @return true if kind == IMessage.INFO */ public boolean isInfo() { return kind == IMessage.INFO; } - + public boolean isTaskTag() { return kind == IMessage.TASKTAG; } @@ -228,13 +228,13 @@ public class SoftMessage implements IMessage { return kind == IMessage.ABORT; } - /** + /** * @return true if kind == IMessage.FAIL */ public boolean isFailed() { return kind == IMessage.FAIL; } - + public boolean getDeclared() { return false; } /** @return non-null String with simple message */ @@ -247,11 +247,11 @@ public class SoftMessage implements IMessage { return thrown; } - /** + /** * This returns any ISourceLocation set or a mock-up * if file and/or line were set. - * @return ISourceLocation associated with this message, - * a mock-up if file or line is available, or null if none + * @return ISourceLocation associated with this message, + * a mock-up if file or line is available, or null if none */ final public ISourceLocation getSourceLocation() { if ((null == sourceLocation) @@ -290,7 +290,7 @@ public class SoftMessage implements IMessage { this.sourceLocation = sourceLocation; } - /** + /** * Set the line for the underlying source location. * @throws IllegalStateException if source location was set directly * or indirectly by calling getSourceLocation after setting @@ -335,15 +335,15 @@ public class SoftMessage implements IMessage { public void setDetails(String string) { details = string; } - + public int getID() { return id; } - + public void setID(int id) { this.id = id; } - + public int getSourceStart() { return sourceStart; } diff --git a/testing/src/test/java/org/aspectj/testing/xml/SoftSourceLocation.java b/testing/src/test/java/org/aspectj/testing/xml/SoftSourceLocation.java index 3895f302e..305047d31 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/SoftSourceLocation.java +++ b/testing/src/test/java/org/aspectj/testing/xml/SoftSourceLocation.java @@ -1,15 +1,15 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC), * 2004 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://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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * Wes Isberg 2004 updates * ******************************************************************/ @@ -56,32 +56,32 @@ public class SoftSourceLocation implements ISourceLocation { private int column; private int endLine; private String context; - + public SoftSourceLocation() { } - + public File getSourceFile() { return (null != sourceFile ? sourceFile : NONE); } public int getLine() { return line; } - + public int getColumn() { return column; } - + public int getEndLine() { return line; } public String getContext() { return context; } - + public void setFile(String sourceFile) { this.sourceFile = new File(sourceFile); } - + public void setLine(String line) { setLineAsString(line); } @@ -95,19 +95,19 @@ public class SoftSourceLocation implements ISourceLocation { public String getLineAsString() { return ""+line; } - + public void setColumn(String column) { this.column = convert(column); } - + public void setEndLine(String line) { this.endLine = convert(line); } public void setContext(String context) { - this.context = context; + this.context = context; } - + private int convert(String in) { return Integer.valueOf(in); } @@ -115,15 +115,15 @@ public class SoftSourceLocation implements ISourceLocation { public String getLocationContext() { return null; } - + public int getOffset() { return -1; } - + /** @return String : {context\n}file:line:column */ public String toString() { return (null == context ? "" : context + LangUtil.EOL) - + getSourceFile().getPath() + + getSourceFile().getPath() + ":" + getLine() ; } diff --git a/testing/src/test/java/org/aspectj/testing/xml/XMLWriter.java b/testing/src/test/java/org/aspectj/testing/xml/XMLWriter.java index 7a8b176b7..f74b87da5 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/XMLWriter.java +++ b/testing/src/test/java/org/aspectj/testing/xml/XMLWriter.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.xml; @@ -19,7 +19,7 @@ import java.util.Stack; import org.aspectj.util.LangUtil; -/** +/** * Manage print stream to an XML document. * This tracks start/end elements and signals on error, * and optionally lineates buffer by accumulating @@ -30,7 +30,7 @@ import org.aspectj.util.LangUtil; public class XMLWriter { static final String SP = " "; static final String TAB = SP + SP; - + /** maximum value for maxWidth, when flowing buffer */ public static final int MAX_WIDTH = 8000; @@ -55,17 +55,17 @@ public class XMLWriter { input = input.replace('&', '='); return input; } - + /** @return name="{attributeValue({value})" */ public static String makeAttribute(String name, String value) { return (name + "=\"" + attributeValue(value) + "\""); } - + /** same as flattenList, except also normalize \ -> / */ public static String flattenFiles(String[] strings) { return flattenList(strings).replace('\\', '/'); } - + /** same as flattenList, except also normalize \ -> / */ public static String flattenFiles(List paths) { return flattenList(paths).replace('\\', '/'); @@ -82,7 +82,7 @@ public class XMLWriter { public static String[] unflattenList(String input) { return (String[]) LangUtil.commaSplit(input).toArray(new String[0]); } - + /** flatten input and add to list */ public static void addFlattenedItems(List list, String input) { LangUtil.throwIaxIfNull(list, "list"); @@ -95,10 +95,10 @@ public class XMLWriter { } } } - } + } } - - /** + + /** * Collapse list into a single comma-delimited value (e.g., for list buffer) * @param list List of items to print - null is silently ignored, * so for empty items use "" @@ -113,7 +113,7 @@ public class XMLWriter { } - /** + /** * Collapse list into a single comma-delimited value (e.g., for list buffer) * @param list the String[] items to print - null is silently ignored, * so for empty items use "" @@ -141,23 +141,23 @@ public class XMLWriter { } return sb.toString(); } - + /** output sink */ PrintWriter out; - + /** stack of String element names */ - Stack stack = new Stack(); - + Stack stack = new Stack(); + /** false if doing attributes */ boolean attributesDone = true; - + /** current element prefix */ String indent = ""; - + /** maximum width (in char) of indent and buffer when flowing */ int maxWidth; - - /** + + /** * Current text being flowed. * length() is always less than maxWidth. */ @@ -170,10 +170,10 @@ public class XMLWriter { buffer = new StringBuffer(); maxWidth = DEFAULT_WIDTH; } - - /** + + /** * Set maximum width (in chars) of buffer to accumulate. - * @param maxWidth int 0..MAX_WIDTH for maximum number of char to accumulate + * @param maxWidth int 0..MAX_WIDTH for maximum number of char to accumulate */ public void setMaxWidth(int maxWidth) { if (0 > maxWidth) { @@ -184,7 +184,7 @@ public class XMLWriter { this.maxWidth = maxWidth; } } - + /** shortcut for entire element */ public void printElement(String name, String attributes) { if (!attributesDone) throw new IllegalStateException("finish attributes"); @@ -209,12 +209,12 @@ public class XMLWriter { public void startElement(String name, boolean closeTag) { startElement(name, "", closeTag); } - - /** + + /** * Start element with buffer on the same line. * This does not flow buffer. * @param name String tag for the element - * @param attr {name="value"}.. where value + * @param attr {name="value"}.. where value * is a product of attributeValue(String) */ public void startElement(String name, String attr, boolean closeTag) { @@ -232,7 +232,7 @@ public class XMLWriter { sb.append(indent); sb.append("<"); sb.append(name); - + if (!LangUtil.isEmpty(attr)) { sb.append(" "); sb.append(attr.trim()); @@ -254,8 +254,8 @@ public class XMLWriter { } stack.push(new StackElement(name)); } - - /** + + /** * @param name should be the same as that given to start the element * @throws IllegalStateException if start element does not match */ @@ -290,7 +290,7 @@ public class XMLWriter { indent = indent.substring(0, indent.length() - TAB.length()); } } - + /** * Print name=value if neither is null and name is not empty after trimming, @@ -308,12 +308,12 @@ public class XMLWriter { if ((null == name) || (0 == name.trim().length())) { throw new IllegalArgumentException("no name=" + name + "=" + value); } - + String newAttr = name + "=\"" + attributeValue(value) + "\""; int indentLen = indent.length(); int bufferLen = buffer.length(); int newAttrLen = (0 == bufferLen ? indentLen : 0) + newAttr.length(); - + if (maxWidth > (bufferLen + newAttrLen)) { buffer.append(" "); buffer.append(newAttr); @@ -323,24 +323,24 @@ public class XMLWriter { buffer.setLength(0); } buffer.append(indent + SP + newAttr); - } + } } public void endAttributes() { if (attributesDone) throw new IllegalStateException("not in attributes"); attributesDone = true; } - + public void printComment(String comment) { if (!attributesDone) throw new IllegalStateException("in attributes"); outPrintln(indent + "<!-- " + comment + "-->"); } - + public void close() { if (null != out) { out.close(); } - + } public void println(String string) { @@ -360,5 +360,5 @@ public class XMLWriter { this.name = name; } } - + } diff --git a/testing/src/test/java/org/aspectj/testing/xml/XMLWriterTest.java b/testing/src/test/java/org/aspectj/testing/xml/XMLWriterTest.java index 13d2652e0..d2d97ccf3 100644 --- a/testing/src/test/java/org/aspectj/testing/xml/XMLWriterTest.java +++ b/testing/src/test/java/org/aspectj/testing/xml/XMLWriterTest.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 v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.xml; @@ -18,7 +18,7 @@ import java.util.Arrays; import junit.framework.TestCase; /** - * + * */ public class XMLWriterTest extends TestCase { @@ -27,18 +27,18 @@ public class XMLWriterTest extends TestCase { } /** @see LangUtilTest#testCommaSplit() */ - public void testUnflattenList() { + public void testUnflattenList() { checkUnflattenList("", new String[] {""}); checkUnflattenList("1", new String[] {"1"}); checkUnflattenList(" 1 2 ", new String[] {"1 2"}); checkUnflattenList(" 1 , 2 ", new String[] {"1", "2"}); checkUnflattenList("1,2,3,4", new String[] {"1", "2", "3", "4"}); } - + void checkUnflattenList(String input, String[] expected) { String[] actual = XMLWriter.unflattenList(input); String a = "" + Arrays.asList(actual); String e = "" + Arrays.asList(expected); assertTrue(e + "==" + a, e.equals(a)); - } + } } |