diff options
author | Andy Clement <aclement@pivotal.io> | 2019-11-28 15:56:46 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2019-11-28 15:56:46 -0800 |
commit | a3e5e4104ff31c9f06d90bd0f6876bef305831dc (patch) | |
tree | 06bcdf079072d3edb510107d51cfbb690aacf543 | |
parent | 355b79ad65fc6af650b1d5d6253401b8edbff395 (diff) | |
download | aspectj-a3e5e4104ff31c9f06d90bd0f6876bef305831dc.tar.gz aspectj-a3e5e4104ff31c9f06d90bd0f6876bef305831dc.zip |
Move to 1.9.6.BUILD-SNAPSHOT version
48 files changed, 608 insertions, 582 deletions
diff --git a/ajbrowser/pom.xml b/ajbrowser/pom.xml index 500cfc15c..03acbc275 100644 --- a/ajbrowser/pom.xml +++ b/ajbrowser/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/ajde.core/pom.xml b/ajde.core/pom.xml index 45847c3b2..5529b4e5f 100644 --- a/ajde.core/pom.xml +++ b/ajde.core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/ajde/pom.xml b/ajde/pom.xml index 4ea681b9f..7108c3f11 100644 --- a/ajde/pom.xml +++ b/ajde/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/ajdoc/pom.xml b/ajdoc/pom.xml index 17f6d39e7..427ed4b06 100644 --- a/ajdoc/pom.xml +++ b/ajdoc/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/asm/pom.xml b/asm/pom.xml index 9fbd50cd3..6e61563a4 100644 --- a/asm/pom.xml +++ b/asm/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/aspectjrt/pom.xml b/aspectjrt/pom.xml index e2cf0c925..68918cfb7 100644 --- a/aspectjrt/pom.xml +++ b/aspectjrt/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> </parent> <artifactId>aspectjrt</artifactId> diff --git a/aspectjtools/pom.xml b/aspectjtools/pom.xml index 44a8054ad..ad284ea12 100644 --- a/aspectjtools/pom.xml +++ b/aspectjtools/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> </parent> <artifactId>aspectjtools</artifactId> diff --git a/aspectjweaver/pom.xml b/aspectjweaver/pom.xml index debc14efa..58adaae07 100644 --- a/aspectjweaver/pom.xml +++ b/aspectjweaver/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> </parent> <artifactId>aspectjweaver</artifactId> diff --git a/bcel-builder/pom.xml b/bcel-builder/pom.xml index a6e15c638..a975edf53 100644 --- a/bcel-builder/pom.xml +++ b/bcel-builder/pom.xml @@ -12,7 +12,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/ConstantsInitializer.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/ConstantsInitializer.java index b9bc0d49f..8f33b8523 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/ConstantsInitializer.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/ConstantsInitializer.java @@ -57,6 +57,7 @@ import org.aspectj.apache.bcel.generic.Type; public class ConstantsInitializer { + @SuppressWarnings("unchecked") public static Object initialize() { Constants.types[Constants.ILOAD] = Type.INT; Constants.types[Constants.ISTORE] = Type.INT; diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/ExceptionConstants.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/ExceptionConstants.java index cf3d81308..a83199ee7 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/ExceptionConstants.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/ExceptionConstants.java @@ -56,7 +56,7 @@ package org.aspectj.apache.bcel; /** * Exception constants. - * + * * @version $Id: ExceptionConstants.java,v 1.5 2009/09/14 20:29:10 aclement Exp $ * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase">E. Haase</A> */ diff --git a/bridge/pom.xml b/bridge/pom.xml index 0d91214bd..e02445e5b 100644 --- a/bridge/pom.xml +++ b/bridge/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/build/pom.xml b/build/pom.xml index f10062c87..8d3348459 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/build/src/main/java/$installer$/org/aspectj/Main.java b/build/src/main/java/$installer$/org/aspectj/Main.java index 536c86293..9e7518038 100644 --- a/build/src/main/java/$installer$/org/aspectj/Main.java +++ b/build/src/main/java/$installer$/org/aspectj/Main.java @@ -1,14 +1,14 @@ /* ******************************************************************* - * Copyright (c) 2000-2001 Xerox Corporation, + * Copyright (c) 2000-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package $installer$.org.aspectj; @@ -75,12 +75,12 @@ import javax.swing.border.EmptyBorder; * <li>"-text".equals(arg[0])</li> * <li>arg[1] is the path to a properties file which defines name="output.dir" value="{path to output dir}" name="context.javaPath" * value="{path to JDKDIR}", i.e,. - * + * * <pre> * output.dir=c:/latest * "context.javaPath=c:/apps/jdk1.3.1 * </pre> - * + * * </li> * <li>outputDir must be created and empty (i.e., no overwriting</li> * <li>the VM being invoked should be the target vm</li> @@ -106,7 +106,7 @@ public class Main { Main.exit(-1); } properties.load(istream); - // when running outside GUI, load values into properties + // when running outside GUI, load values into properties // so that property-value resolution works // (otherwise, could just set values below). // XXX not sure if this indirection is actually needed. @@ -626,7 +626,7 @@ abstract class Installer { * (files == null) return; for (int i=0; i<files.length; i++) { if (files[i] == null) continue; if (!files[i].isDirectory()) * continue; if (files[i].getName().startsWith(prefix)) { System.out.println("found: " + files[i]); } else { findPaths(prefix, * files[i], currentDepth + 1); } } } - * + * * public static void findPaths(String prefix) { File [] files = File.listRoots(); for (int i=1; i<files.length; i++) { if * (!files[i].isDirectory()) continue; if (files[i].getName().toLowerCase().startsWith(prefix)) { System.out.println("found: " + * files[i]); } else { findPaths(prefix, files[i], 1); } } } @@ -661,7 +661,7 @@ class InstallContext { public Installer installer; - private Map properties; + private Map<String,String> properties; public boolean hasGui() { return hasGui; @@ -762,7 +762,7 @@ class InstallContext { return overwriteState == OVERWRITE_YES || overwriteState == OVERWRITE_ALL; } - public Map getProperties() { + public Map<String,String> getProperties() { return properties; } } @@ -1081,11 +1081,11 @@ class ConfigureLauncherPane extends WizardPane { /* * //XXX check that the returned file is valid public String getDefaultJavaLocation() { String name = "java"; if * (context.onWindows()) name += ".exe"; - * + * * if (Options.verbose) { System.out.println("java.home: " + System.getProperty("java.home")); System.out.println(" java: " + * new File(new File(System.getProperty("java.home"), "bin"), name)); System.out.println(" java: " + new File(new * File(System.getProperty("java.home"), "bin"), name).getPath()); } - * + * * return new File(new File(System.getProperty("java.home"), "bin"), name).getPath(); } */ @@ -1492,7 +1492,7 @@ class CurrentJarUnpacker { public void unpack(String contentsName, File outputDir) throws IOException { URL url = getClass().getResource(contentsName); - + // Process everything under 'files/**' copying to the target // install directory with 'files/' removed JarURLConnection juc = (JarURLConnection) url.openConnection(); @@ -1504,7 +1504,7 @@ class CurrentJarUnpacker { writeResource(jf, je, outputDir); } } - + // InputStream stream = url.openStream(); // BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "US-ASCII")); // String line = reader.readLine(); @@ -1528,7 +1528,7 @@ class LaunchScriptMaker { } /** - * + * */ public void writeAJLaunchScript(String name, boolean isJava5) throws IOException { if (!context.onUnix()) { @@ -1764,22 +1764,22 @@ class LaunchScriptMaker { /* * final static String OVERWRITE_MESSAGE = "Overwrite launch script "; final static String OVERWRITE_TITLE = "Overwrite?"; - * + * * final static String[] OVERWRITE_OPTIONS = { "Yes", "No", "Yes to all", "No to all" }; - * + * * final static int OVERWRITE_YES = 0; final static int OVERWRITE_NO = 1; final static int OVERWRITE_ALL = 2; final static int * OVERWRITE_NONE = 3; - * + * * int overwriteState = OVERWRITE_NO; boolean shouldOverwrite(final File file) { if (overwriteState == OVERWRITE_ALL) return * true; if (overwriteState == OVERWRITE_NONE) return false; - * + * * try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { int ret = * JOptionPane.showOptionDialog(context.installer.frame, OVERWRITE_MESSAGE+file.getPath(), OVERWRITE_TITLE, * JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, OVERWRITE_OPTIONS, OVERWRITE_OPTIONS[OVERWRITE_YES]); - * + * * overwriteState = ret; } }); } catch (InvocationTargetException ite) { context.handleException(ite.getTargetException()); } * catch (InterruptedException ie) { } - * + * * return overwriteState == OVERWRITE_YES || overwriteState == OVERWRITE_ALL; } */ diff --git a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJInstaller.java b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJInstaller.java index 6bc2fc09b..2428e66d9 100644 --- a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJInstaller.java +++ b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJInstaller.java @@ -1,14 +1,14 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ //XXX INCLUDES CODE FROM ANT -- UNDER APACHE LICENSE @@ -39,12 +39,13 @@ import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.PatternSet; +@SuppressWarnings("deprecation") public class AJInstaller extends MatchingTask { static final String INCLUDE_CLASSES = "$installer$/org/aspectj/*.class"; static final String MAIN_CLASS = "$installer$.org.aspectj.Main"; static final String CONTENTS_FILE = "$installer$/org/aspectj/resources/contents.txt"; private String htmlSrc; - + public void setHtmlSrc(String v) { htmlSrc = v; } private String resourcesSrc; @@ -57,11 +58,11 @@ public class AJInstaller extends MatchingTask { private File installerClassJar; - public void setInstallerclassjar(String v) { + public void setInstallerclassjar(String v) { installerClassJar = project.resolveFile(v); } - protected List contentsNames = new ArrayList(); + protected List<String> contentsNames = new ArrayList<>(); protected long contentsBytes = 0; @@ -102,7 +103,7 @@ public class AJInstaller extends MatchingTask { PatternSet patterns = new PatternSet(); patterns.setIncludes(INCLUDE_CLASSES); expand.addPatternset(patterns); - expand.execute(); + expand.execute(); // move the correct resource files into the jar Copy cd = getCopyTask(); @@ -151,8 +152,8 @@ public class AJInstaller extends MatchingTask { StringBuffer buf = new StringBuffer(); buf.append(contentsBytes); buf.append(NEWLINE); - for (Iterator i = contentsNames.iterator(); i.hasNext(); ) { - String name = (String)i.next(); + for (Iterator<String> i = contentsNames.iterator(); i.hasNext(); ) { + String name = i.next(); buf.append(name); buf.append(NEWLINE); } @@ -179,7 +180,7 @@ public class AJInstaller extends MatchingTask { * This is the name/location of where to * create the .zip file. */ - public void setZipfile(String zipFilename) { + public void setZipfile(String zipFilename) { zipFile = project.resolveFile(zipFilename); } @@ -294,12 +295,12 @@ public class AJInstaller extends MatchingTask { } return tmpDir; } - + public void execute() throws BuildException { if (installerClassJar == null) { throw new BuildException("installerClassJar attribute must be set!"); } - if (!installerClassJar.canRead() + if (!installerClassJar.canRead() || !installerClassJar.getPath().endsWith(".jar")) { throw new BuildException("not readable jar:" + installerClassJar); } diff --git a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJPush.java b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJPush.java index 26ab7ce5f..81e592553 100644 --- a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJPush.java +++ b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJPush.java @@ -1,14 +1,14 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.internal.tools.ant.taskdefs; @@ -22,6 +22,7 @@ import java.util.Properties; import org.apache.tools.ant.taskdefs.Mkdir; +@SuppressWarnings("deprecation") public class AJPush extends ConditionalTask { private File src; diff --git a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java index d65c50501..c4f8848d8 100644 --- a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java +++ b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.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 v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.internal.tools.ant.taskdefs; @@ -51,7 +51,7 @@ public class AntBuilder extends Builder { /** * Factory for a Builder. - * + * * @param config the String configuration, where only substrings "verbose" and "useEclipseCompiles" are significant * @param project the owning Project for all tasks (not null) * @param tempDir the File path to a temporary dir for side effects (may be null) @@ -128,7 +128,7 @@ public class AntBuilder extends Builder { /** * Initialize task with project and "ajbuild-" + name as name. (Using bm- prefix distinguishes these tasks from tasks found in * the build script.) - * + * * @param task the Task to initialize - not null * @param name the String name suffix for the task * @return true unless some error @@ -141,7 +141,7 @@ public class AntBuilder extends Builder { /** * Copy file, optionally filtering. (Filters set in project.) - * + * * @param fromFile the readable File source to copy * @param toFile the writable File destination file * @param boolean filter if true, enable filtering @@ -158,7 +158,7 @@ public class AntBuilder extends Builder { /** * (Filters set in project.) - * + * * @see org.aspectj.internal.tools.ant.taskdefs.Builder#copyFiles(File, File, String, String, boolean) */ @Override @@ -230,7 +230,7 @@ public class AntBuilder extends Builder { for (File file: result.getSrcDirs()) { path.createPathElement().setLocation(file); if (!isJava5Compile - && (Util.Constants.JAVA5_SRC.equals(file.getName()) || + && (Util.Constants.JAVA5_SRC.equals(file.getName()) || Util.Constants.JAVA5_TESTSRC.equals(file.getName()) || new File(file.getParent(), ".isJava5").exists())) { isJava5Compile = true; @@ -272,11 +272,11 @@ public class AntBuilder extends Builder { javac.setDebug(true); if (isJava8Compile) { javac.setSource("1.8"); - javac.setTarget("1.8"); + javac.setTarget("1.8"); } else if (isJava5Compile) { // *cough* javac.setSource("1.6"); - javac.setTarget("1.6"); + javac.setTarget("1.6"); } else { javac.setTarget("1.1"); // 1.1 class files - Javac in 1.4 uses 1.4 javac.setSource("1.3"); @@ -311,8 +311,8 @@ public class AntBuilder extends Builder { public boolean setupClasspath(Result result, Path classpath) { // XXX fix test access boolean hasLibraries = false; // required libraries - for (Iterator iter = result.getLibJars().iterator(); iter.hasNext();) { - File file = (File) iter.next(); + for (Iterator<File> iter = result.getLibJars().iterator(); iter.hasNext();) { + File file = iter.next(); classpath.createPathElement().setLocation(file); if (!hasLibraries) { hasLibraries = true; @@ -329,8 +329,8 @@ public class AntBuilder extends Builder { } // also put on classpath libraries exported from required module // XXX exported modules not supported - for (Iterator iterator = requiredResult.getExportedLibJars().iterator(); iterator.hasNext();) { - classpath.createPathElement().setLocation((File) iterator.next()); + for (Iterator<File> iterator = requiredResult.getExportedLibJars().iterator(); iterator.hasNext();) { + classpath.createPathElement().setLocation(iterator.next()); } } return hasLibraries; @@ -356,8 +356,9 @@ public class AntBuilder extends Builder { ZipFileSet zipfileset = null; // -- merge any resources in any of the src directories - for (Iterator iter = result.getSrcDirs().iterator(); iter.hasNext();) { - File srcDir = (File) iter.next(); + //for (Iterator iter = result.getSrcDirs().iterator(); iter.hasNext();) { + // File srcDir = (File) iter.next(); + for (File srcDir: result.getSrcDirs()) { zipfileset = new ZipFileSet(); zipfileset.setProject(project); zipfileset.setDir(srcDir); @@ -528,7 +529,7 @@ public class AntBuilder extends Builder { /** * If this module should be compiled with AspectJ, return a task to do so. - * + * * @param module the Module to compile * @param javac the Javac compile commands * @return javac or a Task to compile with AspectJ if needed @@ -588,7 +589,7 @@ public class AntBuilder extends Builder { /** * Wrap AspectJ compiler as Task. Only works for javac-like source compilation of everything under srcDir. Written * reflectively to compile in the build module, which can't depend on the whole tree. - * + * * @param javac the Javac specification * @param toolsJar the Path to the aspectjtools.jar * @param runtimeJar the Path to the aspectjrt.jar @@ -659,7 +660,7 @@ public class AntBuilder extends Builder { // loadAntProperties(ant, buildSpec); // ant.execute(); // } -// +// // /** override definitions */ // private void loadAntProperties(Ant ant, BuildSpec buildSpec) { // Property property = ant.createProperty(); @@ -682,7 +683,7 @@ public class AntBuilder extends Builder { /** * Segregate product-building API's from module-building APIs for clarity. These are called by the superclass if the BuildSpec * warrants. XXX extremely brittle/arbitrary assumptions. - * + * * @see BuildModule for assumptions */ class ProductBuilder extends AntBuilder { @@ -708,7 +709,7 @@ class ProductBuilder extends AntBuilder { /** * Calculate name of main, typically InitialCap, and hence installer class. - * + * * @return $$installer$$.org.aspectj." + ProductName + "Installer" */ @@ -801,7 +802,7 @@ class ProductBuilder extends AntBuilder { // String name = (!assembleAll ? jarName : jarName.substring(0, jarName.length()-4)); // return modules.getModule(name); // } - // + // } class ProjectMessager extends Messager { diff --git a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java index 904ba4656..e7de69284 100644 --- a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java +++ b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.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 v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.internal.tools.ant.taskdefs; @@ -36,6 +36,7 @@ import org.apache.tools.ant.types.Reference; * Check that included .java files contain license and copyright strings for MPL 1.0 (default), Apache, or CPL. Use list="true" to * get a list of known license variants {license}-{copyrightHolder} todo reimplement with regexp and jdiff FileLine utilities */ +@SuppressWarnings("deprecation") public class Checklics extends MatchingTask { /* * This does not enforce that copyrights are correct/current, only that they exist. E.g., the default behavior requires MPL but @@ -114,7 +115,7 @@ public class Checklics extends MatchingTask { /** * Run the license check directly - * + * * @param sourcepaths String[] of paths to source directories * @param license the String tag for the license, if any * @param failonerror boolean flag to pass to Checklics @@ -171,7 +172,7 @@ public class Checklics extends MatchingTask { /** * When failOnError is true, if any file failed, throw BuildException listing number of files that file failed to pass license * check - * + * * @param fail if true, report errors by throwing BuildException */ public void setFailOnError(boolean fail) { @@ -342,7 +343,7 @@ public class Checklics extends MatchingTask { public static class License { /** acceptable years for copyright prefix to company - append " " */ static final String[] YEARS = // remove older after license xfer? - new String[] { "2002 ", "2003 ", "2004 ", "2005", "2006", "2007", "2008", + new String[] { "2002 ", "2003 ", "2004 ", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2001 ", "2000 ", "1999 " }; public final String tag; @@ -556,7 +557,7 @@ class HeaderInfo { * 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 ****************************************************************** */ } @@ -651,7 +652,7 @@ class Header { /** * Add any years found (as String) to years, and return true at the first end-of-comment - * + * * @return true if this line has end-of-comment */ private static boolean checkLine(String line, ArrayList<String> years) { diff --git a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java index fdff0d7c1..ccb9c2149 100644 --- a/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java +++ b/build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java @@ -1,14 +1,14 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.internal.tools.ant.taskdefs; @@ -21,6 +21,7 @@ import java.util.Vector; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; +@SuppressWarnings("deprecation") public abstract class ConditionalTask extends Task { public final static String TRUE = "true"; @@ -170,7 +171,7 @@ public abstract class ConditionalTask extends Task { Iterator<If> iter = ifs().iterator(); List<String> result = new Vector<String>(); while (iter.hasNext()) { - If next = (If) iter.next(); + If next = iter.next(); String name = next.getName(); String prop = project.getProperty(name); if (prop == null) { diff --git a/build/src/main/java/org/aspectj/internal/tools/build/Builder.java b/build/src/main/java/org/aspectj/internal/tools/build/Builder.java index 72f53e901..8efea662a 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Builder.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Builder.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: - * PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * PARC initial implementation * ******************************************************************/ package org.aspectj.internal.tools.build; @@ -80,10 +80,10 @@ public abstract class Builder { /** * This has only weak forms for build instructions needed: - resource * pattern - compiler selection and control - * + * * Both assumed and generated paths are scattered; see XXXNameLiteral and * XXXFileLiteral. - * + * * Builder is supposed to be thread-safe, but currently caches build * properties to tunnel for filters. hmm. */ @@ -140,12 +140,12 @@ public abstract class Builder { /** * Splits strings into an unmodifable <code>List</code> of String using * comma as the delimiter and trimming whitespace from the result. - * + * * @param text * <code>String</code> to split. * @return unmodifiable List (String) of String delimited by comma in text */ - public static List commaStrings(String text) { + public static List<String> commaStrings(String text) { if ((null == text) || (0 == text.length())) { return Collections.EMPTY_LIST; } @@ -162,7 +162,7 @@ public abstract class Builder { /** * Map delivered-jar name to created-module name - * + * * @param jarName * the String (lowercased) of the jar/zip to map */ @@ -305,9 +305,9 @@ public abstract class Builder { } return noErr; } - + protected final boolean isLogging() { - return (verbose && (null != this.handler)); + return (verbose && (null != this.handler)); } protected Result[] skipUptodate(Result[] results) { @@ -331,14 +331,14 @@ public abstract class Builder { /** * Build a result with all antecedants. - * + * * @param result * the Result to build * @param errors * the List sink for errors, if any * @return false after successful build, when module jar should exist */ - protected final boolean buildAll(Result result, List errors) { + protected final boolean buildAll(Result result, List<String> errors) { Result[] buildList = skipUptodate(getAntecedantResults(result)); ArrayList<String> doneList = new ArrayList<String>(); if ((null != buildList) && (0 < buildList.length)) { @@ -364,7 +364,7 @@ public abstract class Builder { /** * Build a module but no antecedants. - * + * * @param module * the Module to build * @param errors @@ -419,7 +419,7 @@ public abstract class Builder { * Build product by discovering any modules to build, building those, * assembling the product distribution, and optionally creating an installer * for it. - * + * * @return true on success */ protected final boolean buildProduct(BuildSpec buildSpec) @@ -527,13 +527,13 @@ public abstract class Builder { } protected final boolean buildProductModule(ProductModule module) { - ArrayList errors = new ArrayList(); + ArrayList<String> errors = new ArrayList<>(); try { Kind productKind = Result.kind(Result.NORMAL, Result.ASSEMBLE); Result result = module.module.getResult(productKind); return buildAll(result, errors); } finally { - for (Iterator iter = errors.iterator(); iter.hasNext();) { + for (Iterator<String> iter = errors.iterator(); iter.hasNext();) { handler.error("error building " + module + ": " + iter.next()); } } @@ -578,25 +578,25 @@ public abstract class Builder { assembleAll)); } } - return (ProductModule[]) results.toArray(new ProductModule[0]); + return results.toArray(new ProductModule[0]); } /** * Subclasses should query whether to include library files in the assembly. - * + * * @param module * the Module being built * @param libraries * the List of File path to the jar to consider assembling * @return true if the jar should be included, false otherwise. */ - protected void removeLibraryFilesToSkip(Module module, List libraries) { - for (ListIterator liter = libraries.listIterator(); liter.hasNext();) { - File library = (File) liter.next(); + protected void removeLibraryFilesToSkip(Module module, List<File> libraries) { + for (ListIterator<File> liter = libraries.listIterator(); liter.hasNext();) { + File library = liter.next(); final String fname = library.getName(); if (null != fname) { - for (Iterator iter = SKIP_LIBRARIES.iterator(); iter.hasNext();) { - String name = (String) iter.next(); + for (Iterator<String> iter = SKIP_LIBRARIES.iterator(); iter.hasNext();) { + String name = iter.next(); if (fname.equals(name)) { liter.remove(); break; @@ -613,7 +613,7 @@ public abstract class Builder { /** * Compile module classes to classesDir, saving String errors. - * + * * @param module * the Module to compile * @param classesDir @@ -629,7 +629,7 @@ public abstract class Builder { /** * Assemble the module distribution from the classesDir, saving String * errors. - * + * * @see #removeLibraryFilesToSkip(Module, File) */ abstract protected boolean assemble(Result result, File classesDir, @@ -638,7 +638,7 @@ public abstract class Builder { /** * Assemble the module distribution from the classesDir and all * antecendants, saving String errors. - * + * * @see #removeLibraryFilesToSkip(Module, File) */ abstract protected boolean assembleAll(Result result, Messager handler); @@ -658,7 +658,7 @@ public abstract class Builder { /** * Copy toDir any fromDir included files without any exluded files, * optionally filtering contents. - * + * * @param fromDir * File dir to read from - error if not readable * @param toDir diff --git a/build/src/main/java/org/aspectj/internal/tools/build/Module.java b/build/src/main/java/org/aspectj/internal/tools/build/Module.java index 3f0afbfd9..cbbbc308b 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Module.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Module.java @@ -1,14 +1,14 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.internal.tools.build; @@ -43,7 +43,7 @@ import org.aspectj.internal.tools.build.Util.OSGIBundle.RequiredBundle; * <li>a file <code>{moduleName}.mf.txt</code> is taken as the manifest of * any .jar file produced, after filtering. </li> * </ul> - * + * * @see Builder * @see Modules#getModule(String) */ @@ -98,7 +98,7 @@ public class Module { /** * Recursively find antecedant jars. - * + * * @see findKnownJarAntecedants() */ static void doFindJarRequirements(Result result, List<File> known) { @@ -147,7 +147,7 @@ public class Module { // } // return result; // } - + public final boolean valid; public final File moduleDir; @@ -266,7 +266,7 @@ public class Module { return false; } - + public String toString() { return name; @@ -282,32 +282,32 @@ public class Module { return kind.assemble ? (kind.normal ? releaseAll : testAll) : (kind.normal ? release : test); } - + List<File> srcDirs(Result result) { myResult(result); return srcDirs; } - + List<File> libJars(Result result) { myResult(result); return libJars; } - + List<String> classpathVariables(Result result) { myResult(result); return classpathVariables; } - + List<File> exportedLibJars(Result result) { myResult(result); return exportedLibJars; } - + List<Module> requiredModules(Result result) { myResult(result); return requiredModules; } - + private void myResult(Result result) { if ((null == result) || this != result.getModule()) { throw new IllegalArgumentException("not my result: " + result + ": " + this); @@ -325,7 +325,7 @@ public class Module { /** read OSGI manifest.mf file XXX hacked */ private boolean initManifest() { - File metaInf = new File(moduleDir, "META-INF"); + File metaInf = new File(moduleDir, "META-INF"); if (!metaInf.canRead() || !metaInf.isDirectory()) { return false; } @@ -354,9 +354,9 @@ public class Module { update("lib", libs[i], libs[i], false); } - return true; + return true; } - + /** read eclipse .classpath file XXX line-oriented hack */ private boolean initClasspath() { // meaning testsrc directory, junit library, etc. @@ -517,8 +517,8 @@ public class Module { */ protected boolean reviewInit() { try { - for (ListIterator iter = srcDirs.listIterator(); iter.hasNext();) { - File srcDir = (File) iter.next(); + for (ListIterator<File> iter = srcDirs.listIterator(); iter.hasNext();) { + File srcDir = iter.next(); String lcname = srcDir.getName().toLowerCase(); if (!Util.JAVA5_VM && (Util.Constants.JAVA5_SRC.equals(lcname) || Util.Constants.JAVA5_TESTSRC @@ -640,7 +640,7 @@ public class Module { } } } - return (String[]) result.toArray(new String[0]); + return result.toArray(new String[0]); } public void acceptLine(String line) { diff --git a/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java b/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java index 0b023e6c5..bb1ed8555 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java @@ -1,27 +1,40 @@ /* ******************************************************************* * 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 v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ /* * A quickie hack to extract sample code from testable sources. - * This could reuse a lot of code from elsewhere, - * but currently doesn't, + * This could reuse a lot of code from elsewhere, + * but currently doesn't, * to keep it in the build module which avoids dependencies. * (Too bad we can't use scripting languages...) */ package org.aspectj.internal.tools.build; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.LineNumberReader; +import java.io.Reader; import java.text.DateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; /** * This gathers sample code delimited with [START..END]-SAMPLE @@ -31,14 +44,14 @@ import java.util.*; * ... sample code ... * // END-SAMPLE {anchorName} * </pre> - * where {anchorName} need not be unique and might be + * where {anchorName} need not be unique and might be * hierarchical wrt "-", e.g., "genus-species-individual". */ public class SampleGatherer { - + /** EOL String for gathered lines */ public static final String EOL = "\n"; // XXX - + static final String START = "START-SAMPLE"; static final String END = "END-SAMPLE"; static final String AUTHOR = "@author"; @@ -62,7 +75,7 @@ public class SampleGatherer { // source = "in this <pre> day and </pre> age"; // System.err.println("from " + source); // System.err.println(" to " + SampleUtil.replace(source, from, to)); -// +// // } /** * Emit samples gathered from any input args. @@ -88,7 +101,7 @@ public class SampleGatherer { fos.close(); System.out.println("see file:///" + out); } - + /** * Gather samples from a source file or directory * @param source the File file or directory to start with @@ -96,7 +109,7 @@ public class SampleGatherer { * @return sink or a new Samples collection with any samples found * @throws IOException if unable to read a source file */ - public static Samples gather(File source, Samples sink) + public static Samples gather(File source, Samples sink) throws IOException { if (null == sink) { sink = new Samples(); @@ -122,8 +135,8 @@ public class SampleGatherer { } return line; } - - private static void doGather(File source, Samples sink) + + private static void doGather(File source, Samples sink) throws IOException { if (source.isFile()) { if (isSource(source)) { @@ -150,8 +163,8 @@ public class SampleGatherer { } return false; } - - private static void gatherFromFile(final File source, final Samples sink) + + private static void gatherFromFile(final File source, final Samples sink) throws IOException { Reader reader = null; try { @@ -185,7 +198,7 @@ public class SampleGatherer { anchorName = anchorName.substring(0, loc); } continue; - } + } // found end? loc = line.indexOf(END); @@ -203,10 +216,10 @@ public class SampleGatherer { endLine = lineNumber; Sample sample = new Sample(anchorName, anchorTitle, - author, - sampleCode.toString(), - source, - startLine, + author, + sampleCode.toString(), + source, + startLine, endLine, (String[]) flags.toArray(new String[flags.size()])); sink.addSample(sample); @@ -216,7 +229,7 @@ public class SampleGatherer { startLine = -1; endLine = Integer.MAX_VALUE; continue; - } + } // found author? loc = line.indexOf(AUTHOR); @@ -228,7 +241,7 @@ public class SampleGatherer { if (-1 != loc) { flags.add(trimCommentEnd(line, loc + FLAG.length())); } - + // reading? if ((-1 != startLine) && (-1 == endLine)) { sampleCode.append(line); @@ -272,21 +285,21 @@ class Sample { public int compare(Sample left, Sample right) { if (null == left) { return (null == right ? 0 : -1); - } + } if (null == right) { return 1; - } + } int result = left.anchorName.compareTo(right.anchorName); if (0 != result) { - return result; + return result; } result = left.sourcePath.compareTo(right.sourcePath); if (0 != result) { - return result; + return result; } result = right.startLine - left.startLine; if (0 != result) { - return result; + return result; } return right.endLine - left.endLine; } @@ -297,18 +310,18 @@ class Sample { public int compare(Sample left, Sample right) { if (null == left) { return (null == right ? 0 : -1); - } + } if (null == right) { return 1; - } + } int result = left.author.compareTo(right.author); if (0 != result) { - return result; + return result; } return NAME_SOURCE_COMPARER.compare(left,right); } }; - + final String anchorName; final String anchorTitle; final String author; @@ -349,10 +362,10 @@ class Sample { } public static class Kind { - + /** lowercase source suffixes identify files to gather samples from */ public static final String[] SOURCE_SUFFIXES = new String[] - { ".java", ".aj", ".sh", ".ksh", + { ".java", ".aj", ".sh", ".ksh", ".txt", ".text", ".html", ".htm", ".xml" }; static final Kind XML = new Kind(); static final Kind HTML = new Kind(); @@ -404,7 +417,7 @@ class Samples { List<Sample> getSortedSamples() { return getSortedSamples(Sample.NAME_SOURCE_COMPARER); } - + List<Sample> getSortedSamples(Comparator<Sample> comparer) { ArrayList<Sample> result = new ArrayList<Sample>(); result.addAll(samples); @@ -419,10 +432,10 @@ class Samples { */ class SamplesRenderer { public static SamplesRenderer ME = new SamplesRenderer(); - protected SamplesRenderer() { + protected SamplesRenderer() { } public static final String EOL = "\n"; // XXX - public static final String INFO = + public static final String INFO = "<p>This contains contributions from the AspectJ community of " + "<ul><li>sample code for AspectJ programs,</li>" + "<li>sample code for extensions to AspectJ tools using the public API's,</li>" @@ -436,7 +449,7 @@ class SamplesRenderer { + "see the <a href=\"doc/faq.html#q:buildingsource\">FAQ entry " + "\"buildingsource\"</a>.</p>"; - public static final String COPYRIGHT = + public static final String COPYRIGHT = "<p><small>Copyright 2003 Contributors. All Rights Reserved. " + "This sample code is made available under the Common Public "
+ "License version 1.0 available at " + "<a href=\"http://www.eclipse.org/legal/epl-v10.html\">" @@ -448,7 +461,7 @@ class SamplesRenderer { + "the source by reference to the AspectJ project home page " + " at http://eclipse.org/aspectj.</small></p>" + EOL; - + /** template algorithm to render */ public final StringBuffer render(Samples samples, StringBuffer sink) { if (null == sink) { @@ -458,15 +471,15 @@ class SamplesRenderer { return sink; } startList(samples, sink); - List list = samples.getSortedSamples(); + List<Sample> list = samples.getSortedSamples(); String anchorName = null; - for (ListIterator iter = list.listIterator(); + for (ListIterator<Sample> iter = list.listIterator(); iter.hasNext();) { - Sample sample = (Sample) iter.next(); + Sample sample = iter.next(); String newAnchorName = sample.anchorName; - if ((null == anchorName) + if ((null == anchorName) || (!anchorName.equals(newAnchorName))) { - endAnchorName(anchorName, sink); + endAnchorName(anchorName, sink); startAnchorName(newAnchorName, sample.anchorTitle, sink); anchorName = newAnchorName; } @@ -518,25 +531,25 @@ class SamplesRenderer { class HTMLSamplesRenderer extends SamplesRenderer { public static SamplesRenderer ME = new HTMLSamplesRenderer(); // XXX move these - public static boolean doHierarchical = true; - public static boolean doFlags = false; + public static boolean doHierarchical = true; + public static boolean doFlags = false; + - final StringBuffer tableOfContents; final StringBuffer sampleSection; String[] lastAnchor = new String[0]; String currentAnchor; String currentAuthor; - protected HTMLSamplesRenderer() { + protected HTMLSamplesRenderer() { sampleSection = new StringBuffer(); tableOfContents = new StringBuffer(); } - + protected void startAnchorName(String name, String title, StringBuffer sink) { if (doHierarchical) { doContentTree(name); - } + } // ---- now do anchor tableOfContents.append(" <li><a href=\"#" + name); if ((null == title) || (0 == title.length())) { @@ -559,9 +572,9 @@ class HTMLSamplesRenderer extends SamplesRenderer { } currentAnchor = null; } - + // do heading then code - renderHeading(sample.anchorName, sample.anchorTitle, sampleSection); + renderHeading(sample.anchorName, sample.anchorTitle, sampleSection); if (sample.kind == Sample.Kind.HTML) { renderHTML(sample); } else if (sample.kind == Sample.Kind.XML) { @@ -583,12 +596,12 @@ class HTMLSamplesRenderer extends SamplesRenderer { sampleSection.append(" <p>| " + currentAuthor); sampleSection.append(EOL); } - sampleSection.append(" | "); + sampleSection.append(" | "); sampleSection.append(SampleUtil.renderCodePath(sample.sourcePath)); sampleSection.append(":" + sample.startLine); - sampleSection.append(" |"); + sampleSection.append(" |"); sampleSection.append(EOL); - sampleSection.append("<p>"); + sampleSection.append("<p>"); sampleSection.append(EOL); if (doFlags) { boolean flagHeaderDone = false; @@ -609,7 +622,7 @@ class HTMLSamplesRenderer extends SamplesRenderer { } } } - + protected void renderXML(Sample sample) { renderStandardHeader(sample); sampleSection.append(" <pre>"); @@ -756,10 +769,10 @@ class HTMLSamplesRenderer extends SamplesRenderer { tableOfContents.append(EOL); tableOfContents.append(" <ul>"); tableOfContents.append(EOL); - + renderHeading(prefixName, prefixName, sampleSection); } - lastAnchor = parts; + lastAnchor = parts; } protected void renderAuthorIndex(Samples samples, StringBuffer sink) { @@ -803,22 +816,22 @@ class SampleUtil { iter.hasNext();) { Sample sample = (Sample) iter.next(); sink.append(i++ + ": " + sample); - } + } } - + /** result struct for getPackagePath */ static class JavaFile { /** input File possibly signifying a java file */ final File path; - - /** String java path suffix in form "com/company/Bar.java" + + /** String java path suffix in form "com/company/Bar.java" * null if this is not a java file */ final String javaPath; - + /** any prefix before java path suffix in the original path */ final String prefix; - + /** error handling */ final Throwable thrown; JavaFile(File path, String javaPath, String prefix, Throwable thrown) { @@ -874,7 +887,7 @@ class SampleUtil { if (null != reader) { try { reader.close(); - } catch (IOException e1) { + } catch (IOException e1) { // ignore } } @@ -891,7 +904,7 @@ class SampleUtil { } return new JavaFile(path, javaPath, prefix, thrown); } - + /** * Extract file path relative to base of package directory * and directory in SAMPLE_BASE_DIR_NAME for this file. @@ -901,10 +914,10 @@ class SampleUtil { public static String renderCodePath(File path) { JavaFile javaFile = getJavaFile(path); if (javaFile.thrown != null) { - throw new Error(javaFile.thrown.getClass() + throw new Error(javaFile.thrown.getClass() + ": " + javaFile.thrown.getMessage()); } - + String file = javaFile.javaPath; // can be null... String prefix = javaFile.prefix; if (prefix == null) { @@ -916,7 +929,7 @@ class SampleUtil { throw new IllegalArgumentException(m + "?: " + path); } prefix = prefix.substring(loc + 1 + SAMPLE_BASE_DIR_NAME.length()); - + if (file == null) { int slash = prefix.lastIndexOf('/'); if (-1 == slash) { @@ -951,11 +964,11 @@ class SampleUtil { } return (one.length > two.length ? two.length : one.length); } - + public static String[] splitAnchorName(Sample sample) { return splitAnchorName(sample.anchorName); } - + public static String[] splitAnchorName(String anchorName) { ArrayList<String> result = new ArrayList<String>(); int start = 0; @@ -969,7 +982,7 @@ class SampleUtil { } next = anchorName.substring(start); result.add(next); - return (String[]) result.toArray(new String[result.size()]); + return result.toArray(new String[result.size()]); } /** * Replace literals with literals in source string @@ -1008,8 +1021,8 @@ class SampleUtil { public static void render( Sample sample, - String fieldDelim, - String valueDelim, + String fieldDelim, + String valueDelim, StringBuffer sink) { if ((null == sink) || (null == sample)) { return; diff --git a/build/src/main/java/org/aspectj/internal/tools/build/Util.java b/build/src/main/java/org/aspectj/internal/tools/build/Util.java index 2fc2dcb72..9a1eb9abc 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Util.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Util.java @@ -1,29 +1,36 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ - + package org.aspectj.internal.tools.build; -import java.io.*; +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.io.Reader; +import java.io.StringWriter; +import java.io.Writer; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.StringTokenizer; import java.util.jar.Attributes; -import java.util.jar.Manifest; import java.util.jar.Attributes.Name; +import java.util.jar.Manifest; -/** +/** * Build-only utilities. * Many mirror utils module APIs. */ @@ -45,8 +52,8 @@ public class Util { JAVA5_VM = java5VM; } - /** - * Map version in long form to short, + /** + * Map version in long form to short, * e.g., replacing "alpha" with "a" */ public static String shortVersion(String version) { @@ -57,7 +64,7 @@ public class Util { version = Util.replace(version, "dev", "d"); return version; } - + /** * Replace any instances of {replace} in {input} with {with}. * @param input the String to search/replace @@ -92,35 +99,35 @@ public class Util { } return passed; } - + /** @throws IllegalArgumentException if cannot read dir */ public static void iaxIfNotCanReadDir(File dir, String name) { if (!canReadDir(dir)) { throw new IllegalArgumentException(name + " dir not readable: " + dir); } } - + /** @throws IllegalArgumentException if cannot read file */ public static void iaxIfNotCanReadFile(File file, String name) { if (!canReadFile(file)) { throw new IllegalArgumentException(name + " file not readable: " + file); } } - + /** @throws IllegalArgumentException if cannot write dir */ public static void iaxIfNotCanWriteDir(File dir, String name) { if (!canWriteDir(dir)) { throw new IllegalArgumentException(name + " dir not writeable: " + dir); } } - + /** @throws IllegalArgumentException if input is null */ public static void iaxIfNull(Object input, String name) { if (null == input) { throw new IllegalArgumentException("null " + name); } } - + /** render exception to String */ public static String renderException(Throwable thrown) { if (null == thrown) { @@ -129,16 +136,16 @@ public class Util { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); pw.println(thrown.getMessage()); - thrown.printStackTrace(pw); + thrown.printStackTrace(pw); pw.flush(); - return sw.getBuffer().toString(); + return sw.getBuffer().toString(); } - + /** @return true if dir is a writable directory */ public static boolean canWriteDir(File dir) { return (null != dir) && dir.canWrite() && dir.isDirectory(); } - + public static String path(String first, String second) { return first + File.separator + second; } @@ -155,31 +162,31 @@ public class Util { } return sb.toString(); } - + /** @return true if dir is a readable directory */ public static boolean canReadDir(File dir) { return (null != dir) && dir.canRead() && dir.isDirectory(); } - + /** @return true if dir is a readable file */ public static boolean canReadFile(File file) { return (null != file) && file.canRead() && file.isFile(); } - - /** + + /** * Delete file or directory. * @param dir the File file or directory to delete. - * @return true if all contents of dir were deleted + * @return true if all contents of dir were deleted */ public static boolean delete(File dir) { return deleteContents(dir) && dir.delete(); } - - /** + + /** * Delete contents of directory. * The directory itself is not deleted. * @param dir the File directory whose contents should be deleted. - * @return true if all contents of dir were deleted + * @return true if all contents of dir were deleted */ public static boolean deleteContents(File dir) { if ((null == dir) || !dir.canWrite()) { @@ -194,7 +201,7 @@ public class Util { } return true; } - + /** @return File temporary directory with the given prefix */ public static File makeTempDir(String prefix) { if (null == prefix) { @@ -203,7 +210,7 @@ public class Util { File tempFile = null; for (int i = 0; i < 10; i++) { try { - tempFile = File.createTempFile(prefix,"tmp"); + tempFile = File.createTempFile(prefix,"tmp"); tempFile.delete(); if (tempFile.mkdirs()) { break; @@ -212,12 +219,12 @@ public class Util { } catch (IOException e) { } } - return tempFile; + return tempFile; } /** * Close stream with the usual checks. - * @param stream the InputStream to close - ignored if null - * @return null if closed without IOException, message otherwise + * @param stream the InputStream to close - ignored if null + * @return null if closed without IOException, message otherwise */ public static String close(Writer stream) { String result = null; @@ -323,12 +330,12 @@ public class Util { /** * Support for OSGI bundles read from manifest files. - * Currently very limited, and will only support the subset of + * Currently very limited, and will only support the subset of * features that we use. * sources: * http://www-128.ibm.com/developerworks/library/os-ecl-osgi/index.html * http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/osgi/org/osgi/framework/Constants.html - */ + */ public static class OSGIBundle { public static final Name BUNDLE_NAME = new Name("Bundle-Name"); @@ -348,9 +355,9 @@ public class Util { public static final Name BUNDLE_CLASSPATH = new Name("Bundle-ClassPath"); /** unmodifiable list of all valid OSGIBundle Name's */ - public static final List NAMES; + public static final List<Name> NAMES; static { - ArrayList names = new ArrayList(); + ArrayList<Name> names = new ArrayList<>(); names.add(BUNDLE_NAME); names.add(BUNDLE_SYMBOLIC_NAME); names.add(BUNDLE_VERSION); @@ -367,7 +374,7 @@ public class Util { private final Attributes attributes; /** - * + * * @param manifestInputStream * the InputStream of the manifest.mf - will be closed. * @throws IOException @@ -414,7 +421,7 @@ public class Util { int skips = 0; while (st.hasMoreTokens()) { String token = st.nextToken(); - int first = token.indexOf("\""); + int first = token.indexOf("\""); if (-1 != first) { if (!st.hasMoreTokens()) { throw new IllegalArgumentException(token); @@ -434,18 +441,18 @@ public class Util { } /** - * Wrap each dependency on another bundle + * Wrap each dependency on another bundle */ public static class RequiredBundle { - + /** unparsed entry text, for debugging */ final String text; - + /** Symbolic name of the required bundle */ final String name; /** if not null, then start/end versions of required bundle - * in the format of the corresponding manifest entry + * in the format of the corresponding manifest entry */ final String versions; @@ -472,7 +479,7 @@ public class Util { int start = RESOLUTION.length(); int end = token.length(); opt = token.substring(start, end); - } + } } versions = vers; optional = "optional".equals(opt); diff --git a/build/src/test/java/org/aspectj/internal/build/BuildClasspathTest.java b/build/src/test/java/org/aspectj/internal/build/BuildClasspathTest.java index 68669df30..c359e648c 100644 --- a/build/src/test/java/org/aspectj/internal/build/BuildClasspathTest.java +++ b/build/src/test/java/org/aspectj/internal/build/BuildClasspathTest.java @@ -1,28 +1,22 @@ /* ******************************************************************* * Copyright (c) 2005 Contributors. - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wes Isberg initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wes Isberg initial implementation * ******************************************************************/ - package org.aspectj.internal.build; -import java.io.File; - -import junit.framework.TestCase; - -import org.aspectj.internal.tools.build.Messager; -import org.aspectj.internal.tools.build.Module; -import org.aspectj.internal.tools.build.Modules; import org.aspectj.internal.tools.build.Result; import org.aspectj.internal.tools.build.Result.Kind; +import junit.framework.TestCase; + public class BuildClasspathTest extends TestCase { public void testKindsGet() { diff --git a/docs/pom.xml b/docs/pom.xml index 323e382d3..ce5aad9a6 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/installer/pom.xml b/installer/pom.xml index b14af4273..0bbb7da4e 100644 --- a/installer/pom.xml +++ b/installer/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> </parent> <artifactId>installer</artifactId> diff --git a/loadtime/pom.xml b/loadtime/pom.xml index 62d05eab0..ef1ad2539 100644 --- a/loadtime/pom.xml +++ b/loadtime/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/org.aspectj.ajdt.core/pom.xml b/org.aspectj.ajdt.core/pom.xml index e7e8f15f6..1d36af960 100644 --- a/org.aspectj.ajdt.core/pom.xml +++ b/org.aspectj.ajdt.core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/org.aspectj.matcher/pom.xml b/org.aspectj.matcher/pom.xml index edad092b4..cfff5ce94 100644 --- a/org.aspectj.matcher/pom.xml +++ b/org.aspectj.matcher/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml index eab653281..a4798a2b4 100644 --- a/org.eclipse.jdt.core/pom.xml +++ b/org.eclipse.jdt.core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> @@ -33,7 +33,7 @@ <configuration> <groupId>org.aspectj</groupId> <artifactId>org.eclipse.jdt.core</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <packaging>jar</packaging> <file>${basedir}/jdtcore-for-aspectj.jar</file> <createChecksum>true</createChecksum> @@ -49,7 +49,7 @@ <configuration> <groupId>org.aspectj</groupId> <artifactId>org.eclipse.jdt.core</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <packaging>jar</packaging> <file>${basedir}/jdtcore-for-aspectj-src.zip</file> <createChecksum>true</createChecksum> @@ -5,14 +5,14 @@ <modelVersion>4.0.0</modelVersion> <properties> - <revision>1.9.4</revision> + <revision>1.9.6.BUILD-SNAPSHOT</revision> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> <packaging>pom</packaging> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <name>AspectJ Parent Project</name> <modules> diff --git a/run-all-junit-tests/pom.xml b/run-all-junit-tests/pom.xml index 75449ce8e..b84bdcf3c 100644 --- a/run-all-junit-tests/pom.xml +++ b/run-all-junit-tests/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/runtime/pom.xml b/runtime/pom.xml index c4ea690a4..81beb0408 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/taskdefs/pom.xml b/taskdefs/pom.xml index 81348c5dc..98b9ae8dd 100644 --- a/taskdefs/pom.xml +++ b/taskdefs/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/testing-client/pom.xml b/testing-client/pom.xml index f6ca2f37c..4eacf144f 100644 --- a/testing-client/pom.xml +++ b/testing-client/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/testing-client/src/main/java/org/aspectj/testing/Tester.java b/testing-client/src/main/java/org/aspectj/testing/Tester.java index 500c4c363..ed0c60f3a 100644 --- a/testing-client/src/main/java/org/aspectj/testing/Tester.java +++ b/testing-client/src/main/java/org/aspectj/testing/Tester.java @@ -1,58 +1,68 @@ /* ******************************************************************* - * 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 v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ - package org.aspectj.testing; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.BitSet; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.StringTokenizer; + import org.aspectj.bridge.IMessage; import org.aspectj.bridge.IMessageHandler; import org.aspectj.bridge.Message; import org.aspectj.util.LangUtil; -import java.util.*; -import java.io.*; - /** * Testing client interface for checking results and reporting * to a delegate IMessageHandler. - * Harnesses providing this interface for test clients must + * Harnesses providing this interface for test clients must * set it up by calling * {@link #setBASEDIR(File)} - * {@link #setMessageHandler(IMessageHandler)} and + * {@link #setMessageHandler(IMessageHandler)} and * {@link #clear()} for each test, as appropriate. * (That means that IMessageHandler must be loaded from a class * loader common to the harness and Tester.) * If clients submit a failing check, this registers the message - * and throws an AbortException holding the message; this + * and throws an AbortException holding the message; this * AbortException <b>will not</b> have the correct stack trace; * all the information should be encoded in the message. * Find any original exception thrown in the message itself. */ - // XXX consider creating exception for new API throwFailure(String m) + // XXX consider creating exception for new API throwFailure(String m) public class Tester { /** delegate for reporting results */ private static IMessageHandler messageHandler; - + /** base directory for calculating relative paths to event files */ private static File BASEDIR; - - /** + + /** * collection of notes submitted */ - private static Set notes; - + private static Set<String> notes; + /** <code>List</code> to hold events submitted. */ private static List<String> actualEvents = new ArrayList<>(); - + /** <code>List</code> to hold events we expect. */ private static List<String> expectedEvents = new ArrayList<>(); @@ -76,21 +86,21 @@ public class Tester { public static File getBASEDIR() { return BASEDIR; } - - + + /** * Set the message handler used for this Tester. - * When given a message of kind FAIL, this handler + * When given a message of kind FAIL, this handler * must complete abruptly or return false (i.e., not handled completely) - * so the Tester throws an AbortException. + * so the Tester throws an AbortException. * @see checkFailed(..). */ - public static void setMessageHandler(IMessageHandler handler) { + public static void setMessageHandler(IMessageHandler handler) { if (null == handler) throw new IllegalArgumentException("null handler"); if (messageHandler != handler) messageHandler = handler; } - + public static void clear() { clearNotes(); clearEvents(); @@ -98,27 +108,27 @@ public class Tester { /** XXX deprecated #clear() */ public static void clearNotes() { - notes = new HashSet(); + notes = new HashSet<>(); } /** XXX deprecated #clear() */ - public static void clearEvents() { - actualEvents = new ArrayList<>(); - expectedEvents = new ArrayList<>(); + public static void clearEvents() { + actualEvents = new ArrayList<>(); + expectedEvents = new ArrayList<>(); } - + /** Add an actual event */ - public static void event(String s) { - actualEvents.add(s); + public static void event(String s) { + actualEvents.add(s); } - + /** * Add a note to {@link #notes}. * @param note Message to add. - * XXX deprecated event(String) + * XXX deprecated event(String) */ - public static void note(Object note) { + public static void note(String note) { notes.add(note); } @@ -127,9 +137,9 @@ public class Tester { * and fails using <code>note.toString()</code> is it wasn't found. * * @param note Message that should've been added using {@link #note}. - * XXX deprecated checkEvent(String) + * XXX deprecated checkEvent(String) */ - public static void check(Object note) { + public static void check(String note) { check(note, "expected note \"" + note.toString() + "\""); } @@ -141,7 +151,7 @@ public class Tester { * @param message Message with which to fail if <code>node</code> * wasn't added. */ - public static void check(Object note, String message) { + public static void check(String note, String message) { check(notes.contains(note), message); } @@ -156,7 +166,7 @@ public class Tester { throwable(t, null); } - + /** * Reports that <code>t</code> shouldn't have been thrown. * using <code>msg</code> as the message. @@ -503,7 +513,7 @@ public class Tester { */ public static void checkEqual(long value, long expectedValue) { checkEqual(value, expectedValue, "compare"); - } + } /** * Compared <code>value</code> and <code>expectedValue</code> @@ -533,7 +543,7 @@ public class Tester { */ public static void checkEqual(double value, double expectedValue) { checkEqual(value, expectedValue, "compare"); - } + } /** * Compared <code>value</code> and <code>expectedValue</code> @@ -564,7 +574,7 @@ public class Tester { */ public static void checkEqual(short value, short expectedValue) { checkEqual(value, expectedValue, "compare"); - } + } /** * Compared <code>value</code> and <code>expectedValue</code> @@ -594,7 +604,7 @@ public class Tester { */ public static void checkEqual(byte value, byte expectedValue) { checkEqual(value, expectedValue, "compare"); - } + } /** * Compares <code>value</code> and <code>expectedValue</code> @@ -624,7 +634,7 @@ public class Tester { */ public static void checkEqual(char value, char expectedValue) { checkEqual(value, expectedValue, "compare"); - } + } /** * Compares <code>value</code> and <code>expectedValue</code> @@ -654,7 +664,7 @@ public class Tester { */ public static void checkEqual(boolean value, boolean expectedValue) { checkEqual(value, expectedValue, "compare"); - } + } /** * Compares <code>value</code> and <code>expectedValue</code> @@ -679,23 +689,23 @@ public class Tester { * @param expectedSet Expected <code>String</code> of values. * @param msg Message with which to fail. */ - public static void checkEqual(Collection set, String expectedSet, String msg) { + public static void checkEqual(Collection<String> set, String expectedSet, String msg) { checkEqual(set, LangUtil.split(expectedSet), msg); } - + /** * Checks whether the entries of <code>set</code> are equal * using <code>equals</code> to the corresponding entry in * <code>expectedSet</code> and fails with message <code>msg</code>, * except that duplicate actual entries are ignored. - * This issues fail messages for each failure; when + * This issues fail messages for each failure; when * aborting on failure, only the first will be reported. * * @param set Unkown set of values. * @param expectedSet Expected <code>String</code> of values. * @param msg Message with which to fail. */ - public static void checkEqualIgnoreDups(Collection set, String[] expected, String msg, + public static void checkEqualIgnoreDups(Collection<String> set, String[] expected, String msg, boolean ignoreDups) { String[] diffs = diffIgnoreDups(set, expected, msg, ignoreDups); if (0 < diffs.length) { @@ -703,11 +713,11 @@ public class Tester { } // for (int i = 0; i < diffs.length; i++) { // check(false, diffs[i]); -// } +// } } - + /** @return String[] of differences '{un}expected msg "..." {not} found' */ - private static String[] diffIgnoreDups(Collection<String> set, String[] expected, String msg, + private static String[] diffIgnoreDups(Collection<String> set, String[] expected, String msg, boolean ignoreDups) { ArrayList<String> result = new ArrayList<>(); ArrayList<String> actual = new ArrayList<>(set); @@ -723,9 +733,9 @@ public class Tester { } } for (String act: actual) { - result.add(" unexpected " + msg + " \"" + act + "\" found"); + result.add(" unexpected " + msg + " \"" + act + "\" found"); } - return (String[]) result.toArray(new String[0]); + return result.toArray(new String[0]); } /** @@ -737,7 +747,7 @@ public class Tester { * @param expectedSet Expected <code>String</code> of values. * @param msg Message with which to fail. */ - public static void checkEqual(Collection set, String[] expected, String msg) { + public static void checkEqual(Collection<String> set, String[] expected, String msg) { checkEqualIgnoreDups(set, expected, msg, false); } @@ -751,7 +761,7 @@ public class Tester { */ public static void checkEqual(Object value, Object expectedValue) { checkEqual(value, expectedValue, "compare"); - } + } /** * Checks whether the entries of <code>set</code> are equal @@ -790,14 +800,14 @@ public class Tester { expectedEvents.add(s); } } - + /** add expected events */ public static void expectEvent(Object s) { if (null != s) { expectEvent(s.toString()); } } - + /** * add expected events, parse out ; from string * Expect those messages in <code>s</code> separated by @@ -836,26 +846,26 @@ public class Tester { if (null != events[i]) { expectEvent(events[i].toString()); } - } + } } } - + /** check actual and expected have same members */ public static void checkAllEvents() { - checkAndClearEvents((String[]) expectedEvents.toArray(new String[0])); + checkAndClearEvents(expectedEvents.toArray(new String[0])); } - + /** also ignore duplicate actual entries for expected */ public static void checkAllEventsIgnoreDups() { final boolean ignoreDups = true; - final String[] exp = (String[]) expectedEvents.toArray(new String[0]); + final String[] exp = expectedEvents.toArray(new String[0]); checkEqualIgnoreDups(actualEvents, exp, "event", ignoreDups); clearEvents(); } - + /** Check events, file is line-delimited. If there is a non-match, signalls - * a single error for the first event that does not match the next event in - * the file. The equivalence is {@link #checkEqualLists}. Blank lines are + * a single error for the first event that does not match the next event in + * the file. The equivalence is {@link #checkEqualLists}. Blank lines are * ignored. lines that start with '//' are ignored. */ public static void checkEventsFromFile(String eventsFile) { // XXX bug reads into current expected and checks all - separate read and check @@ -864,19 +874,20 @@ public class Tester { BufferedReader in = new BufferedReader(new FileReader(file)); //final File parentDir = (null == file? null : file.getParentFile()); String line; - List expEvents = new ArrayList(); + List<String> expEvents = new ArrayList<>(); while ((line = in.readLine()) != null) { line = line.trim(); if ((line.length() < 1) || (line.startsWith("//"))) continue; expEvents.add(line); } + in.close(); checkEqualLists(actualEvents, expEvents, " from " + eventsFile); } catch (IOException ioe) { throwable(ioe); } } - - + + /** Check to see that two lists of strings are the same. Order is important. * Trimmable whitespace is not important. Case is important. * @@ -884,10 +895,10 @@ public class Tester { * @param expected another list * @param message a context string for the resulting error message if the test fails. */ - public static void checkEqualLists(List/*String*/ actual, List/*String*/ expected, + public static void checkEqualLists(List<String> actual, List<String> expected, String message) { - Iterator a = actual.iterator(); - Iterator e = expected.iterator(); + Iterator<String> a = actual.iterator(); + Iterator<String> e = expected.iterator(); int ai = 0; int ei = 0; for (; a.hasNext(); ) { @@ -895,10 +906,10 @@ public class Tester { checkFailed("unexpected [" + ai + "] \"" + a.next() + "\" " + message); return; } - String a0 = ((String) a.next()).trim(); - String e0 = ((String) e.next()).trim(); + String a0 = a.next().trim(); + String e0 = e.next().trim(); if (! a0.equals(e0)) { - checkFailed("expected [" + ei + "] \"" + e0 + checkFailed("expected [" + ei + "] \"" + e0 + "\"\n but found [" + ai + "] \"" + a0 + "\"\n " + message); return; } @@ -909,8 +920,8 @@ public class Tester { checkFailed("expected [" + ei + "] \"" + e.next() + "\" " + message); ei++; } - } - + } + /** Check events, expEvents is space delimited */ public static void checkEvents(String expEvents) { checkEqual(actualEvents, expEvents, "event"); @@ -920,13 +931,13 @@ public class Tester { public static void checkEvents(String[] expEvents) { checkEqual(actualEvents, expEvents, "event"); } - + /** Check events and clear after check*/ public static void checkAndClearEvents(String expEvents) { checkEvents(expEvents); clearEvents(); - } - + } + /** Check events and clear after check*/ public static void checkAndClearEvents(String[] expEvents) { checkEvents(expEvents); @@ -935,7 +946,7 @@ public class Tester { /** XXX deprecated */ public static void printEvents() { // XXX no clients? - for (Iterator i = actualEvents.iterator(); i.hasNext(); ) { + for (Iterator<String> i = actualEvents.iterator(); i.hasNext(); ) { System.out.println(i.next()); // XXX System.out } } @@ -945,13 +956,13 @@ public class Tester { * @param thrown <code>Throwable</code> to print. * @see #maxStackTrace */ - public void unexpectedExceptionFailure(Throwable thrown) { + public void unexpectedExceptionFailure(Throwable thrown) { handle("unexpectedExceptionFailure", thrown, true); } - + /** * Handle message by delegation to message handler, doing - * IMessage.FAIL if (fail || (thrown != null) and IMessage.INFO + * IMessage.FAIL if (fail || (thrown != null) and IMessage.INFO * otherwise. */ @@ -964,7 +975,7 @@ public class Tester { // private static void resofhandle(String message, Throwable thrown, boolean fail) { // /* If FAIL and the message handler returns false (normally), // * Then this preserves "abort" semantics by throwing an -// * abort exception. +// * abort exception. // */ // if (failed) { // if (handled) { diff --git a/testing-client/src/main/java/org/aspectj/testing/server/TestServer.java b/testing-client/src/main/java/org/aspectj/testing/server/TestServer.java index c1f7afc52..a8b500ff0 100644 --- a/testing-client/src/main/java/org/aspectj/testing/server/TestServer.java +++ b/testing-client/src/main/java/org/aspectj/testing/server/TestServer.java @@ -1,6 +1,6 @@ /******************************************************************************* * Copyright (c) 2006,2017 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html @@ -37,19 +37,19 @@ public class TestServer implements Runnable { private String mainClass = "UnknownClass"; private String mainLoader = "UnknownLoader"; - + public void initialize () throws IOException { createRootLoader(); loadConfiguration(); } - + private void loadConfiguration () throws IOException { File file = new File(workingDirectory,"server.properties"); Properties props = new Properties(); FileInputStream in = new FileInputStream(file); props.load(in); in.close(); - + Enumeration<?> enu = props.propertyNames(); while (enu.hasMoreElements()) { String key = (String)enu.nextElement(); @@ -63,7 +63,7 @@ public class TestServer implements Runnable { } } } - + private void createLoader (String property) throws IOException { ClassLoader parent = rootLoader; @@ -73,10 +73,10 @@ public class TestServer implements Runnable { if (debug) System.err.println("Creating loader "+name+" with classpath "+classpath); if (st.hasMoreTokens()) { String parentName = st.nextToken(); - parent = (ClassLoader)loaders.get(parentName); + parent = loaders.get(parentName); if (parent == null) error("No such loader: " + parentName); } - + List<URL> urlList = new ArrayList<>(); st = new StringTokenizer(classpath,";"); while (st.hasMoreTokens()) { @@ -93,10 +93,10 @@ public class TestServer implements Runnable { loaders.put(name,loader); } - + private void createRootLoader() throws IOException { List<URL> urlList = new ArrayList<>(); - + // Sandbox URL url = workingDirectory.getCanonicalFile().toURI().toURL(); urlList.add(url); @@ -112,45 +112,45 @@ public class TestServer implements Runnable { urlList.add(new File(aspectjBase,"runtime/target/classes").toURI().toURL()); // urlList.add(new File(aspectjBase,"aspectjrt/target/classes").toURI().toURL()); // urlList.add(new File(aspectjBase,"aspectj5rt/target/classes").toURI().toURL()); - + URL[] urls = new URL[urlList.size()]; urlList.toArray(urls); ClassLoader parent = getClass().getClassLoader().getParent(); rootLoader = new URLClassLoader(urls,parent); if (debug) System.err.println("? TestServer.createRootLoader() loader=" + rootLoader + ", urlList=" + urlList + ", parent=" + parent); } - + public void setExitOntError (boolean b) { exitOnError = b; } - + public void setWorkingDirectory (String name) { workingDirectory = new File(name); if (!workingDirectory.exists()) error("Missing or invalid working directory: " + workingDirectory.getPath()); } - + public static void main(String[] args) throws Exception { System.out.println("Starting ..."); - + TestServer server = new TestServer(); server.setWorkingDirectory(args[0]); server.initialize(); - + Thread thread = new Thread(server,"application"); thread.start(); thread.join(); - + System.out.println("Stopping ..."); } public void run() { System.out.println("Running " + mainClass); - runClass(mainClass,(ClassLoader)loaders.get(mainLoader)); + runClass(mainClass,loaders.get(mainLoader)); } private void runClass (String className, ClassLoader classLoader) { try { - Class clazz = Class.forName(className,false,classLoader); + Class<?> clazz = Class.forName(className,false,classLoader); invokeMain(clazz,new String[] {}); } catch (ClassNotFoundException ex) { @@ -158,12 +158,12 @@ public class TestServer implements Runnable { error(ex.toString()); } } - + public void invokeMain (Class<?> clazz, String[] args) { Class<?>[] paramTypes = new Class[1]; paramTypes[0] = args.getClass(); - + try { Method method = clazz.getDeclaredMethod("main",paramTypes); Object[] params = new Object[1]; @@ -180,7 +180,7 @@ public class TestServer implements Runnable { error(th.toString()); } } - + private void error (String message) { System.out.println(message); if (exitOnError) System.exit(0); diff --git a/testing-client/src/test/java/org/aspectj/testing/TesterTest.java b/testing-client/src/test/java/org/aspectj/testing/TesterTest.java index d538a63f7..544e46e2f 100644 --- a/testing-client/src/test/java/org/aspectj/testing/TesterTest.java +++ b/testing-client/src/test/java/org/aspectj/testing/TesterTest.java @@ -1,26 +1,25 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, + * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing; -import org.aspectj.bridge.IMessage; -import org.aspectj.bridge.IMessageHandler; - import java.util.ArrayList; -import java.util.Iterator; import java.util.List; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.IMessageHandler; + import junit.framework.TestCase; import junit.textui.TestRunner; @@ -33,7 +32,7 @@ import junit.textui.TestRunner; public class TesterTest extends TestCase { - private static final String ME + private static final String ME = "org.aspectj.testing.TesterTest"; /** @param args ignored */ @@ -48,7 +47,7 @@ public class TesterTest extends TestCase { public TesterTest(String arg0) { super(arg0); } - + /** * Test the usage pattern * <pre>Tester.event("foo"); @@ -57,10 +56,10 @@ public class TesterTest extends TestCase { public void testEventArrayPattern() { MyTestReporter reporter = new MyTestReporter(); Tester.setMessageHandler(reporter); - + //--------- positive test - got expected events reporter.clear(); - Tester.clear(); + Tester.clear(); Tester.event("one"); Tester.event("two"); Tester.checkEvents(new String[] { "one", "two"}); @@ -75,14 +74,14 @@ public class TesterTest extends TestCase { //--------- got and didn't get expected events reporter.clear(); - Tester.clear(); + Tester.clear(); Tester.event("one"); Tester.event("two"); Tester.checkEvents(new String[] { "one", "two", "three"}); reporter.assertSize(1); assertTrue(reporter.gotFail("three")); } - + /** * Test the usage pattern * <pre>Tester.event("foo"); @@ -92,10 +91,10 @@ public class TesterTest extends TestCase { public void testEventStringPattern() { MyTestReporter reporter = new MyTestReporter(); Tester.setMessageHandler(reporter); - + //--------- positive test - got expected events reporter.clear(); - Tester.clear(); + Tester.clear(); Tester.event("one"); Tester.event("two"); Tester.expectEvent("one"); @@ -113,7 +112,7 @@ public class TesterTest extends TestCase { //--------- got and didn't get expected events reporter.clear(); - Tester.clear(); + Tester.clear(); Tester.expectEvent("one"); Tester.expectEvent("two"); Tester.expectEvent("three"); @@ -123,7 +122,7 @@ public class TesterTest extends TestCase { assertTrue(reporter.gotFail("three")); reporter.assertSize(1); } - + /** * Test the usage pattern * <pre>Tester.note("foo"); @@ -132,10 +131,10 @@ public class TesterTest extends TestCase { public void testNotePattern() { MyTestReporter reporter = new MyTestReporter(); Tester.setMessageHandler(reporter); - + //--------- positive test - got expected events reporter.clear(); - Tester.clear(); + Tester.clear(); Tester.note("one"); Tester.note("two"); Tester.check("one"); @@ -152,7 +151,7 @@ public class TesterTest extends TestCase { //--------- got and didn't get expected events reporter.clear(); - Tester.clear(); + Tester.clear(); Tester.note("one"); Tester.check("one"); Tester.note("two"); @@ -161,7 +160,7 @@ public class TesterTest extends TestCase { assertTrue(reporter.gotFail("three")); reporter.assertSize(1); } - + /** * Stub to record failures emitted by Tester. * @author isberg @@ -179,15 +178,15 @@ public class TesterTest extends TestCase { assertTrue(-1 < size); assertTrue("failures: " + failures, size == failures.size()); } - + boolean gotPass(String substring) { return gotItem(passes, substring); } - + boolean gotFail(String substring) { return gotItem(failures, substring); } - + boolean gotItem(List<IMessage> list, String substring) { for (IMessage element: list) { String s = element.getMessage(); @@ -197,13 +196,13 @@ public class TesterTest extends TestCase { } return false; } - + public boolean isIgnoring(IMessage.Kind kind) { return false; } public void dontIgnore(IMessage.Kind kind) { - ; + } public void ignore(IMessage.Kind kind) { @@ -214,13 +213,13 @@ public class TesterTest extends TestCase { return true; } } -} +} // /** // * @see ReporterI#abortWithFailure(String, Throwable) // */ // public void abortWithFailure(String message, Throwable exception) { // if (null == exception) { -// check(message, true); +// check(message, true); // } else { // String s = message + Util.unqualifiedClassName(exception) // + ": " + exception.getMessage(); diff --git a/testing-drivers/pom.xml b/testing-drivers/pom.xml index 63bb5b89d..383732416 100644 --- a/testing-drivers/pom.xml +++ b/testing-drivers/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/testing-util/pom.xml b/testing-util/pom.xml index 7cf0efe74..c1da23789 100644 --- a/testing-util/pom.xml +++ b/testing-util/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/testing-util/src/main/java/org/aspectj/testing/util/TestUtil.java b/testing-util/src/main/java/org/aspectj/testing/util/TestUtil.java index 654efd8c4..ef6109e37 100644 --- a/testing-util/src/main/java/org/aspectj/testing/util/TestUtil.java +++ b/testing-util/src/main/java/org/aspectj/testing/util/TestUtil.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 v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testing.util; @@ -41,6 +41,12 @@ import java.util.Map; import java.util.Properties; import java.util.Set; +import org.aspectj.bridge.IMessageHandler; +import org.aspectj.bridge.MessageUtil; +import org.aspectj.util.FileUtil; +import org.aspectj.util.LangUtil; +import org.aspectj.util.Reflection; + import jdiff.text.FileLine; import jdiff.util.Diff; import jdiff.util.DiffNormalOutput; @@ -52,12 +58,6 @@ import junit.framework.TestResult; import junit.framework.TestSuite; import junit.runner.TestCaseClassLoader; -import org.aspectj.bridge.IMessageHandler; -import org.aspectj.bridge.MessageUtil; -import org.aspectj.util.FileUtil; -import org.aspectj.util.LangUtil; -import org.aspectj.util.Reflection; - /** * Things that junit should perhaps have, but doesn't. Note the file-comparison methods require JDiff to run, but JDiff types are * not required to resolve this class. Also, the bytecode weaver is required to compare class files, but not to compare other files. @@ -125,8 +125,8 @@ public final class TestUtil { LIB_RPATHS.setProperty(TESTING_CLIENT_KEY, "tests/testing-client.jar"); // TODO support others loaded dynamically - Map map = new HashMap(); - for (Iterator iter = LIB_RPATHS.keySet().iterator(); iter.hasNext();) { + Map<String,Object> map = new HashMap<>(); + for (Iterator<Object> iter = LIB_RPATHS.keySet().iterator(); iter.hasNext();) { String key = (String) iter.next(); String path = LIB_RPATHS.getProperty(key); File file = null; @@ -196,7 +196,7 @@ public final class TestUtil { /** * This relies on these being File (where toString() == getPath()) or URL (where toString() == toExternalForm()). - * + * * @param entries the Object[] of File or URL elements * @return the String with entries dlimited by the File.pathSeparator */ @@ -220,9 +220,9 @@ public final class TestUtil { } public static String aspectjrtClasspath() { - return TestUtil.aspectjrtPath().getPath(); + return TestUtil.aspectjrtPath().getPath(); } - + /** * @param input the String to parse for [on|off|true|false] * @throws IllegalArgumentException if input is bad @@ -286,7 +286,7 @@ public final class TestUtil { } /** - * + * * @param rpath the String relative path from the library directory to a resource that must exist (may be a directory), using * forward slashes as a file separator * @return the File path @@ -306,7 +306,7 @@ public final class TestUtil { /** * Like libPath, only it returns a URL. - * + * * @return URL or null if it does not exist * @throws IllegalArgumentException if no such directory or file */ @@ -327,7 +327,7 @@ public final class TestUtil { // ---- unordered - public static void assertSetEquals(Collection expected, Collection found) { + public static void assertSetEquals(Collection<?> expected, Collection<?> found) { assertSetEquals(null, expected, found); } @@ -335,13 +335,13 @@ public final class TestUtil { assertSetEquals(msg, Arrays.asList(expected), Arrays.asList(found)); } - public static void assertSetEquals(String msg, Collection expected, Collection found) { + public static void assertSetEquals(String msg, Collection<?> expected, Collection<?> found) { msg = (msg == null) ? "" : msg + ": "; - Set results1 = new HashSet(found); + Set<Object> results1 = new HashSet<>(found); results1.removeAll(expected); - Set results2 = new HashSet(expected); + Set<Object> results2 = new HashSet<>(expected); results2.removeAll(found); if (results1.isEmpty()) { @@ -403,7 +403,7 @@ public final class TestUtil { BufferedReader r1 = new BufferedReader(new StringReader(s1)); BufferedReader r2 = new BufferedReader(new StringReader(s2)); - List lines = new ArrayList(); + List<String> lines = new ArrayList<>(); String l1, l2; int index = 1; @@ -456,7 +456,7 @@ public final class TestUtil { /** * If there is an expected dir, expect each file in its subtree to match a corresponding actual file in the base directory. This * does NOT check that all actual files have corresponding expected files. This ignores directory paths containing "CVS". - * + * * @param handler the IMessageHandler sink for error messages * @param expectedBaseDir the File path to the directory containing expected files, all of which are compared with any * corresponding actual files @@ -494,7 +494,7 @@ public final class TestUtil { /** * Test interface to compare two files, line by line, and report differences as one FAIL message if a handler is supplied. This * preprocesses .class files by disassembling. - * + * * @param handler the IMessageHandler for any FAIL messages (null to ignore) * @param expectedFile the File path to the canonical file * @param actualFile the File path to the actual file, if any @@ -508,7 +508,7 @@ public final class TestUtil { * Test interface to compare two files, line by line, and report differences as one FAIL message if a handler is supplied. This * preprocesses .class files by disassembling. This method assumes that the files are at the same offset from two respective * base directories. - * + * * @param handler the IMessageHandler for any FAIL messages (null to ignore) * @param expectedBaseDir the File path to the canonical file base directory * @param actualBaseDir the File path to the actual file base directory @@ -766,7 +766,7 @@ public final class TestUtil { /** * Reduce file to CanonicalLine[]. - * + * * @param handler the IMessageHandler for errors (may be null) * @param file the File to render * @param basedir the File for the base directory (may be null) @@ -798,7 +798,7 @@ public final class TestUtil { private abstract static class Lineator implements ILineator { /** * Reduce file to CanonicalLine[]. - * + * * @param handler the IMessageHandler for errors (may be null) * @param file the File to render * @param basedir the File for the base directory (may be null) @@ -916,7 +916,7 @@ public final class TestUtil { } } } - + public static File createEmptySandbox() { File sandbox; @@ -973,11 +973,11 @@ public final class TestUtil { ByteArrayOutputStream missed; - ArrayList sink; + ArrayList<String> sink; public LineStream() { super(new ByteArrayOutputStream()); - this.sink = new ArrayList(); + this.sink = new ArrayList<>(); missed = (ByteArrayOutputStream) out; } @@ -993,11 +993,11 @@ public final class TestUtil { /** * Get String[] of lines printed, delimited by println(..) calls. - * + * * @return lines printed, exclusive of any not yet terminated by newline */ public String[] getLines() { - return (String[]) sink.toArray(new String[0]); + return sink.toArray(new String[0]); } // ---------- PrintStream overrides diff --git a/testing-util/src/test/java/org/aspectj/testingutil/TestCompareClassFile.java b/testing-util/src/test/java/org/aspectj/testingutil/TestCompareClassFile.java index e24ca7be8..fb3e4dbe0 100644 --- a/testing-util/src/test/java/org/aspectj/testingutil/TestCompareClassFile.java +++ b/testing-util/src/test/java/org/aspectj/testingutil/TestCompareClassFile.java @@ -1,28 +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 v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.testingutil; -import org.aspectj.util.LangUtil; - import java.lang.reflect.Array; -import java.util.ArrayList; import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.SortedSet; import java.util.StringTokenizer; -import java.util.TreeSet; + +import org.aspectj.util.LangUtil; /** * This is source for a sample .class file. @@ -45,10 +40,10 @@ public class TestCompareClassFile implements Runnable { } protected static void protectedRunStatic() { } - + private long privateLong; private final Object privateFinalObject; - + private TestCompareClassFile() { super(); privateLong = System.currentTimeMillis(); @@ -65,11 +60,12 @@ public class TestCompareClassFile implements Runnable { } protected void protectedRun() { } - + // ------- misc stolen utility code // Collections Util - public static List getListInMap(Map map, Object key) { - List list = (List)map.get(key); + /* + public static List getListInMap(Map<Object,List> map, Object key) { + List list = map.get(key); if (list == null) { list = new ArrayList(); map.put(key, list); @@ -77,15 +73,16 @@ public class TestCompareClassFile implements Runnable { return list; } - public static SortedSet getSortedSetInMap(Map map, Object key) { - SortedSet list = (SortedSet)map.get(key); + public static SortedSet getSortedSetInMap(Map<Object,SortedSet> map, Object key) { + SortedSet list = map.get(key); if (list == null) { list = new TreeSet(); map.put(key, list); } return list; } - + */ + // LangUtil /** * Make a copy of the array. @@ -116,10 +113,10 @@ public class TestCompareClassFile implements Runnable { lines.add(st.nextToken()); } st = null; - + String line; int elided = 0; - while (!lines.isEmpty()) { + while (!lines.isEmpty()) { line = (String) lines.getLast(); if (null == line) { break; @@ -128,10 +125,10 @@ public class TestCompareClassFile implements Runnable { lines.removeLast(); } } - if ((elided > 0) || (maxLines < 1)) { - final int EOL_LEN = LangUtil.EOL.length(); + if ((elided > 0) || (maxLines < 1)) { + final int EOL_LEN = LangUtil.EOL.length(); int totalLength = 0; - while (!lines.isEmpty()) { + while (!lines.isEmpty()) { totalLength += EOL_LEN + ((String) lines.getFirst()).length(); lines.removeFirst(); } @@ -143,5 +140,5 @@ public class TestCompareClassFile implements Runnable { } } } - + } diff --git a/testing/pom.xml b/testing/pom.xml index 136ea3f05..03f77f995 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/tests/pom.xml b/tests/pom.xml index 5b6e45971..3b2ec7236 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/util/pom.xml b/util/pom.xml index 8ea72028a..266612176 100644 --- a/util/pom.xml +++ b/util/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> </parent> <artifactId>util</artifactId> diff --git a/util/src/test/java/org/aspectj/util/FileUtilTest.java b/util/src/test/java/org/aspectj/util/FileUtilTest.java index 8ce18c700..2d61a6a79 100644 --- a/util/src/test/java/org/aspectj/util/FileUtilTest.java +++ b/util/src/test/java/org/aspectj/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 v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.util; @@ -30,13 +30,13 @@ import java.util.Iterator; import java.util.List; import java.util.ListIterator; -import junit.framework.AssertionFailedError; import junit.framework.TestCase; import junit.textui.TestRunner; /** - * + * */ +@SuppressWarnings("deprecation") public class FileUtilTest extends TestCase { public static final String[] NONE = new String[0]; public static boolean log = false; @@ -57,7 +57,7 @@ public class FileUtilTest extends TestCase { /** * Verify that dir contains files with names, and return the names of other files in dir. - * + * * @return the contents of dir after excluding files or NONE if none * @throws AssertionFailedError if any names are not in dir */ @@ -84,7 +84,7 @@ public class FileUtilTest extends TestCase { /** * Get a sorted String[] of all paths to all files/dirs under dir. Files with names starting with "." are ignored, as are * directory paths containing "CVS". The directory prefix of the path is stripped. Thus, given directory: - * + * * <pre> * path/to * .cvsignore @@ -99,31 +99,31 @@ public class FileUtilTest extends TestCase { * aspectj/ * Version.java * </pre> - * + * * a call - * + * * <pre> * dirPaths(new File("path/to"), new String[0]); * </pre> - * + * * returns - * + * * <pre> * { "Base.java", "com/parc/messages.properties", "org/aspectj/Version.java" } * </pre> - * + * * while the call - * + * * <pre> * dirPaths(new File("path/to"), new String[] { ".java" }); * </pre> - * + * * returns - * + * * <pre> * { "Base.java", "org/aspectj/Version.java" } * </pre> - * + * * @param dir the File path to the directory to inspect * @param suffixes if not empty, require files returned to have this suffix * @return sorted String[] of all paths to all files under dir ending with one of the listed suffixes but not starting with "." @@ -148,7 +148,7 @@ public class FileUtilTest extends TestCase { // trim prefix final String prefix = dir.getPath(); final int len = prefix.length() + 1; // plus directory separator - String[] ra = (String[]) result.toArray(new String[0]); + String[] ra = result.toArray(new String[0]); for (int i = 0; i < ra.length; i++) { // assertTrue(ra[i].startsWith(prefix)); assertTrue(ra[i], ra[i].length() > len); @@ -197,7 +197,7 @@ public class FileUtilTest extends TestCase { public void tearDown() { for (ListIterator<File> iter = tempFiles.listIterator(); iter.hasNext();) { - File dir = (File) iter.next(); + File dir = iter.next(); log("removing " + dir); FileUtil.deleteContents(dir); dir.delete(); @@ -332,7 +332,7 @@ public class FileUtilTest extends TestCase { /** * Method checkGetURL. - * + * * @param string * @param uRL */ diff --git a/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java b/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java index 5a9e083e4..73a272369 100644 --- a/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java +++ b/util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java @@ -1,22 +1,22 @@ /* ******************************************************************* * Copyright (c) 2005-2008 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 + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html * * ******************************************************************/ package org.aspectj.util; -import junit.framework.TestCase; - import org.aspectj.util.GenericSignature.ClassSignature; import org.aspectj.util.GenericSignature.ClassTypeSignature; import org.aspectj.util.GenericSignature.FieldTypeSignature; import org.aspectj.util.GenericSignature.SimpleClassTypeSignature; +import junit.framework.TestCase; + /** * @author Adrian Colyer * @author Andy Clement @@ -176,7 +176,7 @@ public class GenericSignatureParserTest extends TestCase { assertEquals("Ljava/lang/Exception;", mSig.throwsSignatures[0].toString()); assertEquals("Ljava/lang/RuntimeException;", mSig.throwsSignatures[1].toString()); } - + public void testMethodSignaturePrimitiveParams() { GenericSignature.MethodTypeSignature mSig = parser.parseAsMethodSignature("(ILjava/lang/Object;)V"); assertEquals("2 parameters", 2, mSig.parameters.length); @@ -194,8 +194,7 @@ public class GenericSignatureParserTest extends TestCase { } public void testPr107784() { - parser - .parseAsMethodSignature("(Lcom/cibc/responders/mapping/CommonDataBeanScenario;Ljava/lang/Object;)Lcom/cibc/responders/response/Formatter<[BLjava/lang/Object;>;"); + parser.parseAsMethodSignature("(Lcom/cibc/responders/mapping/CommonDataBeanScenario;Ljava/lang/Object;)Lcom/cibc/responders/response/Formatter<[BLjava/lang/Object;>;"); parser.parseAsClassSignature("<Parent:Ljava/lang/Object;Child:Ljava/lang/Object;>Ljava/lang/Object;"); } diff --git a/weaver/pom.xml b/weaver/pom.xml index a7ded5e65..e26530acc 100644 --- a/weaver/pom.xml +++ b/weaver/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.5</version> + <version>1.9.6.BUILD-SNAPSHOT</version> <relativePath>..</relativePath> </parent> |