aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2006-08-08 15:37:36 +0000
committeraclement <aclement>2006-08-08 15:37:36 +0000
commit07c2189bdb6d133886056ea1c02a302975f1e724 (patch)
tree4cc4f6305ac6257bca51072603aa0a42f8404f98
parent19fb4370af2db817a9baf239dfe7f0e55bc9995e (diff)
downloadaspectj-07c2189bdb6d133886056ea1c02a302975f1e724.tar.gz
aspectj-07c2189bdb6d133886056ea1c02a302975f1e724.zip
test and fix for pr148219
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java10
-rw-r--r--tests/bugs153/PR148219/MyMessages.java8
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc153/ajc153.xml4
4 files changed, 23 insertions, 0 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 9d24fde96..11a1e728d 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
@@ -34,6 +34,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.IProblemFactory;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
@@ -463,6 +464,15 @@ public class AjProblemReporter extends ProblemReporter {
// don't warn if this is an aj synthetic arg
String argType = new String(localDecl.type.resolvedType.signature());
if (argType.startsWith("Lorg/aspectj/runtime/internal")) return;
+
+ // If the unused argument is in a pointcut, don't report the problem (for now... pr148219)
+ if (localDecl!=null && localDecl instanceof Argument) {
+ Argument arg = (Argument)localDecl;
+ if (arg.binding!=null && arg.binding.declaringScope!=null) {
+ ReferenceContext context = arg.binding.declaringScope.referenceContext();
+ if (context!=null && context instanceof PointcutDeclaration) return;
+ }
+ }
super.unusedArgument(localDecl);
}
diff --git a/tests/bugs153/PR148219/MyMessages.java b/tests/bugs153/PR148219/MyMessages.java
new file mode 100644
index 000000000..c359ca0c5
--- /dev/null
+++ b/tests/bugs153/PR148219/MyMessages.java
@@ -0,0 +1,8 @@
+public aspect MyMessages {
+ pointcut getResourceString(String key): args(key, ..) &&
+ call (* *.getResourceString(String, ..));
+
+ String around(String key):getResourceString(key) {
+ return key;
+ }
+} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
index e2e1e2582..a39c20242 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
@@ -27,6 +27,7 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// public void testArgnamesAndJavac_pr148381() { runTest("argNames and javac");}
// public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); }
// public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");}
+ public void testUnwantedPointcutWarning_pr148219() { runTest("unwanted warning for pointcut");}
public void testDecpAndCflowadderMungerClash_pr152631() { runTest("decp and cflowadder munger clash");}
public void testGenericInheritanceDecp_pr150095() { runTest("generics, inheritance and decp");}
public void testIllegalStateException_pr148737() { runTest("illegalstateexception for non generic type");}
diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
index 5b221f8d9..961c4010d 100644
--- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
+++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
@@ -27,6 +27,10 @@
</run>
</ajc-test>
+ <ajc-test dir="bugs153/pr148219" title="unwanted warning for pointcut">
+ <compile files="MyMessages.java" options="-1.5 -Xlint:ignore -warn:+unusedArgument"/>
+ </ajc-test>
+
<ajc-test dir="bugs153/pr148737" title="illegalstateexception for non generic type">
<compile files="A.java" options="-source 5 -target 5">
<message kind="warning" line="18" text="advice defined in TestAspect has not been applied"/>