From 07c2189bdb6d133886056ea1c02a302975f1e724 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 8 Aug 2006 15:37:36 +0000 Subject: [PATCH] test and fix for pr148219 --- .../internal/compiler/problem/AjProblemReporter.java | 10 ++++++++++ tests/bugs153/PR148219/MyMessages.java | 8 ++++++++ .../src/org/aspectj/systemtest/ajc153/Ajc153Tests.java | 1 + tests/src/org/aspectj/systemtest/ajc153/ajc153.xml | 4 ++++ 4 files changed, 23 insertions(+) create mode 100644 tests/bugs153/PR148219/MyMessages.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 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 @@ + + + + -- 2.39.5