Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] [patch] detecting errs in incremental command line

From the command-line, passing no -sourceroots or files when in
incremental mode was not resulting in an error.  This patch fixes that.
I assume we'll add it for 1.1 final and would agree with someone who
wanted to put it in 1.1rc2.  I'll also look into upgrading the harness
to handle content-based line-less expected messages, but will otherwise
check in corresponding JUnit cases with the patch.

Wes

------- cut here ------
Index: src/org/aspectj/ajdt/ajc/AjdtCommand.java
===================================================================
RCS file: /home/technology/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/AjdtCommand.java,v
retrieving revision 1.10
diff -u -r1.10 AjdtCommand.java
--- src/org/aspectj/ajdt/ajc/AjdtCommand.java 7 May 2003 18:11:29 -0000 1.10
+++ src/org/aspectj/ajdt/ajc/AjdtCommand.java 10 May 2003 00:14:18 -0000
@@ -121,12 +121,29 @@
         return false;
     }

-    /** @throws AbortException on error after handling message */
+    /**
+     * This creates a build configuration for the arguments.
+     * Errors reported to the handler:
+     * <ol>
+     *   <li>The parser detects some directly</li>
+     *   <li>The parser grabs some from the error stream
+     *       emitted by its superclass</li>
+     *   <li>The configuration has a self-test</li>
+     * </ol>
+     * In the latter two cases, the errors do not have
+     * a source location context for locating the error.
+     */
     public static AjBuildConfig genBuildConfig(String[] args, CountingMessageHandler handler) {
         BuildArgParser parser = new BuildArgParser();
         AjBuildConfig config = parser.genBuildConfig(args, handler);
         String message = parser.getOtherMessages(true);

+        if (null != message) {
+            IMessage.Kind kind = inferKind(message);
+            IMessage m = new Message(message, kind, null, null);
+            handler.handleMessage(m);
+        }
+        message = config.configErrors();
         if (null != message) {
             IMessage.Kind kind = inferKind(message);
             IMessage m = new Message(message, kind, null, null);
Index: src/org/aspectj/tools/ajc/Main.java
===================================================================
RCS file: /home/technology/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java,v
retrieving revision 1.12
diff -u -r1.12 Main.java
--- src/org/aspectj/tools/ajc/Main.java 8 May 2003 08:31:21 -0000 1.12
+++ src/org/aspectj/tools/ajc/Main.java 10 May 2003 00:14:21 -0000
@@ -502,9 +502,10 @@
          */
         public String[] init(String[] args, IMessageHandler sink) {
             running = true;
+            String[] unused;
             if (!LangUtil.isEmpty(args)) {
                 String[][] options = LangUtil.copyStrings(OPTIONS);
-                args = LangUtil.extractOptions(args, options);
+                unused = LangUtil.extractOptions(args, options);
                 incremental = (null != options[0][0]);
                 if (null != options[1][0]) {
                     File file = new File(options[1][1]);




Back to the top