]> source.dussan.org Git - aspectj.git/commitdiff
Fix 415957: annotations with 1.8 flags
authorAndy Clement <aclement@gopivotal.com>
Tue, 27 Aug 2013 20:25:30 +0000 (13:25 -0700)
committerAndy Clement <aclement@gopivotal.com>
Tue, 27 Aug 2013 20:25:30 +0000 (13:25 -0700)
ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
tests/bugs180/415957/MyAspect.aj [new file with mode: 0644]
tests/bugs180/415957/MyClass.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc180/Ajc180Tests.java
tests/src/org/aspectj/systemtest/ajc180/ajc180.xml

index 8ebfb842421bfbdf30372076a09423eb1b809889..0bf95bb5671a01068d57132816ae20b1b328f13c 100644 (file)
@@ -301,9 +301,7 @@ public class AjdeCoreBuildManager {
                Map jom = compilerConfig.getJavaOptionsMap();
                if (jom != null) {
                        String version = (String) jom.get(CompilerOptions.OPTION_Compliance);
-                       if (version != null
-                                       && (version.equals(CompilerOptions.VERSION_1_5) || version.equals(CompilerOptions.VERSION_1_6) || version
-                                                       .equals(CompilerOptions.VERSION_1_7))) {
+                       if (version != null && !version.equals(CompilerOptions.VERSION_1_4)) {
                                config.setBehaveInJava5Way(true);
                        }
                        config.getOptions().set(jom);
index 8ffc933ef0a0f2710695cbc9b576671a08c636e3..1f8ad86f2589277cfdfa0182ebd61bc6902a04c7 100644 (file)
@@ -692,11 +692,14 @@ public class BuildArgParser extends Main {
                        } 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("-source")) {
                                if (args.size() > nextArgIndex) {
                                        String level = ((ConfigParser.Arg) 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("7") || level.equals("8") || level.equals("1.8")) {
                                                buildConfig.setBehaveInJava5Way(true);
                                        }
                                        unparsedArgs.add("-source");
diff --git a/tests/bugs180/415957/MyAspect.aj b/tests/bugs180/415957/MyAspect.aj
new file mode 100644 (file)
index 0000000..673463a
--- /dev/null
@@ -0,0 +1,8 @@
+public aspect MyAspect {
+    pointcut all(): execution(@javax.annotation.Resource * *(..));
+
+
+    before(): all() {
+        System.out.println("Hi");
+    }
+}
diff --git a/tests/bugs180/415957/MyClass.java b/tests/bugs180/415957/MyClass.java
new file mode 100644 (file)
index 0000000..7b596ff
--- /dev/null
@@ -0,0 +1,5 @@
+public class MyClass {
+    @javax.annotation.Resource
+    public void method() {
+    }
+}
index fbdbd29d9d532b4f46de2709971c2454eaadbecf..dfa920e524d02acebc83dbacbbc49aceaf4dfde1 100644 (file)
@@ -21,6 +21,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
  */
 public class Ajc180Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        
+       public void testAnnosWith18Flags_415957() {
+               runTest("annotations with 1.8 flags");
+       }
+       
        public void testJava8Code() throws Exception {
                runTest("first advised java 8 code");
        }
index 9e651d3470c89348f0d0d8973110d88a0b9b2e31..8ea55c136c6342695174182a68366d38b2548819 100644 (file)
@@ -2,6 +2,12 @@
 
 <suite>
 
+       <ajc-test dir="bugs180/415957" title="annotations with 1.8 flags">
+               <compile files="MyAspect.aj MyClass.java" options="-1.8 -showWeaveInfo">
+                       <message kind="weave" text="Join point 'method-execution(void MyClass.method())' in Type 'MyClass' (MyClass.java:3) advised by before advice from 'MyAspect' (MyAspect.aj:5)"/>
+               </compile>
+       </ajc-test>
+
        <ajc-test dir="bugs180/firstprogram" title="first advised java 8 code">
                <compile files="C.java" options="-1.8">
                </compile>