@@ -0,0 +1,13 @@ | |||
public aspect pr105479 { | |||
private interface Test { | |||
Object getId(); | |||
} | |||
class StringTest { | |||
public String getId() { | |||
return null; | |||
} | |||
} | |||
declare parents : StringTest implements Test; | |||
} |
@@ -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) { |
@@ -381,7 +381,10 @@ | |||
<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> | |||
<!-- ============================================================================ --> | |||
<!-- ============================================================================ --> | |||
@@ -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(), |