]> source.dussan.org Git - aspectj.git/commitdiff
tests and fix for pr105479, declare parents introducing method override with covariance
authoracolyer <acolyer>
Wed, 31 Aug 2005 14:11:45 +0000 (14:11 +0000)
committeracolyer <acolyer>
Wed, 31 Aug 2005 14:11:45 +0000 (14:11 +0000)
tests/bugs150/pr105479.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java

diff --git a/tests/bugs150/pr105479.aj b/tests/bugs150/pr105479.aj
new file mode 100644 (file)
index 0000000..75e676a
--- /dev/null
@@ -0,0 +1,13 @@
+public aspect pr105479 {
+  private interface Test {
+    Object getId();
+  }
+  class StringTest {
+    public String getId() {
+      return null;
+    }
+  }
+  declare parents : StringTest implements Test;
+}
\ No newline at end of file
index 5aa1df6cf5fb0f8b4fff442f66f89d0826dd25c4..d19ff4146bcced154cde059dc87c0ddae2930997 100644 (file)
@@ -322,6 +322,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("inner type of generic interface reference from parameterized type");
   }
   
+  public void testDeclareParentsIntroducingCovariantReturnType() {
+         runTest("declare parents introducing override with covariance");
+  }
+  
   // helper methods.....
   
   public SyntheticRepository createRepos(File cpentry) {
index ccd93100f300030ef7baa010e253e8d80d99e562..cd05ccac50eb645c4c4882935f37ca666574ad00 100644 (file)
     <ajc-test dir="bugs150" pr="95992" title="inner type of generic interface reference from parameterized type">
         <compile files="pr95992.aj" options="-1.5"/>
     </ajc-test>
-                   
+
+    <ajc-test dir="bugs150" pr="105479" title="declare parents introducing override with covariance">
+        <compile files="pr105479.aj" options="-1.5"/>
+    </ajc-test>                   
     <!-- ============================================================================ -->
     <!-- ============================================================================ -->
     
index 47d0b82ab9287e7290b7cd7fe636c05654e1cbe5..b3b05c2b1c31212c9ba8baaf084905d1e9523f1c 100644 (file)
@@ -308,7 +308,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
             // Allow for covariance - wish I could test this (need Java5...)
             ResolvedType subType   = weaver.getWorld().resolve(subMethod.getReturnType());
             ResolvedType superType = weaver.getWorld().resolve(superMethod.getReturnType());
-            if (!subType.isAssignableFrom(superType)) {
+            if (!superType.isAssignableFrom(subType)) {
                 ISourceLocation sloc = subMethod.getSourceLocation();
                 weaver.getWorld().getMessageHandler().handleMessage(MessageUtil.error(
                         "The return type is incompatible with "+superMethod.getDeclaringType()+"."+superMethod.getName()+superMethod.getParameterSignature(),