]> source.dussan.org Git - aspectj.git/commitdiff
Fix 431976: invalid unused warnings on tejpsp
authorAndy Clement <aclement@gopivotal.com>
Wed, 11 Jun 2014 14:43:00 +0000 (07:43 -0700)
committerAndy Clement <aclement@gopivotal.com>
Wed, 11 Jun 2014 14:43:00 +0000 (07:43 -0700)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
tests/bugs181/431976/Code.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java
tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java
tests/src/org/aspectj/systemtest/ajc181/ajc181.xml

index 81741a8f8a6f85bc9da54a7d0e3a4b2dd0d551ac..f795d617e17fbc037cef435b6ef994f074a3679a 100644 (file)
@@ -508,15 +508,20 @@ public class AjProblemReporter extends ProblemReporter {
                }
                super.unusedPrivateType(typeDecl);
        }
+       
        private final static char[] thisJoinPointName = "thisJoinPoint".toCharArray();
+       private final static char[] thisJoinPointStaticPartName = "thisJoinPointStaticPart".toCharArray();
+       private final static char[] thisEnclosingJoinPointStaticPartName = "thisEnclosingJoinPointStaticPart".toCharArray();
        
        public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location) {
-               if (CharOperation.equals(binding.name,thisJoinPointName)) {
+               if (CharOperation.equals(binding.name, thisJoinPointName) ||
+                       CharOperation.equals(binding.name, thisJoinPointStaticPartName) ||
+                       CharOperation.equals(binding.name, thisEnclosingJoinPointStaticPartName)) {
                        // If in advice, this is not a problem
                        if (binding.declaringScope!=null && binding.declaringScope.referenceContext() instanceof AdviceDeclaration) {
                                return;
                        }
-               }
+               }                       
                super.uninitializedLocalVariable(binding, location);
        }
        
diff --git a/tests/bugs181/431976/Code.java b/tests/bugs181/431976/Code.java
new file mode 100644 (file)
index 0000000..c880a93
--- /dev/null
@@ -0,0 +1,15 @@
+import org.aspectj.lang.annotation.SuppressAjWarnings;
+
+privileged aspect BugThisJoinPoint {
+
+       @SuppressAjWarnings("adviceDidNotMatch")
+       void around(): execution(boolean forceFocus ()) {
+               thisEnclosingJoinPointStaticPart.getSignature();
+       }
+
+       @SuppressAjWarnings("adviceDidNotMatch")
+       void around(): execution(boolean forceFocus ()) {
+               thisJoinPointStaticPart.getSignature();
+       }
+}
+
index 81be509a7175ff762a6b275e934860edc1ced99f..6feff4445447e61ec9e176885c5c26cfd4e6c42c 100644 (file)
@@ -21,7 +21,6 @@ public class AllTestsAspectJ180 {
                TestSuite suite = new TestSuite("AspectJ 1.8.0 tests");
                // $JUnit-BEGIN$
                suite.addTest(Ajc180Tests.suite());
-               suite.addTest(Ajc181Tests.suite());
                // $JUnit-END$
                return suite;
        }
index 3fc5e17cd717a67f80d6d0babc4ecd7eb4e8f8a2..2a466af6ac8c8d8e27d0a0f49925debcfece610b 100644 (file)
@@ -22,6 +22,11 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
  */
 public class Ajc181Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
+
+       public void testThisEnclosingJoinPointStaticPartNotInitialized_431976() {
+               runTest("thisEnclosingJoinPointStaticPart not initialized");
+       }
+       
        public void testLvarTable_435446() throws Exception {
                runTest("lvartable");
        }
index fdbe11d21aeafd29508e82158060d669ea8bc487..80bb5d20a60eae0025168a8592b421d88ebd7a40 100644 (file)
@@ -2,6 +2,10 @@
 
 <suite>
 
+       <ajc-test dir="bugs181/431976" title="thisEnclosingJoinPointStaticPart not initialized">
+               <compile options="-1.8" files="Code.java"/>
+       </ajc-test>
+       
        <ajc-test dir="bugs181/435446" title="lvartable">
                <compile options="-1.8" files="Application.java MyAspect.java">
                </compile>