Browse Source

Support Java10

tags/V1_9_1
Andy Clement 6 years ago
parent
commit
836beab108
39 changed files with 369 additions and 82 deletions
  1. 16
    7
      ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java
  2. 33
    15
      ajdoc/src/org/aspectj/tools/ajdoc/Main.java
  3. 7
    4
      ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java
  4. 2
    0
      bcel-builder/src/org/aspectj/apache/bcel/Constants.java
  5. 42
    9
      bcel-builder/src/org/aspectj/apache/bcel/util/ClassPath.java
  6. BIN
      lib/asm/asm-6.0.jar
  7. BIN
      lib/asm/asm-6.0.renamed.jar
  8. BIN
      lib/asm/asm-6.1.1.jar
  9. BIN
      lib/asm/asm-6.1.1.renamed.jar
  10. 2
    2
      lib/asm/build.xml
  11. BIN
      lib/bcel/bcel-src.zip
  12. BIN
      lib/bcel/bcel-verifier.jar
  13. BIN
      lib/bcel/bcel.jar
  14. 5
    1
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
  15. 2
    1
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java
  16. 8
    3
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java
  17. 6
    1
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
  18. 1
    1
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
  19. 1
    1
      org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjcTestCase.java
  20. BIN
      org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
  21. BIN
      org.eclipse.jdt.core/jdtcore-for-aspectj.jar
  22. 3
    3
      taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
  23. 4
    1
      testing/newsrc/org/aspectj/testing/AjcTest.java
  24. 31
    0
      testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java
  25. 4
    3
      testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java
  26. 6
    0
      tests/bugs191/var/Code1.java
  27. 11
    0
      tests/bugs191/var/Code2.java
  28. 12
    0
      tests/bugs191/var/Code3.java
  29. 10
    10
      tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java
  30. 5
    3
      tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
  31. 4
    2
      tests/src/org/aspectj/systemtest/ajc171/NewFeatures.java
  32. 48
    0
      tests/src/org/aspectj/systemtest/ajc191/Ajc191Tests.java
  33. 25
    0
      tests/src/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java
  34. 36
    0
      tests/src/org/aspectj/systemtest/ajc191/ajc191.xml
  35. 4
    0
      tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java
  36. 12
    2
      tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java
  37. 13
    6
      util/src/org/aspectj/util/LangUtil.java
  38. 1
    1
      weaver/.classpath
  39. 15
    6
      weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java

+ 16
- 7
ajdoc/src/org/aspectj/tools/ajdoc/JavadocRunner.java View File

@@ -14,11 +14,16 @@

package org.aspectj.tools.ajdoc;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Vector;

import org.aspectj.util.LangUtil;
import javax.tools.DocumentationTool;
import javax.tools.DocumentationTool.DocumentationTask;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;

/**
* @author Mik Kersten
@@ -66,11 +71,6 @@ class JavadocRunner {
// }
// } );
// Need to do something different on Java > 9 due to removal of standard doclet I think
// if (LangUtil.is19VMOrGreater()) {
// // Not visible according to module rules...
// clazz = Class.forName("jdk.javadoc.internal.tool.Main");
// }
try {
// for JDK 1.4 and above call the execute method...
Class jdMainClass = com.sun.tools.javadoc.Main.class;
@@ -100,4 +100,13 @@ class JavadocRunner {
// Set the security manager back
// System.setSecurityManager(defaultSecurityManager);
}

public static void callJavadocViaToolProvider(Vector<String> options, List<String> files) {
DocumentationTool doctool = ToolProvider.getSystemDocumentationTool();
StandardJavaFileManager fm = doctool.getStandardFileManager(null, null, null);
Iterable<? extends JavaFileObject> jfos = fm.getJavaFileObjects(files.toArray(new String[0]));
DocumentationTask task = doctool.getTask(null/*standard System.err*/, null/*standard file manager*/,
null/*default diagnostic listener*/, null/*standard doclet*/, options, jfos);
task.call();
}
}

+ 33
- 15
ajdoc/src/org/aspectj/tools/ajdoc/Main.java View File

@@ -35,6 +35,7 @@ import org.aspectj.asm.AsmManager;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.Version;
import org.aspectj.util.FileUtil;
import org.aspectj.util.LangUtil;

