aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-14 00:28:34 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-14 00:28:34 +0200
commit26d18421daf10c69858b8a5745d9d7473fac9981 (patch)
treecc38048cea6e27cedbcd234f39e27138293c1bb5
parent60b7a300df7068430ec193d2a52c6876e1891afa (diff)
parentf70aeb5ed94ccdfeaa8ab7b1260a6fcceb490b5a (diff)
downloadaspectj-26d18421daf10c69858b8a5745d9d7473fac9981.tar.gz
aspectj-26d18421daf10c69858b8a5745d9d7473fac9981.zip
Merge branch 'feature/simplify-ajdoc' of github.com:larsgrefer/org.aspectj into feature/github-actions
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
-rw-r--r--.github/workflows/maven.yml2
-rw-r--r--ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java75
-rw-r--r--ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java20
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java150
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java22
-rw-r--r--org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java45
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java5
7 files changed, 123 insertions, 196 deletions
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 1e09e7ae5..ab26f1db3 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -26,4 +26,4 @@ jobs:
- run: java -version
- run: mvn --version
- name: Build with Maven
- run: mvn -B package --file pom.xml
+ run: mvn -Dorg.aspectj.tools.ajc.Ajc.verbose=false -B package --file pom.xml
diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java
index 20ec37f2f..adf22bf12 100644
--- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java
+++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/JavadocRunner.java
@@ -14,8 +14,6 @@
package org.aspectj.tools.ajdoc;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.List;
import java.util.Vector;
@@ -30,79 +28,6 @@ import javax.tools.ToolProvider;
*/
class JavadocRunner {
- static boolean has14ToolsAvailable() {
- try {
- Class<?> jdMainClass = Class.forName("com.sun.tools.javadoc.Main");
- Class<?>[] paramTypes = new Class[] { String[].class };
- jdMainClass.getMethod("execute", paramTypes);
- } catch (NoClassDefFoundError | ClassNotFoundException e) {
- return false;
- } catch (UnsupportedClassVersionError e) {
- return false;
- } catch (NoSuchMethodException e) {
- return false;
- }
- return true;
- }
-
- static void callJavadoc(String[] javadocargs) {
- // final SecurityManager defaultSecurityManager = System.getSecurityManager();
- //
- // System.setSecurityManager( new SecurityManager() {
- // public void checkExit(int status) {
- // if (status == 0) {
- // throw new SecurityException();
- // }
- // else {
- // System.setSecurityManager(defaultSecurityManager);
- // //System.out.println("Error: javadoc exited unexpectedly");
- // System.exit(0);
- // throw new SecurityException();
- // }
- // }
- // public void checkPermission( java.security.Permission permission ) {
- // if ( defaultSecurityManager != null )
- // defaultSecurityManager.checkPermission( permission );
- // }
- // public void checkPermission( java.security.Permission permission,
- // Object context ) {
- // if ( defaultSecurityManager != null )
- // defaultSecurityManager.checkPermission( permission, context );
- // }
- // } );
-
- try {
- // for JDK 1.4 and above call the execute method...
- Class<?> jdMainClass = Class.forName("com.sun.tools.javadoc.Main");
- Method executeMethod = null;
- try {
- Class[] paramTypes = new Class[] { String[].class };
- executeMethod = jdMainClass.getMethod("execute", paramTypes);
- } catch (NoSuchMethodException e) {
- executeMethod = jdMainClass.getMethod("main", String[].class);
- // throw new UnsupportedOperationException("ajdoc requires a tools library from JDK 1.4 or later.");
- }
- try {
- executeMethod.invoke(null, new Object[] { javadocargs });
- } catch (IllegalArgumentException e1) {
- throw new RuntimeException("Failed to invoke javadoc");
- } catch (IllegalAccessException e1) {
- throw new RuntimeException("Failed to invoke javadoc");
- } catch (InvocationTargetException e1) {
- throw new RuntimeException("Failed to invoke javadoc");
- }
- // main method is documented as calling System.exit() - which stops us dead in our tracks
- // com.sun.tools.javadoc.Main.main( javadocargs );
- } catch (SecurityException se) {
- // Do nothing since we expect it to be thrown
- // System.out.println( ">> se: " + se.getMessage() );
- } catch (ClassNotFoundException | NoSuchMethodException e) {
- throw new RuntimeException("Failed to invoke javadoc");
- }
- // 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);
diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java
index 2b2a24a26..26857b41c 100644
--- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java
+++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/Main.java
@@ -35,7 +35,6 @@ 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
@@ -104,11 +103,6 @@ public class Main implements Config {
public static void main(String[] args) {
clearState();
- if (!JavadocRunner.has14ToolsAvailable()) {
- System.err.println("ajdoc requires a JDK 1.4 or later tools jar - exiting");
- aborted = true;
- return;
- }
// STEP 1: parse the command line and do other global setup
sourcepath.addElement("."); // add the current directory to the classapth
@@ -267,11 +261,9 @@ public class Main implements Config {
for (int k = 0; k < fileList.size(); k++) {
javadocargs[numExtraArgs + options.size() + packageList.size() + k] = fileList.elementAt(k);
}
- if (LangUtil.is19VMOrGreater()) {
- options = new Vector<>();
- for (String a: javadocargs) {
- options.add(a);
- }
+ options = new Vector<>();
+ for (String a: javadocargs) {
+ options.add(a);
}
} else {
javadocargs = new String[options.size() + signatureFiles.length];
@@ -285,11 +277,7 @@ public class Main implements Config {
files.add(StructureUtil.translateAjPathName(signatureFile.getCanonicalPath()));
}
}
- if (LangUtil.is19VMOrGreater()) {
- JavadocRunner.callJavadocViaToolProvider(options, files);
- } else {
- JavadocRunner.callJavadoc(javadocargs);
- }
+ JavadocRunner.callJavadocViaToolProvider(options, files);
}
/**
diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java
index 088ff78f9..ebef7661a 100644
--- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java
+++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java
@@ -1,13 +1,13 @@
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Adrian Colyer,
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
* ******************************************************************/
package org.aspectj.tools.ajc;
@@ -17,12 +17,9 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
-import junit.framework.AssertionFailedError;
-
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IProgramElement;
import org.aspectj.asm.IRelationship;
@@ -31,9 +28,9 @@ import org.aspectj.asm.internal.Relationship;
import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.ICommand;
import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.MessageHandler;
-import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.bridge.context.CompilationAndWeavingContext;
import org.aspectj.testing.util.TestUtil;
import org.aspectj.util.FileUtil;
@@ -45,13 +42,13 @@ import org.aspectj.util.FileUtil;
* The expected usage of Ajc is through the TestCase superclass, AjcTestCase, which provides helper methods that conveniently drive
* the base functions exposed by this class.
* </p>
- *
+ *
* @see org.aspectj.tools.ajc.AjcTestCase
*/
public class Ajc {
private static final String BUILD_OUTPUT_FOLDER = "target";
-
+
public static final String outputFolder(String module) {
return File.pathSeparator + ".." +File.separator + module + File.separator + "target" + File.separator + "classes";
}
@@ -63,54 +60,54 @@ public class Ajc {
}
return s.toString();
}
-
+
// ALSO SEE ANTSPEC AND AJCTESTCASE
- private static final String TESTER_PATH = outputFolder("testing-client") + outputFolder("runtime") + outputFolder("bcel-builder")
-// + File.pathSeparator + ".." + File.separator + "runtime" + File.separator + BUILD_OUTPUT_FOLDER //
-// + File.pathSeparator + ".." + File.separator + "aspectj5rt" + File.separator + BUILD_OUTPUT_FOLDER //
- + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "junit" + File.separator + "junit.jar" //
-// + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + File.separator + "bcel.jar" //
-// + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + File.separator
-// + "bcel-verifier.jar" +
-
- + outputFolder("bridge")
- + outputFolder("loadtime")
- + outputFolder("weaver")
- + outputFolder("org.aspectj.matcher")
- + outputFolder("bridge");
-// File.pathSeparator + ".." + File.separator + "bridge" + File.separator + "bin" + File.pathSeparator + ".."
-// + File.separator + "loadtime" + File.separator + "bin" + File.pathSeparator
-// + ".."
-// + File.separator
-// + "weaver"
-// + File.separator
-// + "bin"
-// + File.pathSeparator
-// + ".."
-// + File.separator
-// + "weaver5"
-// + File.separator
-// + "bin"
-// + File.pathSeparator
-// + ".."
-// + File.separator
-// + "org.aspectj.matcher"
-// + File.separator
-// + "bin"
-
- // 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:
-// + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars" + File.separator + "bridge.jar"
-// + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars" + File.separator
-// + "org.aspectj.matcher.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
-// + File.separator + "util.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
-// + File.separator + "loadtime.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
-// + File.separator + "weaver.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
-// + File.separator + "weaver5.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
-// + File.separator + "asm.jar" + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "test"
-// + File.separator + "testing-client.jar"
-// // hmmm, this next one should perhaps point to an aj-build jar...
-// + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "test" + File.separator + "aspectjrt.jar";
+ private static final String TESTER_PATH = outputFolder("testing-client") + outputFolder("runtime") + outputFolder("bcel-builder")
+ // + File.pathSeparator + ".." + File.separator + "runtime" + File.separator + BUILD_OUTPUT_FOLDER //
+ // + File.pathSeparator + ".." + File.separator + "aspectj5rt" + File.separator + BUILD_OUTPUT_FOLDER //
+ + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "junit" + File.separator + "junit.jar" //
+ // + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + File.separator + "bcel.jar" //
+ // + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + File.separator
+ // + "bcel-verifier.jar" +
+
+ + outputFolder("bridge")
+ + outputFolder("loadtime")
+ + outputFolder("weaver")
+ + outputFolder("org.aspectj.matcher")
+ + outputFolder("bridge");
+ // File.pathSeparator + ".." + File.separator + "bridge" + File.separator + "bin" + File.pathSeparator + ".."
+ // + File.separator + "loadtime" + File.separator + "bin" + File.pathSeparator
+ // + ".."
+ // + File.separator
+ // + "weaver"
+ // + File.separator
+ // + "bin"
+ // + File.pathSeparator
+ // + ".."
+ // + File.separator
+ // + "weaver5"
+ // + File.separator
+ // + "bin"
+ // + File.pathSeparator
+ // + ".."
+ // + File.separator
+ // + "org.aspectj.matcher"
+ // + File.separator
+ // + "bin"
+
+ // 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:
+ // + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars" + File.separator + "bridge.jar"
+ // + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars" + File.separator
+ // + "org.aspectj.matcher.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
+ // + File.separator + "util.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
+ // + File.separator + "loadtime.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
+ // + File.separator + "weaver.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
+ // + File.separator + "weaver5.jar" + File.pathSeparator + ".." + File.separator + "aj-build" + File.separator + "jars"
+ // + File.separator + "asm.jar" + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "test"
+ // + File.separator + "testing-client.jar"
+ // // hmmm, this next one should perhaps point to an aj-build jar...
+ // + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "test" + File.separator + "aspectjrt.jar";
private CompilationResult result;
private File sandbox;
@@ -120,7 +117,7 @@ public class Ajc {
private int incrementalStage = 10;
private boolean shouldEmptySandbox = true;
private final AjcCommandController controller;
- private static boolean verbose = System.getProperty("org.aspectj.tools.ajc.Ajc.verbose", "true").equals("true");
+ public static boolean verbose = System.getProperty("org.aspectj.tools.ajc.Ajc.verbose", "true").equals("true");
/**
* Constructs a new Ajc instance, with a new AspectJ compiler inside.
@@ -156,16 +153,16 @@ public class Ajc {
* </p>
* <p>
* For example, given a baseDir of "tests/pr12345" and a compile command: "ajc src/A.java src/B.java", the files in
- *
+ *
* <pre>
* tests/pr12345/
* src/
* A.java
* B.java
* </pre>
- *
+ *
* are copied to:
- *
+ *
* <pre>
* ajcSandbox/ajcTestxxx.tmp/
* src/
@@ -185,7 +182,7 @@ public class Ajc {
* <ul>
* </ul>
* </p>
- *
+ *
* @param args The compiler arguments.
* @return a CompilationResult object with all the messages produced by the compiler, a description of the ajc command that was
* issued, and the standard output and error of the compile (excluding messages which are provided separately)
@@ -272,7 +269,7 @@ public class Ajc {
* Throws an IllegalStateException if you try and call this method without first doing a compile that specified the -incremental
* option.
* </p>
- *
+ *
* @return A CompilationResult giving the results of the most recent increment.
* @throws IOException
*/
@@ -408,10 +405,10 @@ public class Ajc {
String relativeToPath = (fromParent != null) ? (fromParent.getPath() + File.separator) : "";
if (baseDir != null) {
from = new File(baseDir, from.getPath());
-// if (ensureDirsExist) {
-// File toMkdir = (ret.getPath().endsWith(".jar") || ret.getPath().endsWith(".zip"))?ret.getParentFile():ret;
-// toMkdir.mkdirs();
-// }
+ // if (ensureDirsExist) {
+ // File toMkdir = (ret.getPath().endsWith(".jar") || ret.getPath().endsWith(".zip"))?ret.getParentFile():ret;
+ // toMkdir.mkdirs();
+ // }
}
if (!from.exists())
return ret;
@@ -421,6 +418,7 @@ public class Ajc {
if (from.isFile()) {
final String prefix = from.getName().substring(0, from.getName().lastIndexOf('.'));
String[] toCopy = from.getParentFile().list(new FilenameFilter() {
+ @Override
public boolean accept(File dir, String name) {
if (name.indexOf('.') == -1)
return false;
@@ -488,9 +486,10 @@ class AjcCommandController extends Main.CommandController {
/*
* (non-Javadoc)
- *
+ *
* @see org.aspectj.tools.ajc.Main.CommandController#doRepeatCommand()
*/
+ @Override
boolean doRepeatCommand(ICommand command) {
this.command = command;
return false; // ensure that control returns to caller
@@ -498,9 +497,10 @@ class AjcCommandController extends Main.CommandController {
/*
* (non-Javadoc)
- *
+ *
* @see org.aspectj.tools.ajc.Main.CommandController#running()
*/
+ @Override
public boolean running() {
return false; // so that we can come back for more...
}
@@ -514,6 +514,7 @@ class AjcCommandController extends Main.CommandController {
class AbortInterceptor implements IMessageHandler {
+ @Override
public boolean handleMessage(IMessage message) throws AbortException {
if (message.getKind() == IMessage.ABORT) {
System.err.println("***** Abort Message Received ******");
@@ -527,15 +528,18 @@ class AbortInterceptor implements IMessageHandler {
return false;
}
+ @Override
public boolean isIgnoring(Kind kind) {
if (kind != IMessage.ABORT)
return true;
return false;
}
+ @Override
public void dontIgnore(Kind kind) {
}
+ @Override
public void ignore(Kind kind) {
}
}
diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java
index 5488ab1b2..6ef5ff14a 100644
--- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java
+++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java
@@ -26,7 +26,6 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
@@ -673,7 +672,9 @@ public abstract class AjcTestCase extends TestCase {
cp.append(TestUtil.aspectjrtPath().getPath()).append(File.pathSeparator);
}
String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " +vmargs+ (cp.length()==0?"":" -classpath " + cp) + " -p "+mp+" --module "+moduleName ;
- System.out.println("Command is "+command);
+ if (Ajc.verbose) {
+ System.out.println("Command is "+command);
+ }
// Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance
ProcessBuilder pb = new ProcessBuilder(tokenizeCommand(command));
pb.directory( new File(ajc.getSandboxDirectory().getAbsolutePath()));
@@ -697,7 +698,9 @@ public abstract class AjcTestCase extends TestCase {
cp.append(File.pathSeparator).append(TestUtil.aspectjrtPath().getPath());
}
String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " +vmargs+ (cp.length()==0?"":" -classpath " + cp) + " " + className ;
- System.out.println("Command is "+command);
+ if (Ajc.verbose) {
+ System.out.println("\nCommand is "+command);
+ }
// Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance
ProcessBuilder pb = new ProcessBuilder(tokenizeCommand(command));
pb.directory( new File(ajc.getSandboxDirectory().getAbsolutePath()));
@@ -756,6 +759,7 @@ public abstract class AjcTestCase extends TestCase {
Class<?> toRun = sandboxLoader.loadClass(className);
Method mainMethod = toRun.getMethod("main", new Class[] { String[].class });
+
mainMethod.invoke(null, new Object[] { args });
} catch (ClassNotFoundException cnf) {
fail("Can't find class: " + className);
@@ -803,15 +807,21 @@ public abstract class AjcTestCase extends TestCase {
PrintWriter stdOutWriter = new PrintWriter(baosOut);
PrintWriter stdErrWriter = new PrintWriter(baosErr);
+ if (Ajc.verbose) {
+ System.out.println();
+ }
while ((line = stdInput.readLine()) != null) {
stdOutWriter.println(line);
- System.out.println(line);
+ if (Ajc.verbose) {
+ System.out.println(line);
+ }
}
stdOutWriter.flush();
while ((line = stdError.readLine()) != null) {
stdErrWriter.println(line);
- System.err.println(line);
-
+ if (Ajc.verbose) {
+ System.err.println(line);
+ }
}
stdErrWriter.flush();
diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java
index a7d661038..047879a32 100644
--- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java
+++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java
@@ -1,18 +1,17 @@
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Adrian Colyer,
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer,
* ******************************************************************/
package org.aspectj.tools.ajc;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import org.aspectj.bridge.IMessage;
@@ -20,7 +19,7 @@ import org.aspectj.bridge.IMessage;
/**
* Utility class that makes the results of a compiler run available.
* <p>
- * Instances of this class are returned by the Ajc.compile() and
+ * Instances of this class are returned by the Ajc.compile() and
* doIncrementalCompile() methods (and the AjcTestCase.ajc() wrapper).
* </p>
* <p>
@@ -33,7 +32,7 @@ import org.aspectj.bridge.IMessage;
* </p>
*/
public class CompilationResult {
-
+
private String[] args;
private String stdOut;
private String stdErr;
@@ -46,7 +45,7 @@ public class CompilationResult {
/**
* Build a compilation result - called by the Ajc.compile and
* Ajc.doIncrementalCompile methods. Should be no need for you
- * to construct an instance yourself.
+ * to construct an instance yourself.
*/
protected CompilationResult(
String[] args,
@@ -62,24 +61,24 @@ public class CompilationResult {
this.stdErr = stdErr;
this.infoMessages = (infoMessages == null) ? Collections.<IMessage>emptyList() : infoMessages;
this.errorMessages = (errorMessages == null) ? Collections.<IMessage>emptyList() : errorMessages;
- this.warningMessages = (warningMessages == null) ? Collections.<IMessage>emptyList() : warningMessages;
- this.failMessages = (failMessages == null) ? Collections.<IMessage>emptyList() : failMessages;
- this.weaveMessages = (weaveMessages == null) ? Collections.<IMessage>emptyList() : weaveMessages;
+ this.warningMessages = (warningMessages == null) ? Collections.<IMessage>emptyList() : warningMessages;
+ this.failMessages = (failMessages == null) ? Collections.<IMessage>emptyList() : failMessages;
+ this.weaveMessages = (weaveMessages == null) ? Collections.<IMessage>emptyList() : weaveMessages;
}
-
+
/**
* The arguments that were passed to the compiler.
*/
public String[] getArgs() { return args; }
/**
- * The standard output written by the compiler, excluding any messages.
+ * The standard output written by the compiler, excluding any messages.
*/
public String getStandardOutput() { return stdOut; }
/**
- * The standard error written by the compiler, excluding any messages.
+ * The standard error written by the compiler, excluding any messages.
*/
public String getStandardError() { return stdErr; }
-
+
/**
* True if the compiler issued any messages of any kind.
*/
@@ -104,7 +103,7 @@ public class CompilationResult {
* True if the compiler issued one or more weave info messages.
*/
public boolean hasWeaveMessages() { return !weaveMessages.isEmpty(); }
-
+
/**
* The informational messages produced by the compiler. The list
* entries are the <code>IMessage</code> objects created during the
@@ -145,9 +144,9 @@ public class CompilationResult {
* @see org.aspectj.tools.ajc.AjcTestCase
*/
public List<IMessage> getFailMessages() { return failMessages; }
-
+
public List<IMessage> getWeaveMessages() { return weaveMessages; }
-
+
/**
* Returns string containing message count summary, list of messages
* by type, and the actual ajc compilation command that was issued.
@@ -171,7 +170,7 @@ public class CompilationResult {
buff.append(" fail, )");
buff.append(weaveMessages.size());
buff.append(" weaveInfo");
- }
+ }
buff.append("\n");
int msgNo = 1;
for (IMessage failMessage : failMessages) {
diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java
index 9ede3e99d..9be8f80de 100644
--- a/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java
@@ -45,6 +45,7 @@ public class StackMapAdder {
cr.accept(cv, 0);
return cw.toByteArray();
} catch (Throwable t) {
+ // If in here fixing an error about version, change the ASMX in class above!
System.err.println("AspectJ Internal Error: unable to add stackmap attributes. " + t.getMessage());
t.printStackTrace();
AsmDetector.isAsmAround = false;
@@ -55,7 +56,7 @@ public class StackMapAdder {
private static class AspectJClassVisitor extends ClassVisitor {
public AspectJClassVisitor(ClassVisitor classwriter) {
- super(Opcodes.ASM7, classwriter);
+ super(Opcodes.ASM8, classwriter);
}
@Override
@@ -68,7 +69,7 @@ public class StackMapAdder {
// created by a ClassWriter (see top level class comment)
static class AJMethodVisitor extends MethodVisitor {
public AJMethodVisitor(MethodVisitor mv) {
- super(Opcodes.ASM7,mv);
+ super(Opcodes.ASM8,mv);
}
}