]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 124999
authoraclement <aclement>
Tue, 24 Jan 2006 16:47:42 +0000 (16:47 +0000)
committeraclement <aclement>
Tue, 24 Jan 2006 16:47:42 +0000 (16:47 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
tests/bugs151/pr124999.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml

index 1a310d980f51323997887873a059dc9d07e33f1d..657b3b52098b7d3f248e816c24499cfad33bf396 100644 (file)
@@ -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 (file)
index 0000000..42ae02f
--- /dev/null
@@ -0,0 +1,27 @@
+abstract aspect GenericInheritedMethod<T> {
+
+   protected  T getSomething() {
+       return null;
+   }
+
+}
+
+
+aspect pr124999 extends GenericInheritedMethod<Integer> {
+
+   // 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() { }
+}
index a163d396f5b5db3658a40858678e3cae554d3172..6e872e4e0a83ae4d30755617464999dc66b489a5 100644 (file)
@@ -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() {
index c04af91749aa093563295f73878a83adf56dfb39..74dfa3e5bd7044cc2233e51baa954186478d5862 100644 (file)
         </run>
     </ajc-test>
     
+    <ajc-test dir="bugs151" title="calling inherited generic method from around advice">
+        <compile files="pr124999.aj" options="-1.5"/>
+        <run class="pr124999"/>
+    </ajc-test>
+    
     <ajc-test dir="bugs151/pr124654" title="generic aspects and annotations">
         <compile files="GenericAnnotation.java,TestSubAspect.java" options="-1.5"/>
         <run class="TestSubAspect">