/**
* This is an old implementation of ajdoc that does not use an OO style. However, it does the job, and should serve to evolve a
@@ -125,7 +126,7 @@ public class Main implements Config {
}

for (int i = 0; i < filenames.size(); i++) {
inputFiles[i] = new File((String) filenames.elementAt(i));
inputFiles[i] = new File(filenames.elementAt(i));
}

// PHASE 0: call ajc
@@ -223,7 +224,7 @@ public class Main implements Config {
String[] argsToCompiler = new String[ajcOptions.size() + inputFiles.length];
int i = 0;
for (; i < ajcOptions.size(); i++) {
argsToCompiler[i] = (String) ajcOptions.elementAt(i);
argsToCompiler[i] = ajcOptions.elementAt(i);
}
for (int j = 0; j < inputFiles.length; j++) {
argsToCompiler[i] = inputFiles[j].getAbsolutePath();
@@ -237,6 +238,8 @@ public class Main implements Config {
private static void callJavadoc(File[] signatureFiles) throws IOException {
System.out.println("> Calling javadoc...");
String[] javadocargs = null;

List<String> files = new ArrayList<String>();
if (packageMode) {
int numExtraArgs = 2;
if (authorStandardDocletSwitch)
@@ -256,24 +259,37 @@ public class Main implements Config {
}
// javadocargs[1] = getSourcepathAsString();
for (int k = 0; k < options.size(); k++) {
javadocargs[numExtraArgs + k] = (String) options.elementAt(k);
javadocargs[numExtraArgs + k] = options.elementAt(k);
}
for (int k = 0; k < packageList.size(); k++) {
javadocargs[numExtraArgs + options.size() + k] = (String) packageList.elementAt(k);
javadocargs[numExtraArgs + options.size() + k] = packageList.elementAt(k);
}
for (int k = 0; k < fileList.size(); k++) {
javadocargs[numExtraArgs + options.size() + packageList.size() + k] = (String) fileList.elementAt(k);
javadocargs[numExtraArgs + options.size() + packageList.size() + k] = fileList.elementAt(k);
}
if (LangUtil.is19VMOrGreater()) {
options = new Vector<String>();
for (String a: javadocargs) {
options.add(a);
}
}
} else {
javadocargs = new String[options.size() + signatureFiles.length];
for (int k = 0; k < options.size(); k++) {
javadocargs[k] = (String) options.elementAt(k);
javadocargs[k] = options.elementAt(k);
}
for (int k = 0; k < signatureFiles.length; k++) {
javadocargs[options.size() + k] = StructureUtil.translateAjPathName(signatureFiles[k].getCanonicalPath());
}
for (int k = 0; k < signatureFiles.length; k++) {
files.add(StructureUtil.translateAjPathName(signatureFiles[k].getCanonicalPath()));
}
}
if (LangUtil.is19VMOrGreater()) {
JavadocRunner.callJavadocViaToolProvider(options, files);
} else {
JavadocRunner.callJavadoc(javadocargs);
}
JavadocRunner.callJavadoc(javadocargs);
}

/**
@@ -290,7 +306,7 @@ public class Main implements Config {
removeDeclIDsFromFile("serialized-form.html", true);
if (packageList.size() > 0) {
for (int p = 0; p < packageList.size(); p++) {
removeDeclIDsFromFile(((String) packageList.elementAt(p)).replace('.', '/') + Config.DIR_SEP_CHAR
removeDeclIDsFromFile(packageList.elementAt(p).replace('.', '/') + Config.DIR_SEP_CHAR
+ "package-summary.html", true);
}
} else {
@@ -300,6 +316,7 @@ public class Main implements Config {
return;
}
files = FileUtil.listFiles(rootDir, new FileFilter() {
@Override
public boolean accept(File f) {
return f.getName().equals("package-summary.html");
}
@@ -348,7 +365,7 @@ public class Main implements Config {
Vector<String> sourcePath = new Vector<String>();
boolean found = false;
for (int i = 0; i < options.size(); i++) {
String currOption = (String) options.elementAt(i);
String currOption = options.elementAt(i);
if (found && !currOption.startsWith("-")) {
sourcePath.add(currOption);
}
@@ -362,8 +379,8 @@ public class Main implements Config {
static File getRootDir() {
File rootDir = new File(".");
for (int i = 0; i < options.size(); i++) {
if (((String) options.elementAt(i)).equals("-d")) {
rootDir = new File((String) options.elementAt(i + 1));
if (options.elementAt(i).equals("-d")) {
rootDir = new File(options.elementAt(i + 1));
if (!rootDir.exists()) {
rootDir.mkdir();
// System.out.println( "Destination directory not found: " +
@@ -462,7 +479,7 @@ public class Main implements Config {
args = new String[argList.size()];
int counter = 0;
for (Iterator<String> it = argList.iterator(); it.hasNext();) {
args[counter] = (String) it.next();
args[counter] = it.next();
counter++;
}
} catch (FileNotFoundException e) {
@@ -494,7 +511,7 @@ public class Main implements Config {
static String getSourcepathAsString() {
String cPath = "";
for (int i = 0; i < sourcepath.size(); i++) {
cPath += (String) sourcepath.elementAt(i) + Config.DIR_SEP_CHAR + outputWorkingDir;
cPath += sourcepath.elementAt(i) + Config.DIR_SEP_CHAR + outputWorkingDir;
if (i != sourcepath.size() - 1) {
cPath += File.pathSeparator;
}
@@ -667,10 +684,11 @@ public class Main implements Config {

// do this for every item in the classpath
for (int c = 0; c < sourcepath.size(); c++) {
String path = (String) sourcepath.elementAt(c) + Config.DIR_SEP_CHAR + arg;
String path = sourcepath.elementAt(c) + Config.DIR_SEP_CHAR + arg;
File pkg = new File(path);
if (pkg.isDirectory()) {
String[] files = pkg.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
int index1 = name.lastIndexOf(".");
int index2 = name.length();
@@ -684,7 +702,7 @@ public class Main implements Config {
}
});
for (int j = 0; j < files.length; j++) {
filenames.addElement((String) sourcepath.elementAt(c) + Config.DIR_SEP_CHAR + arg
filenames.addElement(sourcepath.elementAt(c) + Config.DIR_SEP_CHAR + arg
+ Config.DIR_SEP_CHAR + files[j]);
}
} else if (c == sourcepath.size()) { // last element on classpath

+ 7
- 4
ajdoc/testsrc/org/aspectj/tools/ajdoc/AjdocTestCase.java View File

@@ -15,12 +15,12 @@ import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import junit.framework.AssertionFailedError;
import junit.framework.TestCase;

import org.aspectj.tools.ajc.Ajc;
import org.aspectj.util.LangUtil;

import junit.framework.AssertionFailedError;
import junit.framework.TestCase;

/**
* This class is the super class of all Ajdoc tests. It creates a sandbox directory and provides utility methods for copying over
* the test projects and running the ajdoc command
@@ -31,6 +31,7 @@ public class AjdocTestCase extends TestCase {
protected static File sandboxDir;
private String docOutdir, projectDir;

@Override
protected void setUp() throws Exception {
super.setUp();
docOutdir = null;
@@ -41,6 +42,7 @@ public class AjdocTestCase extends TestCase {
Main.setOutputWorkingDir(getWorkingDir().getAbsolutePath());
}

@Override
protected void tearDown() throws Exception {
super.tearDown();
// reset where ajdocworkingdir is created
@@ -166,7 +168,8 @@ public class AjdocTestCase extends TestCase {
!sourceLevel.equals("1.6") &&
!sourceLevel.equals("1.7") &&
!sourceLevel.equals("1.8") &&
!sourceLevel.equals("1.9")) {
!sourceLevel.equals("1.9") &&
!sourceLevel.equals("10")) {
fail("need to pass ajdoc '1.3' > '1.9' as the source level");
}
String[] args = new String[6 + inputFiles.length + ajOptions.length];

+ 2
- 0
bcel-builder/src/org/aspectj/apache/bcel/Constants.java View File

@@ -82,6 +82,8 @@ public interface Constants {
public final static short MINOR_1_8 = 0;
public final static short MAJOR_1_9 = 53;
public final static short MINOR_1_9 = 0;
public final static short MAJOR_10 = 54;
public final static short MINOR_10 = 0;
// Defaults
public final static short MAJOR = MAJOR_1_1;
public final static short MINOR = MINOR_1_1;

+ 42
- 9
bcel-builder/src/org/aspectj/apache/bcel/util/ClassPath.java View File

@@ -53,20 +53,29 @@
*/
package org.aspectj.apache.bcel.util;

