Browse Source

fix for Bugzilla Bug 58681

 	-X should output available -X options
tags/for_ajdt1_1_12
acolyer 20 years ago
parent
commit
6ea8300440

+ 9
- 3
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/AjdtCommand.java View File

@@ -44,9 +44,15 @@ public class AjdtCommand implements ICommand {
savedArgs = new String[args.length];
System.arraycopy(args, 0, savedArgs, 0, savedArgs.length);
for (int i = 0; i < args.length; i++) {
if ("-help".equals(args[i])) {
// should be info, but handler usually suppresses
MessageUtil.abort(handler, BuildArgParser.getUsage());
// 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(args[i])) {
// should be info, but handler usually suppresses
MessageUtil.abort(handler, BuildArgParser.getXOptionUsage());
return true;
}
}

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

@@ -50,6 +50,10 @@ public class BuildArgParser extends Main {
return Main.bind("misc.usage");
}
public static String getXOptionUsage() {
return Main.bind("xoption.usage");
}
/**
* StringWriter sink for some errors.
* This only captures errors not handled by any IMessageHandler parameter
@@ -557,7 +561,7 @@ public class BuildArgParser extends Main {
handler.handleMessage(errorMessage);
// MessageUtil.warn(handler, message);
}
protected File makeFile(File dir, String name) {
name = name.replace('/', File.separatorChar);
File ret = new File(name);

+ 11
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties View File

@@ -36,6 +36,7 @@ AspectJ-specific options:\n\
\t (<level> may be ignore, warning, or error)\n\
\t-Xlintfile <file> specify properties file to set per-message levels\n\
\t (cf org/aspectj/weaver/XlintDefault.properties)\n\
\t-X print help on non-standard options\n\
\n\
Standard Eclipse compiler options:\n\
\ Options enabled by default are prefixed with ''+''\n\
@@ -115,8 +116,17 @@ Standard Eclipse compiler options:\n\
\ -v -version print compiler version\n\
\ -showversion print compiler version and continue\n

xoption.usage = {compiler.name} non-standard options:\n\
\n\
\t-XnoInline don't inline advice\n\
\t-XlazyTjp create thisJoinPoint objects lazily\n\
\t-Xreweavable create class files that can be subsequently rewoven\n\
\t by AspectJ\n\
\t-Xreweavable:compress as above, but also compress the reweaving information\n\
\t-XnoWeave compile classes but do not weave. Deprecated, use\n\
\t reweavable instead.\n
## options not documented above (per ..ajdt.ajc.BuildArgParser.java):
# -XincrementalFile, -XnoWeave, -XserializableAspects, -XnoInline, -Xreweavable[:compress]
# -XincrementalFile, -XjavadocsInModel

###############################################################################
# Copyright (c) 2000, 2004 IBM Corporation and others.

+ 1
- 1
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java View File

@@ -260,7 +260,7 @@ public class Main {
*/
public void run(String[] args, IMessageHolder holder) {
if (LangUtil.isEmpty(args)) {
args = new String[] { "-help" };
args = new String[] { "-?" };
} else if (controller.running()) {
fail(holder, "already running with controller: " + controller, null);
return;

+ 2
- 0
org.aspectj.ajdt.core/testsrc/EajcModuleTests.java View File

@@ -14,6 +14,7 @@

// default package


import junit.framework.*;
import junit.framework.Test;

@@ -24,6 +25,7 @@ public class EajcModuleTests extends TestCase {
suite.addTest(org.aspectj.ajdt.ajc.AjdtAjcTests.suite());
suite.addTest(org.aspectj.ajdt.internal.compiler.batch.AjdtBatchTests.suite());
suite.addTest(org.aspectj.ajdt.internal.core.builder.AjdtBuilderTests.suite());
suite.addTestSuite(org.aspectj.tools.ajc.MainTest.class);
return suite;
}


+ 8
- 6
org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/MainTest.java View File

@@ -20,14 +20,16 @@ import junit.framework.TestCase;
*
*/
public class MainTest extends TestCase {
public void testMainbare() {
ArrayList list = new ArrayList();
Main.bareMain(new String[] {"-help"}, false, list, null, null, null);
assertTrue(1 == list.size());
Object o = list.get(0);
// Usage now printed by Eclipse compiler so doesn't appear here in our message list
// Main.bareMain(new String[] {"-help"}, false, list, null, null, null);
// assertTrue(1 == list.size());
Main.bareMain(new String[] {"-X"}, false, list, null, null, null);
assertTrue(1 == list.size()); Object o = list.get(0);
assertTrue(o instanceof String);
assertTrue(-1 != ((String)o).indexOf("-aspectpath"));
assertTrue(-1 != ((String)o).indexOf("-incremental"));
// assertTrue(-1 != ((String)o).indexOf("-aspectpath"));
// assertTrue(-1 != ((String)o).indexOf("-incremental"));
}
}

Loading…
Cancel
Save