diff options
author | Andy Clement <aclement@gopivotal.com> | 2014-06-11 07:43:00 -0700 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2014-06-11 07:43:00 -0700 |
commit | 4f89239adb00058765f874be1e0800c5d40fa81c (patch) | |
tree | 8d0cde54f2e04f25f8d8277409597f7c534e5b31 | |
parent | 6e5c19b7529d637084564d155d1515f6c4058e05 (diff) | |
download | aspectj-4f89239adb00058765f874be1e0800c5d40fa81c.tar.gz aspectj-4f89239adb00058765f874be1e0800c5d40fa81c.zip |
Fix 431976: invalid unused warnings on tejpsp
5 files changed, 31 insertions, 3 deletions
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 @@ <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> |