diff options
author | Andy Clement <aclement@pivotal.io> | 2018-10-10 12:56:00 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2018-10-10 12:56:00 -0700 |
commit | 46a1172aac0b24ccbcb38083ff66d8e8e4ff2d17 (patch) | |
tree | 0088ad1a923a4d13e34f921abd65ab73241bc6d8 /org.aspectj.ajdt.core | |
parent | 95a9c5db0c9b4b0011f12eb0df93beac5278aa0b (diff) | |
download | aspectj-46a1172aac0b24ccbcb38083ff66d8e8e4ff2d17.tar.gz aspectj-46a1172aac0b24ccbcb38083ff66d8e8e4ff2d17.zip |
Reverse default - behave like 1.5 (support annotations) by default
Diffstat (limited to 'org.aspectj.ajdt.core')
8 files changed, 45 insertions, 56 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 448618c11..66488fa8c 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 @@ -815,33 +815,17 @@ public class BuildArgParser extends Main { } else if (arg.equals("-timers")) { buildConfig.setTiming(true); // swallow - it is dealt with in Main.runMain() - } else if (arg.equals("-1.5")) { - buildConfig.setBehaveInJava5Way(true); - unparsedArgs.add("-1.5"); - // this would enable the '-source 1.5' to do the same as '-1.5' but doesnt sound quite right as - // as an option right now as it doesnt mean we support 1.5 source code - people will get confused... - } else if (arg.equals("-1.6")) { - buildConfig.setBehaveInJava5Way(true); - unparsedArgs.add("-1.6"); - } else if (arg.equals("-1.7")) { - buildConfig.setBehaveInJava5Way(true); - unparsedArgs.add("-1.7"); - } else if (arg.equals("-1.8")) { - buildConfig.setBehaveInJava5Way(true); - unparsedArgs.add("-1.8"); - } else if (arg.equals("-1.9")) { - buildConfig.setBehaveInJava5Way(true); - unparsedArgs.add("-1.9"); - } else if (arg.equals("-10")) { - buildConfig.setBehaveInJava5Way(true); - unparsedArgs.add("-10"); + } else if (arg.equals("-1.3")) { + buildConfig.setBehaveInJava5Way(false); + unparsedArgs.add("-1.3"); + } else if (arg.equals("-1.4")) { + buildConfig.setBehaveInJava5Way(false); + unparsedArgs.add("-1.4"); } else if (arg.equals("-source")) { if (args.size() > nextArgIndex) { String level = args.get(nextArgIndex).getValue(); - if (level.equals("1.5") || level.equals("5") || level.equals("1.6") || level.equals("6") || level.equals("1.7") - || level.equals("7") || level.equals("8") || level.equals("1.8") - || level.equals("9") || level.equals("1.9") || level.equals("10")) { - buildConfig.setBehaveInJava5Way(true); + if (level.equals("1.3") || level.equals("1.4")) { + buildConfig.setBehaveInJava5Way(false); } unparsedArgs.add("-source"); unparsedArgs.add(level); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java index a7be9ec6e..cdf534b54 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java @@ -73,7 +73,7 @@ public class AjCompilerOptions extends CompilerOptions { public String xOptionalJoinpoints = null; // If true - autoboxing behaves differently ... - public boolean behaveInJava5Way = false; + public boolean behaveInJava5Way = true; public boolean timing = false; @@ -117,6 +117,7 @@ public class AjCompilerOptions extends CompilerOptions { set(settings); } + @Override public Map<String,String> getMap() { Map<String,String> map = super.getMap(); // now add AspectJ additional options @@ -148,6 +149,7 @@ public class AjCompilerOptions extends CompilerOptions { return map; } + @Override public void set(Map<String,String> optionsMap) { super.set(optionsMap); Object optionValue; @@ -282,6 +284,7 @@ public class AjCompilerOptions extends CompilerOptions { super.warningThreshold.set(CompilerOptions.SwallowedExceptionInCatchBlock); } + @Override public String toString() { StringBuffer buf = new StringBuffer(super.toString()); // now add AspectJ additional options diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/DeclareParents.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/DeclareParents.java index 34b0222bc..c0d796753 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/DeclareParents.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/DeclareParents.java @@ -227,17 +227,17 @@ public class DeclareParents extends AjcTestCase { CompilationResult result = null; // Execute: "ajc <classes> <aspects> -showWeaveInfo" - String[] sourceCompileCommandLine = new String[classes.length + aspects.length + 1]; + String[] sourceCompileCommandLine = new String[classes.length + aspects.length + 2]; System.arraycopy(classes, 0, sourceCompileCommandLine, 0, classes.length); System.arraycopy(aspects, 0, sourceCompileCommandLine, classes.length, aspects.length); - String[] extraOption = new String[] { "-showWeaveInfo" }; - System.arraycopy(extraOption, 0, sourceCompileCommandLine, classes.length + aspects.length, 1); + String[] extraOption = new String[] { "-showWeaveInfo", "-1.4"}; + System.arraycopy(extraOption, 0, sourceCompileCommandLine, classes.length + aspects.length, 2); result = ajc(testBase, sourceCompileCommandLine); if (!expectErrors) assertTrue("errors? \n" + result.getErrorMessages(), !result.hasErrorMessages()); - List sourceWeaveMessages = getWeaveMessages(result); + List<IMessage> sourceWeaveMessages = getWeaveMessages(result); int sourceWeaveMessagesCount = sourceWeaveMessages.size(); - List sourceErrorMessages = result.getErrorMessages(); + List<IMessage> sourceErrorMessages = result.getErrorMessages(); int sourceErrorMessagesCount = sourceErrorMessages.size(); if (verbose) { @@ -258,15 +258,15 @@ public class DeclareParents extends AjcTestCase { assertTrue("Should get no errors for this compile, but got: " + result.getErrorMessages().size(), result.getErrorMessages() .size() == 0); // Execute: "ajc -inpath classes -showWeaveInfo -d classes2 -aspectpath aspects.jar" - result = ajc(testBase, new String[] { "-inpath", "classes", "-showWeaveInfo", "-d", "classes2", "-aspectpath", + result = ajc(testBase, new String[] { "-inpath", "classes", "-showWeaveInfo", "-1.4", "-d", "classes2", "-aspectpath", "aspects.jar" }); if (!expectErrors) assertTrue("unexpected errors? \n" + result.getErrorMessages(), !result.hasErrorMessages()); - List binaryWeaveMessages = getWeaveMessages(result); + List<IMessage> binaryWeaveMessages = getWeaveMessages(result); int binaryWeaveMessagesCount = binaryWeaveMessages.size(); - List binaryErrorMessages = result.getErrorMessages(); + List<IMessage> binaryErrorMessages = result.getErrorMessages(); int binaryErrorMessagesCount = binaryErrorMessages.size(); if (verbose) { @@ -281,11 +281,11 @@ public class DeclareParents extends AjcTestCase { // /////////////////////////////////////////////////////////////////////////// // Check the error messages are comparable (allow for differing orderings) if (compareErrors) { - for (Iterator iter = binaryErrorMessages.iterator(); iter.hasNext();) { - IMessage binaryMessage = (IMessage) iter.next(); + for (Iterator<IMessage> iter = binaryErrorMessages.iterator(); iter.hasNext();) { + IMessage binaryMessage = iter.next(); IMessage correctSourceMessage = null; - for (Iterator iterator = sourceErrorMessages.iterator(); iterator.hasNext() && correctSourceMessage == null;) { - IMessage sourceMessage = (IMessage) iterator.next(); + for (Iterator<IMessage> iterator = sourceErrorMessages.iterator(); iterator.hasNext() && correctSourceMessage == null;) { + IMessage sourceMessage = iterator.next(); if (sourceMessage.getMessage().equals(binaryMessage.getMessage())) { correctSourceMessage = sourceMessage; @@ -298,8 +298,8 @@ public class DeclareParents extends AjcTestCase { sourceErrorMessages.remove(correctSourceMessage); } if (sourceErrorMessages.size() > 0) { - for (Iterator iter = sourceErrorMessages.iterator(); iter.hasNext();) { - IMessage srcMsg = (IMessage) iter.next(); + for (Iterator<IMessage> iter = sourceErrorMessages.iterator(); iter.hasNext();) { + IMessage srcMsg = iter.next(); System.err.println("This error message from source compilation '" + srcMsg + "' didn't occur during binary weaving."); } @@ -316,8 +316,8 @@ public class DeclareParents extends AjcTestCase { // Check weaving messages are comparable for (int i = 0; i < sourceWeaveMessages.size(); i++) { - IMessage m1 = (IMessage) sourceWeaveMessages.get(i); - IMessage m2 = (IMessage) binaryWeaveMessages.get(i); + IMessage m1 = sourceWeaveMessages.get(i); + IMessage m2 = binaryWeaveMessages.get(i); String s1 = m1.getDetails(); String s2 = m2.getDetails(); @@ -355,17 +355,18 @@ public class DeclareParents extends AjcTestCase { return ret; } - private List getWeaveMessages(CompilationResult result) { - List infoMessages = result.getInfoMessages(); - List weaveMessages = new ArrayList(); - for (Iterator iter = infoMessages.iterator(); iter.hasNext();) { - IMessage element = (IMessage) iter.next(); + private List<IMessage> getWeaveMessages(CompilationResult result) { + List<IMessage> infoMessages = result.getInfoMessages(); + List<IMessage> weaveMessages = new ArrayList<>(); + for (IMessage element: infoMessages) {//Iterator iter = infoMessages.iterator(); iter.hasNext();) { +// IMessage element = (IMessage) iter.next(); if (element.getKind() == IMessage.WEAVEINFO) weaveMessages.add(element); } return weaveMessages; } + @Override protected void setUp() throws Exception { super.setUp(); baseDir = new File("../org.aspectj.ajdt.core/testdata", PROJECT_DIR); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java index 8101dc1fd..a9ee51fe9 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java @@ -14,16 +14,15 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import org.aspectj.bridge.IMessage; import org.aspectj.tools.ajc.AjcTestCase; import org.aspectj.tools.ajc.CompilationResult; -import org.aspectj.util.LangUtil; public class JavadocTest extends AjcTestCase { public static final String PROJECT_DIR = "javadoc"; private File baseDir; + @Override protected void setUp() throws Exception { super.setUp(); baseDir = new File("../org.aspectj.ajdt.core/testdata", PROJECT_DIR); @@ -36,7 +35,7 @@ public class JavadocTest extends AjcTestCase { * */ public void testMissingJavadoc() { - String[] args = new String[] { "World.java", "-warn:allJavadoc" }; + String[] args = new String[] { "World.java", "-warn:allJavadoc", "-1.4" }; List<Message> warningMessages = new ArrayList<Message>(); // These warnings are against public textX() methods declared in the World.java diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/PerformanceTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/PerformanceTestCase.java index 1563a57bb..2d678e140 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/PerformanceTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/PerformanceTestCase.java @@ -39,7 +39,7 @@ public class PerformanceTestCase extends CommandTestCase { // into an error so that we can use checkCompiles() ability to check errors occur. // Pass -proceedOnError to ensure even though we get that message, we still get the class file on disk String sandboxName = getSandboxName(); - checkCompile("src1/LazyTjp.aj", new String[] {"-Xlint:error","-proceedOnError"}, new int[] {96}, sandboxName); + checkCompile("src1/LazyTjp.aj", new String[] {"-Xlint:error","-proceedOnError", "-1.4"}, new int[] {96}, sandboxName); runMain("LazyTjp"); } diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java index c4be26936..fc841c5a8 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java @@ -16,9 +16,6 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import junit.framework.AssertionFailedError; -import junit.framework.TestCase; - import org.aspectj.ajdt.StreamPrintWriter; import org.aspectj.ajdt.ajc.AjdtAjcTests; import org.aspectj.ajdt.ajc.BuildArgParser; @@ -27,6 +24,9 @@ import org.aspectj.bridge.MessageHandler; import org.aspectj.bridge.MessageWriter; import org.aspectj.tools.ajc.Ajc; +import junit.framework.AssertionFailedError; +import junit.framework.TestCase; + public class AjBuildManagerTest extends TestCase { private final StreamPrintWriter outputWriter = new StreamPrintWriter(new PrintWriter(System.out)); @@ -62,7 +62,7 @@ public class AjBuildManagerTest extends TestCase { String javaClassPath = System.getProperty("java.class.path"); System.out.println(javaClassPath); String sandboxName = Ajc.createEmptySandbox().getAbsolutePath(); - AjBuildConfig buildConfig = parser.genBuildConfig(new String[] { "-d", sandboxName, "-classpath", javaClassPath, + AjBuildConfig buildConfig = parser.genBuildConfig(new String[] { "-d", sandboxName, "-1.4", "-classpath", javaClassPath, AjdtAjcTests.TESTDATA_PATH + "/src1/A.java", // EajcModuleTests.TESTDATA_PATH + "/src1/Hello.java", }); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/OutjarTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/OutjarTest.java index 6fe4b7f52..32e8fd329 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/OutjarTest.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/OutjarTest.java @@ -30,6 +30,7 @@ public class OutjarTest extends AjcTestCase { * Make copies of JARs used for -injars/-inpath and -aspectpath because so * they are not overwritten when a test fails. */ + @Override protected void setUp() throws Exception { super.setUp(); baseDir = new File("../org.aspectj.ajdt.core/testdata",PROJECT_DIR); @@ -109,7 +110,7 @@ public class OutjarTest extends AjcTestCase { * Expected result = Compile fails with error message. */ public void testOutjarDeletedOnError () { - String[] args = new String[] {"-aspectpath", aspectjarName, "-injars", injarName, "-outjar", outjarName}; + String[] args = new String[] {"-aspectpath", aspectjarName, "-injars", injarName, "-outjar", outjarName,"-1.4"}; Message error = new Message(WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_INTERFACES,"jar1.Parent")); MessageSpec spec = new MessageSpec(null,newMessageList(error)); CompilationResult result = ajc(baseDir,args); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/CompilationResult.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/CompilationResult.java index 01e331523..1265e4502 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/CompilationResult.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/CompilationResult.java @@ -114,7 +114,7 @@ public class CompilationResult { * though. * @see org.aspectj.tools.ajc.AjcTestCase */ - public List /*IMessage*/ getInfoMessages() { return infoMessages; } + public List<IMessage> getInfoMessages() { return infoMessages; } /** * The error messages produced by the compiler. The list * entries are the <code>IMessage</code> objects created during the @@ -152,6 +152,7 @@ public class CompilationResult { * Returns string containing message count summary, list of messages * by type, and the actual ajc compilation command that was issued. */ + @Override public String toString() { StringBuffer buff = new StringBuffer(); buff.append("AspectJ Compilation Result:\n"); |