From c79892369fa4225ee5eb71b42c96e289f2eb4fc9 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 5 Mar 2004 10:50:50 +0000 Subject: [PATCH] Fix for Bugzilla Bug 50776 fail in compiling aspect with overriding method introduction with different throws clause --- .../compiler/lookup/InterTypeMemberFinder.java | 4 ++-- tests/ajcTests.xml | 5 +++++ tests/bugs/IntertypeDifferentThrows.java | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/IntertypeDifferentThrows.java diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java index eaa81c8da..d6c4d7b64 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java @@ -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) { diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 35b7d15f9..df4451ee2 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -7262,5 +7262,10 @@ + + + + diff --git a/tests/bugs/IntertypeDifferentThrows.java b/tests/bugs/IntertypeDifferentThrows.java new file mode 100644 index 000000000..4aaaaf661 --- /dev/null +++ b/tests/bugs/IntertypeDifferentThrows.java @@ -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 -- 2.39.5