aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-05-07 20:29:39 +0000
committerjhugunin <jhugunin>2003-05-07 20:29:39 +0000
commit812c943083102add6057f7a057effd28dd8e3363 (patch)
tree51495ae55d32af74ab330f80ac1b7af50eb512c6
parentb564c8980d179a0ccbed40f9f4cf24c50b582bdc (diff)
downloadaspectj-812c943083102add6057f7a057effd28dd8e3363.tar.gz
aspectj-812c943083102add6057f7a057effd28dd8e3363.zip
fix for reported bug with invalid classpath entries (from the environment)
being reported as errors. These are now just info messages.
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java53
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java8
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java24
3 files changed, 64 insertions, 21 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
index b64b095f6..c5dd98dea 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
@@ -122,13 +122,25 @@ public class BuildArgParser extends Main {
}
}
- List javaArgList = parser.getUnparsedArgs();
+ List javaArgList = new ArrayList();
+
// disable all special eclipse warnings by default
//??? might want to instead override getDefaultOptions()
- javaArgList.add(0, "-warn:none");
- if (javaArgList.size() != 0) {
+ javaArgList.add("-warn:none");
+
+ // these next four lines are some nonsense to fool the eclipse batch compiler
+ // without these it will go searching for reasonable values from properties
+ //TODO fix org.eclipse.jdt.internal.compiler.batch.Main so this hack isn't needed
+ javaArgList.add("-classpath");
+ javaArgList.add(System.getProperty("user.dir"));
+ javaArgList.add("-bootclasspath");
+ javaArgList.add(System.getProperty("user.dir"));
+
+ javaArgList.addAll(parser.getUnparsedArgs());
+
+// if (javaArgList.size() != 0) {
super.configure((String[])javaArgList.toArray(new String[javaArgList.size()]));
- }
+// }
if (buildConfig.getSourceRoots() != null) {
for (Iterator i = buildConfig.getSourceRoots().iterator(); i.hasNext(); ) {
@@ -210,13 +222,12 @@ public class BuildArgParser extends Main {
}
addExtDirs(extdirs, ret);
- if ((classpaths == null || classpaths.length == 0) ||
- (classpaths != null && classpaths[0] == ".")) {
+ if (parser.classpath == null) {
//??? this puts the compiler's classes on the classpath
//??? this is ajc-1.0 compatible
addClasspath(System.getProperty("java.class.path", ""), ret);
} else {
- ret.addAll(Arrays.asList(classpaths));
+ addClasspath(parser.classpath, ret);
}
//??? eclipse seems to put outdir on the classpath
@@ -253,7 +264,8 @@ public class BuildArgParser extends Main {
// !!! extract error handling to be common so that the IDEs can use it
private class AjcConfigParser extends ConfigParser {
- private String bootclasspath = null;
+ private String bootclasspath = null;
+ private String classpath = null;
private String extdirs = null;
private List unparsedArgs = new ArrayList();
private AjBuildConfig buildConfig;
@@ -408,9 +420,16 @@ public class BuildArgParser extends Main {
if (args.size() > nextArgIndex) {
bootclasspath = ((ConfigParser.Arg)args.get(nextArgIndex)).getValue();
args.remove(args.get(nextArgIndex));
- } else {
- showError("-bootclasspath requires classpath entries");
- }
+ } else {
+ showError("-bootclasspath requires classpath entries");
+ }
+ } else if (arg.equals("-classpath")) {
+ if (args.size() > nextArgIndex) {
+ classpath = ((ConfigParser.Arg)args.get(nextArgIndex)).getValue();
+ args.remove(args.get(nextArgIndex));
+ } else {
+ showError("-classpath requires classpath entries");
+ }
} else if (arg.equals("-extdirs")) {
if (args.size() > nextArgIndex) {
extdirs = ((ConfigParser.Arg)args.get(nextArgIndex)).getValue();
@@ -421,12 +440,12 @@ public class BuildArgParser extends Main {
// error on directory unless -d, -{boot}classpath, or -extdirs
} else if (arg.equals("-d")) {
dirLookahead(arg, args, nextArgIndex);
- } else if (arg.equals("-classpath")) {
- dirLookahead(arg, args, nextArgIndex);
- } else if (arg.equals("-bootclasspath")) {
- dirLookahead(arg, args, nextArgIndex);
- } else if (arg.equals("-extdirs")) {
- dirLookahead(arg, args, nextArgIndex);
+// } else if (arg.equals("-classpath")) {
+// dirLookahead(arg, args, nextArgIndex);
+// } else if (arg.equals("-bootclasspath")) {
+// dirLookahead(arg, args, nextArgIndex);
+// } else if (arg.equals("-extdirs")) {
+// dirLookahead(arg, args, nextArgIndex);
} else if (new File(arg).isDirectory()) {
showError("dir arg not permitted: " + arg);
} else {
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
index ca597f2c8..a340565a6 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
@@ -58,7 +58,8 @@ public class BuildArgParserTestCase extends TestCase {
config.getClasspath().contains("2.jar"));
config = parser.genBuildConfig(new String[] { "-1.3" }, messageWriter);
- err = parser.getOtherMessages(true);
+ // these errors are deffered to the compiler now
+ //err = parser.getOtherMessages(true);
//!!!assertTrue(err, null == err);
assertTrue(
config.getClasspath().toString(),
@@ -79,8 +80,9 @@ public class BuildArgParserTestCase extends TestCase {
config = parser.genBuildConfig(new String[] {
"-classpath", ENTRY, "-1.4" }, messageWriter);
- err = parser.getOtherMessages(true);
- assertTrue("expected errors for missing jars", null != err);
+ // these errors are deffered to the compiler now
+ //err = parser.getOtherMessages(true);
+ //assertTrue("expected errors for missing jars", null != err);
assertTrue(
config.getClasspath().toString(),
config.getClasspath().contains("1.jar"));
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java
index 14736ab99..464303753 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java
@@ -13,10 +13,12 @@
package org.aspectj.ajdt.internal.compiler.batch;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.aspectj.ajdt.ajc.AjdtCommand;
import org.aspectj.bridge.ICommand;
+import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.MessageHandler;
/**
@@ -100,6 +102,26 @@ public class BasicCommandTestCase extends CommandTestCase {
runCompiler(args, new int[] {2});
}
+ public void testMissingJarError() {
+ List args = new ArrayList();
+
+ args.add("-d");
+ args.add("out");
+
+ args.add("-classpath");
+ args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin;not_found_anywhere.jar");
+ args.add("testdata/src1/ThisAndModifiers.java");
+
+ ICommand command = new AjdtCommand();
+ MessageHandler myHandler = new MessageHandler();
+ //myHandler.setInterceptor(org.aspectj.tools.ajc.Main.MessagePrinter.TERSE);
+ boolean result = command.runCommand((String[])args.toArray(new String[args.size()]), myHandler);
+
+ //System.err.println("messages: " + Arrays.asList(myHandler.getMessages(IMessage.INFO, true)));
+ // DON'T yet have a way of testing that we actually got a particular info message
+ assertEquals("only info for missing jar", 0, myHandler.getErrors().length);
+
+ }
public void testMissingRuntimeError() {
List args = new ArrayList();
@@ -108,7 +130,7 @@ public class BasicCommandTestCase extends CommandTestCase {
args.add("-classpath");
args.add("../lib/junit/junit.jar;../testing-client/bin");
- args.add("testdata/src1/Xlint.java");
+ args.add("testdata/src1/ThisAndModifiers.java");
ICommand command = new AjdtCommand();
MessageHandler myHandler = new MessageHandler();