]> source.dussan.org Git - aspectj.git/commitdiff
Some more fix for Bugzilla Bug 60015
authoraclement <aclement>
Tue, 3 Aug 2004 14:53:38 +0000 (14:53 +0000)
committeraclement <aclement>
Tue, 3 Aug 2004 14:53:38 +0000 (14:53 +0000)
   NPE, Incorrect XLint:unmatchedSuperTypeInCall warning

tests/ajcTests.xml
tests/bugs/IncorrectXlintOnInterface.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java

index e7031e59c2d2189965008be6a84377e93603c225..0a561326654ac982bdf812ec8b50e699162599dd 100644 (file)
           <message kind="warning" line="11" text="In String ctor"/>
         </compile>
     </ajc-test>
+    
+    <ajc-test dir="bugs" pr="60015"
+      title="NPE, Incorrect XLint:unmatchedSuperTypeInCall warning">
+      <compile files="IncorrectXlintOnInterface.java">
+      </compile>
+    </ajc-test>
 </suite>
diff --git a/tests/bugs/IncorrectXlintOnInterface.java b/tests/bugs/IncorrectXlintOnInterface.java
new file mode 100644 (file)
index 0000000..5ab34a7
--- /dev/null
@@ -0,0 +1,29 @@
+interface ILib { void run(); }
+
+class UnmatchedCallSupertype implements ILib {
+       public static void main(String[] args) {
+               new UnmatchedCallSupertype().run();
+       }
+       public void run() {
+                 System.err.println(this.toString());
+                 System.err.println(this.toString());
+                 System.err.println(this.toString());
+                 System.err.println(this.toString());
+               }
+}
+
+aspect X {
+
+       pointcut runCall() : call(* ILib.*(..));
+       pointcut monitor() : call(String clone(String)) || runCall();
+
+       before() : monitor() {
+               System.err.println(thisJoinPointStaticPart.getSignature().getDeclaringType().getName());
+       }
+}
+
+class Client {
+       public static void main(String[] args) { new Lib().run(); }
+       static class Lib implements ILib { public void run() {} }
+}
+
index 6154f07d883a604677dbb414bc9b4195eec598a0..4dda76c4720c58116cd28c7e332f468e5b4024e5 100644 (file)
@@ -114,6 +114,11 @@ public class KindedPointcut extends Pointcut {
                                exactDeclaringType.resolve(world))) {
                        return;
                }
+               
+               // PR60015 - Don't report the warning if the declaring type is object and 'this' is an interface
+               if (exactDeclaringType.isInterface(world) && shadowDeclaringType.equals(world.resolve("java.lang.Object"))) {
+                       return;
+               }
 
                SignaturePattern nonConfusingPattern =
                        new SignaturePattern(