From a4bd19d25597a31e1b76cc5fc188c3112bf0f5ff Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 24 Jan 2006 16:47:42 +0000 Subject: [PATCH] test and fix for 124999 --- .../compiler/ast/AccessForInlineVisitor.java | 7 ++++- tests/bugs151/pr124999.aj | 27 +++++++++++++++++++ .../systemtest/ajc151/Ajc151Tests.java | 1 + .../org/aspectj/systemtest/ajc151/ajc151.xml | 5 ++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/bugs151/pr124999.aj diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java index 1a310d980..657b3b520 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java @@ -40,6 +40,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedMethodBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.VariableBinding; @@ -169,7 +170,11 @@ public class AccessForInlineVisitor extends ASTVisitor { makePublic(receiverType); //??? if (isPublic(binding)) return binding; if (binding instanceof InterTypeMethodBinding) return binding; - + + if (binding instanceof ParameterizedMethodBinding) { // pr124999 + binding = binding.original(); + } + ResolvedMember m = null; if (binding.isPrivate() && binding.declaringClass != inAspect.binding) { // does this always mean that the aspect is an inner aspect of the bindings diff --git a/tests/bugs151/pr124999.aj b/tests/bugs151/pr124999.aj new file mode 100644 index 000000000..42ae02f15 --- /dev/null +++ b/tests/bugs151/pr124999.aj @@ -0,0 +1,27 @@ +abstract aspect GenericInheritedMethod { + + protected T getSomething() { + return null; + } + +} + + +aspect pr124999 extends GenericInheritedMethod { + + // Runtime Error + void around() : execution(void someMethod()) { + System.out.println(getSomething()); + } + + public static void main(String[] args) { + new C().someMethod(); + } + + +} + + +class C { + public void someMethod() { } +} diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java index a163d396f..6e872e4e0 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java @@ -26,6 +26,7 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testDifferentNumbersofTVars_pr124803_2() { runTest("generics and different numbers of type variables - classes");} public void testParameterizedCollectionFieldMatching_pr124808() { runTest("parameterized collection fields matched via pointcut");} public void testGenericAspectsAndAnnotations_pr124654() { runTest("generic aspects and annotations");} + public void testCallInheritedGenericMethod_pr124999() { runTest("calling inherited generic method from around advice");} ///////////////////////////////////////// public static Test suite() { diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml index c04af9174..74dfa3e5b 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml +++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml @@ -54,6 +54,11 @@ + + + + + -- 2.39.5