diff options
-rw-r--r-- | tests/ajcTests.xml | 7 | ||||
-rw-r--r-- | tests/bugs/CatchSig.java | 51 | ||||
-rw-r--r-- | tests/jimTests.xml | 2 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelShadow.java | 5 |
4 files changed, 64 insertions, 1 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 82a150dfe..c5ebe2575 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6225,5 +6225,12 @@ <message kind="abort" text="Usage"/> </compile> </ajc-test> + + <ajc-test dir="bugs" pr="37739" + title="Unexpected Xlint:unresolvableMember warning with withincode"> + <compile files="CatchSig.java"> + </compile> + <run class="CatchSig"/> + </ajc-test> </suite> diff --git a/tests/bugs/CatchSig.java b/tests/bugs/CatchSig.java new file mode 100644 index 000000000..81d960416 --- /dev/null +++ b/tests/bugs/CatchSig.java @@ -0,0 +1,51 @@ +/* + * Bugzilla Bug 37739 + Unexpected Xlint:unresolvableMember warning with withincode + */ +public class CatchSig { + CatchSig(Class type) {} + + CatchSig() { + this(String.class); + } + + public static void main(String[] args) { + new CatchSig(); + new B().test(); + new B().test2(); + B.findClass(); + } +} + +class B extends CatchSig { + public B() { + super(findClass()); + } + + static Class findClass() { + return B.class; + } + + public void test() { + } + + public void test2() { + test(); + } +} + +aspect C { + void around() : + (call (void B.test()) && + withincode (void B.test2())) { + System.out.println("test from test2"); + proceed(); + } + + before(): call(Class B.findClass()) { + System.out.println("from: " + thisEnclosingJoinPointStaticPart); + } + before(): call(Class B.findClass()) && withincode(B.new()) { + System.out.println("from B.new()"); + } +} diff --git a/tests/jimTests.xml b/tests/jimTests.xml index 80a883ac8..5ec4f5a2f 100644 --- a/tests/jimTests.xml +++ b/tests/jimTests.xml @@ -1,4 +1,6 @@ <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"> <suite> + + </suite>
\ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java index c91731e0e..058231bab 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java @@ -828,9 +828,12 @@ public class BcelShadow extends Shadow { } } + //??? need to better understand all the enclosing variants public Member getEnclosingCodeSignature() { - if (enclosingShadow == null) { + if (getKind().isEnclosingKind()) { return getSignature(); + } else if (enclosingShadow == null) { + return getEnclosingMethod().getMemberView(); } else { return enclosingShadow.getSignature(); } |