From 4f89239adb00058765f874be1e0800c5d40fa81c Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Wed, 11 Jun 2014 07:43:00 -0700 Subject: [PATCH] Fix 431976: invalid unused warnings on tejpsp --- .../compiler/problem/AjProblemReporter.java | 9 +++++++-- tests/bugs181/431976/Code.java | 15 +++++++++++++++ .../systemtest/ajc180/AllTestsAspectJ180.java | 1 - .../aspectj/systemtest/ajc181/Ajc181Tests.java | 5 +++++ .../src/org/aspectj/systemtest/ajc181/ajc181.xml | 4 ++++ 5 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 tests/bugs181/431976/Code.java diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java index 81741a8f8..f795d617e 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java @@ -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 index 000000000..c880a937e --- /dev/null +++ b/tests/bugs181/431976/Code.java @@ -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(); + } +} + diff --git a/tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java b/tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java index 81be509a7..6feff4445 100644 --- a/tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java +++ b/tests/src/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java @@ -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; } diff --git a/tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java b/tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java index 3fc5e17cd..2a466af6a 100644 --- a/tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java @@ -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"); } diff --git a/tests/src/org/aspectj/systemtest/ajc181/ajc181.xml b/tests/src/org/aspectj/systemtest/ajc181/ajc181.xml index fdbe11d21..80bb5d20a 100644 --- a/tests/src/org/aspectj/systemtest/ajc181/ajc181.xml +++ b/tests/src/org/aspectj/systemtest/ajc181/ajc181.xml @@ -2,6 +2,10 @@ + + + + -- 2.39.5