@@ -103,12 +103,21 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { | |||
if (((declaredModifiers & AccAbstract) != 0)) | |||
scope.problemReporter().methodNeedingNoBody(this); | |||
} | |||
// XXX AMC we need to do this, but I'm not 100% comfortable as I don't | |||
// know why the return type is wrong in this case. Also, we don't seem to need | |||
// to do it for args... | |||
if (munger.getSignature().getReturnType().isRawType()) { | |||
if (!binding.returnType.isRawType()) { | |||
EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(scope); | |||
binding.returnType = world.makeTypeBinding(munger.getSignature().getReturnType()); | |||
} | |||
} | |||
// check @Override annotation - based on MethodDeclaration.resolveStatements() @Override processing | |||
checkOverride: { | |||
if (this.binding == null) break checkOverride; | |||
if (this.scope.compilerOptions().sourceLevel < JDK1_5) break checkOverride; | |||
int bindingModifiers = this.binding.modifiers; | |||
boolean hasOverrideAnnotation = (this.binding.tagBits & TagBits.AnnotationOverride) != 0; | |||
// Need to verify |
@@ -0,0 +1,12 @@ | |||
import java.util.*; | |||
abstract aspect ObserverProtocol { | |||
private Collection Subject.observers = new ArrayList(); | |||
public Collection Subject.getObservers() { | |||
return observers; | |||
} | |||
} | |||
aspect XYZ extends ObserverProtocol {} |
@@ -0,0 +1,5 @@ | |||
//Observer.java | |||
interface Observer | |||
{ | |||
public void update(); | |||
} |
@@ -0,0 +1,48 @@ | |||
import java.util.*; | |||
//ObserverProtocol | |||
public abstract aspect ObserverProtocol{ | |||
abstract pointcut stateChange(Subject subject); | |||
after(Subject subject):stateChange(subject){ | |||
Iterator it=subject.getObservers().iterator(); | |||
while(it.hasNext()){ | |||
Observer observer=(Observer)it.next(); | |||
observer.update(); | |||
} | |||
} | |||
private Collection Subject.observers=new ArrayList(); | |||
public void Subject.addObserver(Observer observer){ | |||
observers.add(observer); | |||
} | |||
public void Subject.removeObserver(Observer observer){ | |||
observers.remove(observer); | |||
} | |||
public Collection Subject.getObservers() | |||
{ | |||
return observers; | |||
} | |||
public void Subject.setObservers(Collection c) { | |||
observers = c; | |||
} | |||
private Collection myCollection = new ArrayList(); | |||
public Collection returnsCollectionMethod() { return myCollection; } | |||
public Collection C1.getCollection() { | |||
return aCollection; | |||
} | |||
public void C1.setCollection(Collection c) { | |||
aCollection = c; | |||
} | |||
} | |||
class C1 { | |||
public Collection aCollection; | |||
} |
@@ -0,0 +1,7 @@ | |||
import java.util.*; | |||
//Subject.java | |||
interface Subject { | |||
public void addObserver(Observer observer); | |||
public void removeObserver(Observer observer); | |||
public Collection getObservers(); | |||
} |
@@ -0,0 +1,17 @@ | |||
abstract class Order { | |||
public void print() { } | |||
} | |||
// | |||
class SalesOrder { | |||
} | |||
// | |||
abstract aspect OrderDecorator | |||
{ | |||
declare parents : SalesOrder extends Order; | |||
public void SalesOrder.print() | |||
{ | |||
super.print(); // Line 12 | |||
} | |||
protected pointcut print(Order order) : target(order) && call(public void print()); | |||
} |
@@ -398,6 +398,13 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
runTest("advising cflow advice execution"); | |||
} | |||
public void testNoTypeMismatchOnSameGenericTypes() { | |||
runTest("no type mismatch on generic types in itds"); | |||
} | |||
public void testSuperCallInITD() { | |||
runTest("super call in ITD"); | |||
} | |||
// helper methods..... | |||
public SyntheticRepository createRepos(File cpentry) { |
@@ -505,6 +505,17 @@ | |||
<compile files="pr108816.aj" > | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs150/pr108902" pr="108902" title="no type mismatch on generic types in itds"> | |||
<compile files="Subject.java,Observer.java,ObserverProtocol.aj" > | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs150" pr="108903" title="super call in ITD"> | |||
<compile files="pr108903.aj" > | |||
<message kind="error" line="14" text="The method print() is undefined for the type Object"/> | |||
</compile> | |||
</ajc-test> | |||
<!-- ============================================================================ --> | |||
<!-- ============================================================================ --> | |||