aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bridge/src/main/java/org/aspectj/bridge/IMessage.java8
-rw-r--r--bridge/src/main/java/org/aspectj/bridge/Message.java7
-rw-r--r--bridge/src/main/java/org/aspectj/bridge/context/PinpointingMessageHandler.java1
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java40
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java6
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/tools/ajc/Main.java2
-rw-r--r--org.eclipse.jdt.core/jdtcore-for-aspectj-src.zipbin5503712 -> 5503741 bytes
-rw-r--r--org.eclipse.jdt.core/jdtcore-for-aspectj.jarbin11294972 -> 11294865 bytes
-rw-r--r--testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java7
9 files changed, 42 insertions, 29 deletions
diff --git a/bridge/src/main/java/org/aspectj/bridge/IMessage.java b/bridge/src/main/java/org/aspectj/bridge/IMessage.java
index b53a8c727..21ef8d7ab 100644
--- a/bridge/src/main/java/org/aspectj/bridge/IMessage.java
+++ b/bridge/src/main/java/org/aspectj/bridge/IMessage.java
@@ -28,8 +28,9 @@ public interface IMessage {
// int values must sync with KINDS order below
Kind WEAVEINFO = new Kind("weaveinfo", 5);
Kind INFO = new Kind("info", 10);
+ Kind USAGE = new Kind("usage", 15);
Kind DEBUG = new Kind("debug", 20);
- Kind TASKTAG = new Kind("task", 25); // represents a 'TODO' from eclipse - producted by the compiler and
+ Kind TASKTAG = new Kind("task", 25); // represents a 'TODO' from eclipse - produced by the compiler and
// consumed by AJDT
Kind WARNING = new Kind("warning", 30);
Kind ERROR = new Kind("error", 40);
@@ -42,7 +43,7 @@ public interface IMessage {
/**
* list of Kind in precedence order. 0 is less than IMessage.Kind#COMPARATOR.compareTo(KINDS.get(i), KINDS.get(i + 1))
*/
- List<Kind> KINDS = Collections.unmodifiableList(Arrays.asList(new Kind[] { WEAVEINFO, INFO, DEBUG, TASKTAG,
+ List<Kind> KINDS = Collections.unmodifiableList(Arrays.asList(new Kind[] { WEAVEINFO, INFO, USAGE, DEBUG, TASKTAG,
WARNING, ERROR, FAIL, ABORT }));
/** @return non-null String with simple message */
@@ -60,6 +61,9 @@ public interface IMessage {
/** @return true if this is an internal debug message */
boolean isDebug();
+ /** @return true if this is a compiler usage message */
+ boolean isUsage();
+
/** @return true if this is information for the user */
boolean isInfo();
diff --git a/bridge/src/main/java/org/aspectj/bridge/Message.java b/bridge/src/main/java/org/aspectj/bridge/Message.java
index a4f17072b..959491c1f 100644
--- a/bridge/src/main/java/org/aspectj/bridge/Message.java
+++ b/bridge/src/main/java/org/aspectj/bridge/Message.java
@@ -121,6 +121,13 @@ public class Message implements IMessage {
return kind == IMessage.DEBUG;
}
+ /**
+ * @return true if kind == IMessage.USAGE
+ */
+ public boolean isUsage() {
+ return kind == IMessage.USAGE;
+ }
+
public boolean isTaskTag() {
return kind == IMessage.TASKTAG;
}
diff --git a/bridge/src/main/java/org/aspectj/bridge/context/PinpointingMessageHandler.java b/bridge/src/main/java/org/aspectj/bridge/context/PinpointingMessageHandler.java
index c54ff6789..b8c975cd0 100644
--- a/bridge/src/main/java/org/aspectj/bridge/context/PinpointingMessageHandler.java
+++ b/bridge/src/main/java/org/aspectj/bridge/context/PinpointingMessageHandler.java
@@ -91,6 +91,7 @@ public class PinpointingMessageHandler implements IMessageHandler {
public boolean isError() { return delegate.isError(); }
public boolean isWarning() { return delegate.isWarning();}
public boolean isDebug() { return delegate.isDebug();}
+ public boolean isUsage() { return delegate.isUsage();}
public boolean isInfo() { return delegate.isInfo();}
public boolean isAbort() { return delegate.isAbort();}
public boolean isTaskTag() { return delegate.isTaskTag();}
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java
index 7fa4e9c36..36168343f 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java
@@ -44,19 +44,6 @@ public class AjdtCommand implements ICommand {
buildManager = new AjBuildManager(handler);
savedArgs = new String[args.length];
System.arraycopy(args, 0, savedArgs, 0, savedArgs.length);
- for (String arg : args) {
-// AMC - PR58681. No need to abort on -help as the Eclipse compiler does the right thing.
-// if ("-help".equals(args[i])) {
-// // should be info, but handler usually suppresses
-// MessageUtil.abort(handler, BuildArgParser.getUsage());
-// return true;
-// } else
- if ("-X".equals(arg)) {
- // should be info, but handler usually suppresses
- MessageUtil.abort(handler, BuildArgParser.getXOptionUsage());
- return true;
- }
- }
return doCommand(handler, false);
}
@@ -103,9 +90,11 @@ public class AjdtCommand implements ICommand {
if (!config.hasSources()) {
MessageUtil.error(counter, "no sources specified");
}
- if (counter.hasErrors()) { // print usage for config errors
- String usage = BuildArgParser.getUsage();
- MessageUtil.abort(handler, usage);
+ if (counter.hasErrors()) {
+ // Do *not* print usage for config errors (just like ECJ does it). Otherwise the user would have to
+ // scroll up several screens in order to actually see the error messages.
+ // String usage = BuildArgParser.getUsage();
+ // MessageUtil.abort(handler, usage);
return false;
}
//System.err.println("errs: " + counter.hasErrors());
@@ -166,14 +155,23 @@ public class AjdtCommand implements ICommand {
return config;
}
- /** @return IMessage.WARNING unless message contains error or info */
+ /**
+ * Heuristically infer the type of output message logged by the AspectJ compiler. This is a simple keyword matcher
+ * looking for substrings like "[error]", "[warning]", "AspectJ-specific options:", "AspectJ-specific non-standard
+ * options:"
+ *
+ * @param message AspectJ compiler message
+ * @return inferred message kind, either of ERROR, WARNING, USAGE, INFO
+ */
protected static IMessage.Kind inferKind(String message) { // XXX dubious
- if (message.contains("error")) {
+ if (message.contains("[error]")) {
return IMessage.ERROR;
- } else if (message.contains("info")) {
- return IMessage.INFO;
- } else {
+ } else if (message.contains("[warning]")) {
return IMessage.WARNING;
+ } else if (message.contains("AspectJ-specific options:") || message.contains("AspectJ-specific non-standard options:")) {
+ return IMessage.USAGE;
+ } else {
+ return IMessage.INFO;
}
}
}
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java
index c120e0293..e078ba7fb 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/BuildArgParser.java
@@ -314,12 +314,6 @@ public class BuildArgParser extends Main {
super.initializeAnnotationProcessorManager();
}
- @Override
- public void printUsage() {
- System.out.println(getUsage());
- System.out.flush();
- }
-
/**
* Get messages not dumped to handler or any PrintWriter.
*
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/tools/ajc/Main.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/tools/ajc/Main.java
index 4b15f0333..81ec01a42 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/tools/ajc/Main.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/tools/ajc/Main.java
@@ -640,6 +640,8 @@ public class Main {
return System.err;
} else if (verbose && IMessage.INFO.equals(kind)) {
return System.out;
+ } else if (IMessage.USAGE.equals(kind)) {
+ return System.out;
} else if (IMessage.WEAVEINFO.equals(kind)) {
return System.out;
} else {
diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
index 8c211a9ad..37f003c8d 100644
--- a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
+++ b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar
index 5ea181e54..4275229c0 100644
--- a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar
+++ b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar
Binary files differ
diff --git a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java
index 970a1c457..594c4b395 100644
--- a/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java
+++ b/testing/src/test/java/org/aspectj/testing/xml/SoftMessage.java
@@ -205,6 +205,13 @@ public class SoftMessage implements IMessage {
return kind == IMessage.DEBUG;
}
+ /**
+ * @return true if kind == IMessage.USAGE
+ */
+ public boolean isUsage() {
+ return kind == IMessage.USAGE;
+ }
+
/**
* @return true if kind == IMessage.INFO
*/