]> source.dussan.org Git - aspectj.git/commitdiff
Fix for Bugzilla Bug 50776
authoraclement <aclement>
Fri, 5 Mar 2004 10:50:50 +0000 (10:50 +0000)
committeraclement <aclement>
Fri, 5 Mar 2004 10:50:50 +0000 (10:50 +0000)
   fail in compiling aspect with overriding method introduction with different throws clause

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java
tests/ajcTests.xml
tests/bugs/IntertypeDifferentThrows.java [new file with mode: 0644]

index eaa81c8da3f79013f3f84d3c64b0afed516d5c85..d6c4d7b64b2c919423c72a1aacf78e7a39982095 100644 (file)
@@ -292,8 +292,8 @@ public class InterTypeMemberFinder implements IMemberFinder {
                TypeBinding[] argumentTypes)
        {
                MethodBinding ret = sourceTypeBinding.getExactMethodBase(selector, argumentTypes);
-               if (ret != null) return ret;
                
+               // An intertype declaration may override an inherited member (Bug#50776)
                for (int i=0, len=interTypeMethods.size(); i < len; i++) {
                        MethodBinding im =
                                (MethodBinding)interTypeMethods.get(i);
@@ -301,7 +301,7 @@ public class InterTypeMemberFinder implements IMemberFinder {
                                return im;
                        }
                }
-               return null;
+               return ret;
        }
 //                             if (isVisible(im, sourceTypeBinding)) {
 //                                     if (ret == null) {
index 35b7d15f990bafb73412c6d74a9148600902ed0b..df4451ee2ce53c2511c2b9e808e4c8676c75854a 100644 (file)
                <message kind="warning" line="21" text="this affected type is not exposed"/>
                </compile>
        </ajc-test>
+       
+       <ajc-test dir="bugs" pr="50776"
+        title="fail in compiling aspect with overriding method introduction with different throws clause ">
+        <compile files="IntertypeDifferentThrows.java" />
+    </ajc-test>
     
 </suite>
diff --git a/tests/bugs/IntertypeDifferentThrows.java b/tests/bugs/IntertypeDifferentThrows.java
new file mode 100644 (file)
index 0000000..4aaaaf6
--- /dev/null
@@ -0,0 +1,17 @@
+class A {
+  public A(){}
+  public void m() throws Exception{}
+}
+
+class B extends A {
+  public B(){}
+  public void some_code(){
+       m();
+  }
+}
+
+// B.m() introduced here does not throw 'Exception' so class B above
+// should compile OK!
+aspect C {
+  public void B.m(){}
+}
\ No newline at end of file