aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2004-03-05 10:50:50 +0000
committeraclement <aclement>2004-03-05 10:50:50 +0000
commitc79892369fa4225ee5eb71b42c96e289f2eb4fc9 (patch)
tree9d76e6caf15e5df9fdef0eab99971c8b656285db
parent4b9195763cb06c5c3d0ce2a25f8e5b9f98446dc0 (diff)
downloadaspectj-c79892369fa4225ee5eb71b42c96e289f2eb4fc9.tar.gz
aspectj-c79892369fa4225ee5eb71b42c96e289f2eb4fc9.zip
Fix for Bugzilla Bug 50776
fail in compiling aspect with overriding method introduction with different throws clause
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java4
-rw-r--r--tests/ajcTests.xml5
-rw-r--r--tests/bugs/IntertypeDifferentThrows.java17
3 files changed, 24 insertions, 2 deletions
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 @@
<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
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