]> source.dussan.org Git - aspectj.git/commitdiff
fix and test Bugzilla Bug 37739
authorjhugunin <jhugunin>
Mon, 19 May 2003 18:06:04 +0000 (18:06 +0000)
committerjhugunin <jhugunin>
Mon, 19 May 2003 18:06:04 +0000 (18:06 +0000)
   Unexpected Xlint:unresolvableMember warning with withincode

tests/ajcTests.xml
tests/bugs/CatchSig.java [new file with mode: 0644]
tests/jimTests.xml
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java

index 82a150dfe3009590a0418c9d00008ee0bfcfb3bf..c5ebe25756a6dda85105bf75232b3e01a312e49e 100644 (file)
             <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 (file)
index 0000000..81d9604
--- /dev/null
@@ -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()");
+       }
+}
index 80a883ac870f8ded053ef659e4f54e47e43b45ad..5ec4f5a2f17f1b97f1bccf003dc5609c33081f4a 100644 (file)
@@ -1,4 +1,6 @@
 <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
 <suite> 
 
+
+
 </suite>
\ No newline at end of file
index c91731e0e7dd445fc81d441e5a5579cc82d61cac..058231bab4c6ec1511c1dfc213643486984fccc7 100644 (file)
@@ -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();
        }