Browse Source

Move to 1.9.6.BUILD-SNAPSHOT version

tags/V1_9_6
Andy Clement 4 years ago
parent
commit
a3e5e4104f
48 changed files with 608 additions and 582 deletions
  1. 1
    1
      ajbrowser/pom.xml
  2. 1
    1
      ajde.core/pom.xml
  3. 1
    1
      ajde/pom.xml
  4. 1
    1
      ajdoc/pom.xml
  5. 1
    1
      asm/pom.xml
  6. 1
    1
      aspectjrt/pom.xml
  7. 1
    1
      aspectjtools/pom.xml
  8. 1
    1
      aspectjweaver/pom.xml
  9. 1
    1
      bcel-builder/pom.xml
  10. 1
    0
      bcel-builder/src/main/java/org/aspectj/apache/bcel/ConstantsInitializer.java
  11. 1
    1
      bcel-builder/src/main/java/org/aspectj/apache/bcel/ExceptionConstants.java
  12. 1
    1
      bridge/pom.xml
  13. 1
    1
      build/pom.xml
  14. 26
    26
      build/src/main/java/$installer$/org/aspectj/Main.java
  15. 19
    18
      build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJInstaller.java
  16. 10
    9
      build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJPush.java
  17. 28
    27
      build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java
  18. 14
    13
      build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java
  19. 11
    10
      build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java
  20. 32
    32
      build/src/main/java/org/aspectj/internal/tools/build/Builder.java
  21. 25
    25
      build/src/main/java/org/aspectj/internal/tools/build/Module.java
  22. 93
    80
      build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java
  23. 56
    49
      build/src/main/java/org/aspectj/internal/tools/build/Util.java
  24. 10
    16
      build/src/test/java/org/aspectj/internal/build/BuildClasspathTest.java
  25. 1
    1
      docs/pom.xml
  26. 1
    1
      installer/pom.xml
  27. 1
    1
      loadtime/pom.xml
  28. 1
    1
      org.aspectj.ajdt.core/pom.xml
  29. 1
    1
      org.aspectj.matcher/pom.xml
  30. 3
    3
      org.eclipse.jdt.core/pom.xml
  31. 2
    2
      pom.xml
  32. 1
    1
      run-all-junit-tests/pom.xml
  33. 1
    1
      runtime/pom.xml
  34. 1
    1
      taskdefs/pom.xml
  35. 1
    1
      testing-client/pom.xml
  36. 100
    89
      testing-client/src/main/java/org/aspectj/testing/Tester.java
  37. 21
    21
      testing-client/src/main/java/org/aspectj/testing/server/TestServer.java
  38. 33
    34
      testing-client/src/test/java/org/aspectj/testing/TesterTest.java
  39. 1
    1
      testing-drivers/pom.xml
  40. 1
    1
      testing-util/pom.xml
  41. 36
    36
      testing-util/src/main/java/org/aspectj/testing/util/TestUtil.java
  42. 27
    30
      testing-util/src/test/java/org/aspectj/testingutil/TestCompareClassFile.java
  43. 1
    1
      testing/pom.xml
  44. 1
    1
      tests/pom.xml
  45. 1
    1
      util/pom.xml
  46. 25
    25
      util/src/test/java/org/aspectj/util/FileUtilTest.java
  47. 9
    10
      util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java
  48. 1
    1
      weaver/pom.xml

+ 1
- 1
ajbrowser/pom.xml View File

@@ -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>


+ 1
- 1
ajde.core/pom.xml View File

@@ -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>


+ 1
- 1
ajde/pom.xml View File

@@ -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>


+ 1
- 1
ajdoc/pom.xml View File

@@ -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>


+ 1
- 1
asm/pom.xml View File

@@ -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>


+ 1
- 1
aspectjrt/pom.xml View File

@@ -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>

+ 1
- 1
aspectjtools/pom.xml View File

@@ -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>

+ 1
- 1
aspectjweaver/pom.xml View File

@@ -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>

+ 1
- 1
bcel-builder/pom.xml View File

@@ -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>


+ 1
- 0
bcel-builder/src/main/java/org/aspectj/apache/bcel/ConstantsInitializer.java View File

@@ -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;

+ 1
- 1
bcel-builder/src/main/java/org/aspectj/apache/bcel/ExceptionConstants.java View File

@@ -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>
*/

+ 1
- 1
bridge/pom.xml View File

