Browse Source

tests and fix for pr105479, declare parents introducing method override with covariance

tags/preDefaultReweavable
acolyer 19 years ago
parent
commit
a0ab747e10

+ 13
- 0
tests/bugs150/pr105479.aj View File

@@ -0,0 +1,13 @@
public aspect pr105479 {
private interface Test {
Object getId();
}
class StringTest {
public String getId() {
return null;
}
}
declare parents : StringTest implements Test;
}

+ 4
- 0
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java View 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) {

+ 4
- 1
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml View File

@@ -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>
<!-- ============================================================================ -->
<!-- ============================================================================ -->

+ 1
- 1
weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java View 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(),

Loading…
Cancel
Save