import java.util.*;
import java.util.zip.*;

import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.net.URI;
import java.nio.file.FileVisitResult;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

/**
* Responsible for loading (class) files from the CLASSPATH. Inspired by
@@ -131,6 +140,7 @@ public class ClassPath implements Serializable {
*
* @deprecated Use SYSTEM_CLASS_PATH constant
*/
@Deprecated
public ClassPath() {
this(getClassPath());
}
@@ -138,14 +148,17 @@ public class ClassPath implements Serializable {
/**
* @return used class path string
*/
@Override
public String toString() {
return class_path;
}

@Override
public int hashCode() {
return class_path.hashCode();
}

@Override
public boolean equals(Object o) {
if (o instanceof ClassPath) {
return class_path.equals(((ClassPath) o).class_path);
@@ -191,6 +204,7 @@ public class ClassPath implements Serializable {
for (Iterator<String> e = dirs.iterator(); e.hasNext();) {
File ext_dir = new File(e.next());
String[] extensions = ext_dir.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
name = name.toLowerCase();
return name.endsWith(".zip") || name.endsWith(".jar");
@@ -212,7 +226,7 @@ public class ClassPath implements Serializable {
}

// On Java9 the sun.boot.class.path won't be set. System classes accessible through JRT filesystem
if (vm_version.startsWith("9")) {
if (vm_version.startsWith("9") || vm_version.startsWith("10")) {
buf.insert(0, File.pathSeparatorChar);
buf.insert(0, System.getProperty("java.home") + File.separator + "lib" + File.separator + JRT_FS);
}
@@ -378,14 +392,17 @@ public class ClassPath implements Serializable {
dir = d;
}

@Override
ClassFile getClassFile(String name, String suffix) throws IOException {
final File file = new File(dir + File.separatorChar + name.replace('.', File.separatorChar) + suffix);

return file.exists() ? new ClassFile() {
@Override
public InputStream getInputStream() throws IOException {
return new FileInputStream(file);
}

@Override
public String getPath() {
try {
return file.getCanonicalPath();
@@ -395,14 +412,17 @@ public class ClassPath implements Serializable {

}

@Override
public long getTime() {
return file.lastModified();
}

@Override
public long getSize() {
return file.length();
}

@Override
public String getBase() {
return dir;
}
@@ -410,6 +430,7 @@ public class ClassPath implements Serializable {
} : null;
}

@Override
public String toString() {
return dir;
}
@@ -472,30 +493,36 @@ public class ClassPath implements Serializable {
this.size = size;
}
@Override
public InputStream getInputStream() throws IOException {
// TODO too costly to keep these in inflated form in memory?
this.bais = new ByteArrayInputStream(bytes);
return this.bais;
}

@Override
public String getPath() {
return this.path;
}

@Override
public String getBase() {
return this.base;
}

@Override
public long getTime() {
return this.time;
}

@Override
public long getSize() {
return this.size;
}
}
@Override
ClassFile getClassFile(String name, String suffix) throws IOException {
// Class files are in here under names like this:
// /modules/java.base/java/lang/Object.class (jdk9 b74)
@@ -522,26 +549,32 @@ public class ClassPath implements Serializable {
zip = z;
}

@Override
ClassFile getClassFile(String name, String suffix) throws IOException {
final ZipEntry entry = zip.getEntry(name.replace('.', '/') + suffix);

return (entry != null) ? new ClassFile() {
@Override
public InputStream getInputStream() throws IOException {
return zip.getInputStream(entry);
}

@Override
public String getPath() {
return entry.toString();
}

@Override
public long getTime() {
return entry.getTime();
}

@Override
public long getSize() {
return entry.getSize();
}

@Override
public String getBase() {
return zip.getName();
}

BIN
lib/asm/asm-6.0.jar View File


BIN
lib/asm/asm-6.0.renamed.jar View File


BIN
lib/asm/asm-6.1.1.jar View File


BIN
lib/asm/asm-6.1.1.renamed.jar View File


+ 2
- 2
lib/asm/build.xml View File

@@ -4,8 +4,8 @@
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"/>

<target name="package" description="Jarjar asm-5.0.4.jar and prefix package name with aj">
<jarjar destfile="asm-6.0.renamed.jar">
<zipfileset src="asm-6.0.jar" excludes="module-info.class"/>
<jarjar destfile="asm-6.1.1.renamed.jar">
<zipfileset src="asm-6.1.1.jar" excludes="module-info.class"/>
<rule pattern="org.objectweb.asm.**" result="aj.org.objectweb.asm.@1"/>
</jarjar>
</target>

BIN
lib/bcel/bcel-src.zip View File


BIN
lib/bcel/bcel-verifier.jar View File


BIN
lib/bcel/bcel.jar View File


+ 5
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java View File

@@ -832,11 +832,15 @@ public class BuildArgParser extends Main {
} else if (arg.equals("-1.9")) {
buildConfig.setBehaveInJava5Way(true);
unparsedArgs.add("-1.9");
} else if (arg.equals("-10")) {
buildConfig.setBehaveInJava5Way(true);
unparsedArgs.add("-10");
} else if (arg.equals("-source")) {
if (args.size() > nextArgIndex) {
String level = args.get(nextArgIndex).getValue();
if (level.equals("1.5") || level.equals("5") || level.equals("1.6") || level.equals("6") || level.equals("1.7")
|| level.equals("7") || level.equals("8") || level.equals("1.8") || level.equals("9") || level.equals("1.9")) {
|| level.equals("7") || level.equals("8") || level.equals("1.8")
|| level.equals("9") || level.equals("1.9") || level.equals("10")) {
buildConfig.setBehaveInJava5Way(true);
}
unparsedArgs.add("-source");

+ 2
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java View File

@@ -56,9 +56,10 @@ public class AjMethodDeclaration extends MethodDeclaration {
return classFile.generateMethodInfoAttributes(binding,extras);
}
@Override
protected int generateInfoAttributes(ClassFile classFile) {
return generateInfoAttributes(classFile,false);
}
}
protected void addDeclarationStartLineAttribute(List extraAttributeList, ClassFile classFile) {
if ((classFile.codeStream.generateAttributes & ClassFileConstants.ATTR_LINES)==0) return;

+ 8
- 3
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java View File

@@ -22,14 +22,12 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeParameter;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.Opcodes;
import org.aspectj.org.eclipse.jdt.internal.compiler.flow.FlowContext;
import org.aspectj.org.eclipse.jdt.internal.compiler.flow.FlowInfo;
import org.aspectj.org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
@@ -59,9 +57,10 @@ import org.aspectj.weaver.UnresolvedType;
*/
public class InterTypeMethodDeclaration extends InterTypeDeclaration {
public InterTypeMethodDeclaration(CompilationResult result, TypeReference onType) {
super(result, onType);
super(result, onType);
}

@Override
public void parseStatements(Parser parser, CompilationUnitDeclaration unit) {
if (ignoreFurtherInvestigation)
return;
@@ -70,6 +69,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
}
}

@Override
protected char[] getPrefix() {
return (NameMangler.ITD_PREFIX + "interMethod$").toCharArray();
}
@@ -91,6 +91,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
super.analyseCode(classScope, flowContext, flowInfo);
}

@Override
public void resolve(ClassScope upperScope) {
if (munger == null)
ignoreFurtherInvestigation = true;
@@ -119,6 +120,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
super.resolve(upperScope);
}

@Override
public void resolveStatements() {
checkAndSetModifiersForMethod();
if ((modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0) {
@@ -196,6 +198,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
}
}

@Override
public EclipseTypeMunger build(ClassScope classScope) {
EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(classScope);

@@ -241,6 +244,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
return new AjAttribute.TypeMunger(munger);
}

@Override
public void generateCode(ClassScope classScope, ClassFile classFile) {
if (ignoreFurtherInvestigation) {
// System.err.println("no code for " + this);
@@ -339,6 +343,7 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration {
classFile.completeMethodInfo(binding,methodAttributeOffset, attributeNumber);
}

@Override
protected Shadow.Kind getShadowKindForBody() {
return Shadow.MethodExecution;
}

+ 6
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java View File

@@ -997,7 +997,12 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour
units[i] = moduleCU;
} else {
units[i] = new CompilationUnit(null, filenames[i], defaultEncoding, null, false, moduleName);
units[i].setModule(moduleCU);
// With Java 10 changes the modulebinding is fetched from the rootenvironment
// this.moduleBinding = rootEnvironment.getModule(this.module);
// rather than using the moduleCU:
// if (this.modCU != null)
// return this.moduleBinding = this.modCU.module(rootEnvironment);
// units[i].setModule(moduleCU);
}
// new CompilationUnit(null, fileName, encoding, this.destinationPaths[i],
// shouldIgnoreOptionalProblems(this.ignoreOptionalProblemsFromFolders, fileName.toCharArray()),

+ 1
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java View File

@@ -2227,7 +2227,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe
if (qualifiedNames.length < qualifiedStrings.elementSize) {
qualifiedNames = null;
}
char[][] simpleNames = ReferenceCollection.internSimpleNames(simpleStrings);
char[][] simpleNames = ReferenceCollection.internSimpleNames(simpleStrings, true);
// if a well known name was found then we can skip over these
if (simpleNames.length < simpleStrings.elementSize) {
simpleNames = null;

+ 1
- 1
org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjcTestCase.java View File

@@ -91,7 +91,7 @@ public class AjcTestCase extends TestCase {
+ File.separator
+ "bcel-verifier.jar"
+ File.pathSeparator + ".." + File.separator + "lib" + File.separator + "asm" + File.separator + "asm-6.0.renamed.jar"
+ File.pathSeparator + ".." + File.separator + "lib" + File.separator + "asm" + File.separator + "asm-6.1.1.renamed.jar"

// When the build machine executes the tests, it is using code built into jars rather than code build into
// bin directories. This means for the necessary types to be found we have to put these jars on the classpath:

BIN
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip View File


BIN
org.eclipse.jdt.core/jdtcore-for-aspectj.jar View File


+ 3
- 3
taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java View File

@@ -254,9 +254,9 @@ public class AjcTask extends MatchingTask {

public static final String COMMAND_EDITOR_NAME = AjcTask.class.getName() + ".COMMAND_EDITOR";

static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9" };
static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9" };
static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9" };
static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10" };
static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10" };
static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", "-10" };

private static final ICommandEditor COMMAND_EDITOR;


+ 4
- 1
testing/newsrc/org/aspectj/testing/AjcTest.java View File

@@ -1,5 +1,5 @@
/* *******************************************************************
* Copyright (c) 2004,2013 IBM Corporation, contributors
* Copyright (c) 2004,2018 IBM Corporation, contributors
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
@@ -27,6 +27,7 @@ public class AjcTest {
private static boolean is17VMOrGreater = false;
private static boolean is18VMOrGreater = false;
private static boolean is19VMOrGreater = false;
private static boolean is10VMOrGreater = false;
static { // matching logic is also in org.aspectj.util.LangUtil
is14VMOrGreater = LangUtil.is14VMOrGreater();
@@ -35,6 +36,7 @@ public class AjcTest {
is17VMOrGreater = LangUtil.is17VMOrGreater();
is18VMOrGreater = LangUtil.is18VMOrGreater();
is19VMOrGreater = LangUtil.is19VMOrGreater();
is10VMOrGreater = LangUtil.is10VMOrGreater();
}

private List<ITestStep> testSteps = new ArrayList<ITestStep>();
@@ -78,6 +80,7 @@ public class AjcTest {
if (vmLevel.equals("1.7")) canRun = is17VMOrGreater;
if (vmLevel.equals("1.8")) canRun = is18VMOrGreater;
if (vmLevel.equals("1.9")) canRun = is19VMOrGreater;
if (vmLevel.equals("10")) canRun = is10VMOrGreater;
if (!canRun) {
System.out.println("***SKIPPING TEST***" + getTitle()+ " needs " + getVmLevel()
+ ", currently running on " + System.getProperty("java.vm.version"));

+ 31
- 0
testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava10OrLater.java View File

@@ -0,0 +1,31 @@
/* *******************************************************************
* Copyright (c) 2018 Contributors
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andy Clement
* ******************************************************************/
package org.aspectj.testing;

/**
* Makes sure tests are running on the right level of JDK.
*
* @author Andy Clement
*/
public abstract class XMLBasedAjcTestCaseForJava10OrLater extends XMLBasedAjcTestCase {

@Override
public void runTest(String title) {
// Check we are on Java10
String property = System.getProperty("java.version");
if (!property.startsWith("10")) {
throw new IllegalStateException("These tests should be run on Java 10 or later");
}
super.runTest(title);
}
}

+ 4
- 3
testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCaseForJava9OrLater.java View File

@@ -11,6 +11,8 @@
* ******************************************************************/
package org.aspectj.testing;

import org.aspectj.util.LangUtil;

/**
* Makes sure tests are running on the right level of JDK.
*
@@ -20,9 +22,8 @@ public abstract class XMLBasedAjcTestCaseForJava9OrLater extends XMLBasedAjcTest

@Override
public void runTest(String title) {
// Check we are on Java9
String property = System.getProperty("java.version");
if (!property.startsWith("9")) {
// Check we are on Java9 or later
if (!LangUtil.is19VMOrGreater()) {
throw new IllegalStateException("These tests should be run on Java 9 or later");
}
super.runTest(title);

+ 6
- 0
tests/bugs191/var/Code1.java View File

@@ -0,0 +1,6 @@
public class Code1 {
public static void main(String []argv) {
var x = "hello";
System.out.println(x.getClass());
}
}

+ 11
- 0
tests/bugs191/var/Code2.java View File

@@ -0,0 +1,11 @@
import java.util.*;
public class Code2 {
public static void main(String []argv) {
foo(new ArrayList<String>());
}

public static void foo(ArrayList<String> als) {
var aly = als;
System.out.println(aly.getClass());
}
}

+ 12
- 0
tests/bugs191/var/Code3.java View File

@@ -0,0 +1,12 @@
public class Code3 {
public static void main(String []argv) {
var x = "hello";
System.out.println(x.getClass());
}
}

aspect X {
before(): call(* *.getClass()) && target(String) {
System.out.println(thisJoinPointStaticPart);
}
}

+ 10
- 10
tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java View File

@@ -15,9 +15,6 @@ import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;

import junit.framework.Test;

import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.apache.bcel.classfile.LocalVariable;
import org.aspectj.apache.bcel.classfile.LocalVariableTable;
import org.aspectj.apache.bcel.classfile.Method;
@@ -27,6 +24,8 @@ import org.aspectj.asm.IProgramElement;
import org.aspectj.asm.IRelationship;
import org.aspectj.testing.XMLBasedAjcTestCase;

import junit.framework.Test;

public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {

public void testGenericAspectsNpe_pr268689() {
@@ -116,14 +115,14 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// assertEquals("/binaries<{Aspect.java}Aspect)Fruit.Fruit_new)QColor;)QString;", itdCtorHandle);
assertEquals("/binaries<(Aspect.class'Aspect)Fruit.Fruit_new)QColor;)QString;", itdCtorHandle);
IProgramElement itdcpe = model.getHierarchy().findElementForHandle(itdCtorHandle);
List ptypes = itdcpe.getParameterTypes();
assertEquals("java.awt.Color", new String((char[]) ptypes.get(0)));
assertEquals("java.lang.String", new String((char[]) ptypes.get(1)));
List<char[]> ptypes = itdcpe.getParameterTypes();
assertEquals("java.awt.Color", new String(ptypes.get(0)));
assertEquals("java.lang.String", new String(ptypes.get(1)));
}

private void printModel(AsmManager model) {
try {
model.dumptree(model.getHierarchy().getRoot(), 0);
AsmManager.dumptree(model.getHierarchy().getRoot(), 0);
model.dumprels(new PrintWriter(System.out));
} catch (Exception e) {
}
@@ -416,6 +415,7 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
return XMLBasedAjcTestCase.loadSuite(Ajc164Tests.class);
}

@Override
protected File getSpecFile() {
return getClassResource("ajc164.xml");
}
@@ -427,9 +427,9 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
if (whereToLook.getSourceLocation() != null && whereToLook.getSourceLocation().getLine() == line) {
return whereToLook;
}
List kids = whereToLook.getChildren();
for (Iterator iterator = kids.iterator(); iterator.hasNext();) {
IProgramElement object = (IProgramElement) iterator.next();
List<IProgramElement> kids = whereToLook.getChildren();
for (Iterator<IProgramElement> iterator = kids.iterator(); iterator.hasNext();) {
IProgramElement object = iterator.next();
if (object.getSourceLocation() != null && object.getSourceLocation().getLine() == line) {
return object;
}

+ 5
- 3
tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java View File

@@ -13,11 +13,12 @@ package org.aspectj.systemtest.ajc165;
import java.io.File;
import java.util.List;

import junit.framework.Test;

import org.aspectj.bridge.IMessage;
import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.weaver.LintMessage;

import junit.framework.Test;

public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {

// fix is too disruptive for 1.6.5
@@ -82,7 +83,7 @@ public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {

public void testAnnotationStyle_pr265356() {
runTest("annotation style message positions");
List ms = ajc.getLastCompilationResult().getWarningMessages();
List<IMessage> ms = ajc.getLastCompilationResult().getWarningMessages();
boolean checked = true;
// Look for the message relating to 'List' and check the offsets
for (int i = 0; i < ms.size(); i++) {
@@ -115,6 +116,7 @@ public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
return XMLBasedAjcTestCase.loadSuite(Ajc165Tests.class);
}

@Override
protected File getSpecFile() {
return getClassResource("ajc165.xml");
}

+ 4
- 2
tests/src/org/aspectj/systemtest/ajc171/NewFeatures.java View File

@@ -12,11 +12,11 @@ package org.aspectj.systemtest.ajc171;

import java.io.File;

import junit.framework.Test;

import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.testing.XMLBasedAjcTestCase;

import junit.framework.Test;

// NOTE THIS IS ACTUALLY IN 1.7.2 - IT IS JUST THAT THE PATCH WAS CREATED AGAINST 1.7.1
public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase {

@@ -60,10 +60,12 @@ public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase {
return XMLBasedAjcTestCase.loadSuite(NewFeatures.class);
}

@SuppressWarnings("unused")
private JavaClass getMyClass(String className) throws ClassNotFoundException {
return getClassFrom(ajc.getSandboxDirectory(), className);
}

@Override
protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc171/newfeatures-tests.xml");
}

+ 48
- 0
tests/src/org/aspectj/systemtest/ajc191/Ajc191Tests.java View File

@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2018 Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andy Clement - initial API and implementation
*******************************************************************************/
package org.aspectj.systemtest.ajc191;

import java.io.File;

import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.testing.XMLBasedAjcTestCaseForJava10OrLater;

import junit.framework.Test;

/**
* @author Andy Clement
*/
public class Ajc191Tests extends XMLBasedAjcTestCaseForJava10OrLater {

public void testVar1() {
runTest("var 1");
}

public void testVar2() {
runTest("var 2");
}

public void testVarIncludesAspect3() {
runTest("var 3");
}

// ---

public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc191Tests.class);
}

@Override
protected File getSpecFile() {
return getClassResource("ajc191.xml");
}

}

+ 25
- 0
tests/src/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java View File

@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2018 Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andy Clement - initial API and implementation
*******************************************************************************/
package org.aspectj.systemtest.ajc191;

import junit.framework.Test;
import junit.framework.TestSuite;

public class AllTestsAspectJ191 {

public static Test suite() {
TestSuite suite = new TestSuite("AspectJ 1.9.1 tests");
// $JUnit-BEGIN$
suite.addTest(Ajc191Tests.suite());
// $JUnit-END$
return suite;
}
}

+ 36
- 0
tests/src/org/aspectj/systemtest/ajc191/ajc191.xml View File

@@ -0,0 +1,36 @@
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>

<suite>

<ajc-test dir="bugs191/var" title="var 1">
<compile files="Code1.java" options="-10">
</compile>
<run class="Code1">
<stdout>
<line text="class java.lang.String"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="bugs191/var" title="var 2">
<compile files="Code2.java" options="-10">
</compile>
<run class="Code2">
<stdout>
<line text="class java.util.ArrayList"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="bugs191/var" title="var 3">
<compile files="Code3.java" options="-10">
</compile>
<run class="Code3">
<stdout>
<line text="call(Class java.lang.Object.getClass())"/>
<line text="class java.util.ArrayList"/>
</stdout>
</run>
</ajc-test>

</suite>

+ 4
- 0
tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java View File

@@ -141,6 +141,7 @@ public class IncrementalPerformanceTests extends AbstractMultiProjectIncremental

// --- helper code ---

@SuppressWarnings("unused")
private void waitFor10() {
try {
Thread.sleep(10000);
@@ -149,6 +150,7 @@ public class IncrementalPerformanceTests extends AbstractMultiProjectIncremental
}
}

@SuppressWarnings("unused")
private void waitForReturn() {
try {
System.in.read();
@@ -157,11 +159,13 @@ public class IncrementalPerformanceTests extends AbstractMultiProjectIncremental
}
}

@Override
protected void setUp() throws Exception {
super.setUp();
testdataSrcDir = "../tests/incrementalPerformance";
}

@Override
protected void tearDown() throws Exception {
super.tearDown();
testdataSrcDir = "../tests/multiIncremental";

+ 12
- 2
tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java View File

@@ -48,6 +48,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
private String inpathTestingDir;
private String expectedOutputDir;

@Override
protected void setUp() throws Exception {
super.setUp();
initialiseProject("inpathTesting");
@@ -71,7 +72,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
Map.Entry<String,File> entry = iterator.next();
String className = entry.getKey();
String fullClassName = expectedOutputDir + File.separator + className.replace('.', File.separatorChar) + ".class";
File file = (File) entry.getValue();
File file = entry.getValue();
assertEquals("expected file to have path \n" + fullClassName + ", but" + " found path \n" + file.getAbsolutePath(),
fullClassName, file.getAbsolutePath());
}
@@ -289,7 +290,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
configureNonStandardCompileOptions("inpathTesting", "-outxml");
build("inpathTesting");
AjState state = getState();
Map m = state.getAspectNamesToFileNameMap();
Map<String,char[]> m = state.getAspectNamesToFileNameMap();
assertEquals("Expected only one aspect recored in the state but found " + m.size(), 1, m.size());
build("inpathTesting");
m = state.getAspectNamesToFileNameMap();
@@ -333,37 +334,46 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
allOutputLocations.add(outputLoc);
}

@Override
public File getOutputLocationForClass(File compilationUnit) {
return outputLoc;
}
@Override
public Map<File,String> getInpathMap() {
return Collections.emptyMap();
}


@Override
public File getOutputLocationForResource(File resource) {
return outputLoc;
}

@Override
public List<File> getAllOutputLocations() {
return allOutputLocations;
}

@Override
public File getDefaultOutputLocation() {
return outputLoc;
}

@Override
public void reportFileWrite(String outputfile, int filetype) {
}

@Override
public void reportFileRemove(String outputfile, int filetype) {
}

@Override
public String getSourceFolderForFile(File sourceFile) {
return null; // no impl
}

@Override
public int discoverChangesSince(File dir, long buildtime) {
return 0; // no impl
}

+ 13
- 6
util/src/org/aspectj/util/LangUtil.java View File

@@ -1,6 +1,7 @@
/* *******************************************************************
* Copyright (c) 1999-2001 Xerox Corporation,
* 2002 Palo Alto Research Center, Incorporated (PARC).
* 2018 Contributors
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
@@ -151,6 +152,10 @@ public class LangUtil {
public static boolean is19VMOrGreater() {
return 9 <= vmVersion;
}
public static boolean is10VMOrGreater() {
return 10 <= vmVersion;
}

/**
* Shorthand for "if null, throw IllegalArgumentException"
@@ -267,7 +272,7 @@ public class LangUtil {
* @param text <code>String</code> to split.
*/
public static String[] split(String text) {
return (String[]) strings(text).toArray(new String[0]);
return strings(text).toArray(new String[0]);
}

/**
@@ -298,7 +303,7 @@ public class LangUtil {
result.add(entry);
}
}
return (String[]) result.toArray(new String[0]);
return result.toArray(new String[0]);
}

/**
@@ -886,7 +891,7 @@ public class LangUtil {
String line;
int elided = 0;
while (!lines.isEmpty()) {
line = (String) lines.getLast();
line = lines.getLast();
if (!checker.acceptString(line)) {
break;
} else {
@@ -898,7 +903,7 @@ public class LangUtil {
final int EOL_LEN = EOL.length();
int totalLength = 0;
while (!lines.isEmpty()) {
totalLength += EOL_LEN + ((String) lines.getFirst()).length();
totalLength += EOL_LEN + lines.getFirst().length();
lines.removeFirst();
}
if (stack.length() > totalLength) {
@@ -1060,7 +1065,7 @@ public class LangUtil {
if (!LangUtil.isEmpty(args)) {
cmd.addAll(Arrays.asList(args));
}
String[] command = (String[]) cmd.toArray(new String[0]);
String[] command = cmd.toArray(new String[0]);
if (null == controller) {
controller = new ProcessController();
}
@@ -1249,7 +1254,7 @@ public class LangUtil {
if (!LangUtil.isEmpty(args)) {
cmd.addAll(Arrays.asList(args));
}
init((String[]) cmd.toArray(new String[0]), mainClass);
init(cmd.toArray(new String[0]), mainClass);
}

public final void init(String[] command, String label) {
@@ -1315,6 +1320,7 @@ public class LangUtil {
inStream = new FileUtil.Pipe(System.in, process.getOutputStream());
// start 4 threads, process & pipes for in, err, out
Runnable processRunner = new Runnable() {
@Override
public void run() {
Throwable thrown = null;
int result = Integer.MIN_VALUE;
@@ -1466,6 +1472,7 @@ public class LangUtil {
thrown = ((null != fromProcess) || (null != fromInPipe) || (null != fromOutPipe) || (null != fromErrPipe));
}

@Override
public String toString() {
StringBuffer sb = new StringBuffer();
append(sb, fromProcess, "process");

+ 1
- 1
weaver/.classpath View File

@@ -13,6 +13,6 @@
<classpathentry kind="lib" path="/lib/bcel/bcel.jar" sourcepath="/lib/bcel/bcel-src.zip"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.aspectj.matcher"/>
<classpathentry kind="lib" path="/lib/asm/asm-6.0.renamed.jar"/>
<classpathentry kind="lib" path="/lib/asm/asm-6.1.1.renamed.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

+ 15
- 6
weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java View File

@@ -118,12 +118,8 @@ public abstract class WeaveTestCase extends TestCase {
gen = classType.getLazyClassGen(); // new LazyClassGen(classType);
}
try {
File possibleVmSpecificFile = new File(TESTDATA_DIR,outName + "." + LangUtil.getVmVersionString()+".txt");
if (possibleVmSpecificFile.exists()) {
checkClass(gen, outDirPath, outName + "." + LangUtil.getVmVersionString()+".txt");
} else {
checkClass(gen, outDirPath, outName + ".txt");
}
String filenameToUse = findMostRelevantFile(outName);
checkClass(gen, outDirPath, filenameToUse);
if (runTests) {
System.out.println("*******RUNNING: " + outName + " " + name + " *******");
TestUtil.runMain(makeClassPath(outDirPath), name);
@@ -137,6 +133,19 @@ public abstract class WeaveTestCase extends TestCase {
throw e;
}
}
public String findMostRelevantFile(String name) {
double version = LangUtil.getVmVersion();
while (version > 0) {
String possibleFileName = name+"."+Double.toString(version)+".txt";
if (new File(TESTDATA_DIR, possibleFileName).exists()) {
return possibleFileName;
}
version--;
}
// Use the standard file
return name+".txt";
}

public String makeClassPath(String outDir) {
return outDir + File.pathSeparator + getTraceJar() + File.pathSeparator + classDir + File.pathSeparator

Loading…
Cancel
Save