@@ -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>


+ 1
- 1
build/pom.xml View File

@@ -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>


+ 26
- 26
build/src/main/java/$installer$/org/aspectj/Main.java View File

@@ -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; }
*/


+ 19
- 18
build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJInstaller.java View File

@@ -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);
}

+ 10
- 9
build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AJPush.java View File

@@ -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;


+ 28
- 27
build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/AntBuilder.java View File

@@ -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 {

+ 14
- 13
build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/Checklics.java View File

@@ -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) {

+ 11
- 10
build/src/main/java/org/aspectj/internal/tools/ant/taskdefs/ConditionalTask.java View File

@@ -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) {

+ 32
- 32
build/src/main/java/org/aspectj/internal/tools/build/Builder.java View File

@@ -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

+ 25
- 25
build/src/main/java/org/aspectj/internal/tools/build/Module.java View File

@@ -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) {

+ 93
- 80
build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java View File

@@ -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>| &nbsp; " + currentAuthor);
sampleSection.append(EOL);
}
sampleSection.append(" &nbsp;|&nbsp; ");
sampleSection.append(" &nbsp;|&nbsp; ");
sampleSection.append(SampleUtil.renderCodePath(sample.sourcePath));
sampleSection.append(":" + sample.startLine);
sampleSection.append(" &nbsp;|");
sampleSection.append(" &nbsp;|");
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;

+ 56
- 49
build/src/main/java/org/aspectj/internal/tools/build/Util.java View File

@@ -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);

+ 10
- 16
build/src/test/java/org/aspectj/internal/build/BuildClasspathTest.java View File

@@ -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() {

+ 1
- 1
docs/pom.xml View File

@@ -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>


+ 1
- 1
installer/pom.xml View File

@@ -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>

+ 1
- 1
loadtime/pom.xml View File

@@ -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>


+ 1
- 1
org.aspectj.ajdt.core/pom.xml View File

@@ -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>


+ 1
- 1
org.aspectj.matcher/pom.xml View File

@@ -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>


+ 3
- 3
org.eclipse.jdt.core/pom.xml View File

@@ -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>

+ 2
- 2
pom.xml View File

@@ -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>

+ 1
- 1
run-all-junit-tests/pom.xml View File

@@ -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>


+ 1
- 1
runtime/pom.xml View File

@@ -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>


+ 1
- 1
taskdefs/pom.xml View File

@@ -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>


+ 1
- 1
testing-client/pom.xml View File

@@ -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>


+ 100
- 89
testing-client/src/main/java/org/aspectj/testing/Tester.java View File

@@ -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) {

+ 21
- 21
testing-client/src/main/java/org/aspectj/testing/server/TestServer.java View File

@@ -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);

+ 33
- 34
testing-client/src/test/java/org/aspectj/testing/TesterTest.java View File

@@ -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();

+ 1
- 1
testing-drivers/pom.xml View File

@@ -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>


+ 1
- 1
testing-util/pom.xml View File

@@ -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>


+ 36
- 36
testing-util/src/main/java/org/aspectj/testing/util/TestUtil.java View File

@@ -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

+ 27
- 30
testing-util/src/test/java/org/aspectj/testingutil/TestCompareClassFile.java View File

@@ -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 {
}
}
}
}

+ 1
- 1
testing/pom.xml View File

@@ -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>


+ 1
- 1
tests/pom.xml View File

@@ -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>


+ 1
- 1
util/pom.xml View File

@@ -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>

+ 25
- 25
util/src/test/java/org/aspectj/util/FileUtilTest.java View File

@@ -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(&quot;path/to&quot;), new String[0]);
* </pre>
*
*
* returns
*
*
* <pre>
* { &quot;Base.java&quot;, &quot;com/parc/messages.properties&quot;, &quot;org/aspectj/Version.java&quot; }
* </pre>
*
*
* while the call
*
*
* <pre>
* dirPaths(new File(&quot;path/to&quot;), new String[] { &quot;.java&quot; });
* </pre>
*
*
* returns
*
*
* <pre>
* { &quot;Base.java&quot;, &quot;org/aspectj/Version.java&quot; }
* </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
*/

+ 9
- 10
util/src/test/java/org/aspectj/util/GenericSignatureParserTest.java View File

@@ -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;");
}


+ 1
- 1
weaver/pom.xml View File

@@ -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>


Loading…
Cancel
Save