for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
SourceTypeBinding[] b = units[i].scope.topLevelTypes;
for (int j = 0; j < b.length; j++) {
- factory.addSourceTypeBinding(b[j]);
+ factory.addSourceTypeBinding(b[j],units[i]);
}
}
* @param aBinding
*/
public void anonymousTypeBindingCreated(LocalTypeBinding aBinding) {
- factory.addSourceTypeBinding(aBinding);
+ factory.addSourceTypeBinding(aBinding,null);
}
}
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
return EclipseShadow.makeShadow(this, (ASTNode) context, context);
}
- public void addSourceTypeBinding(SourceTypeBinding binding) {
+ public void addSourceTypeBinding(SourceTypeBinding binding, CompilationUnitDeclaration unit) {
TypeDeclaration decl = binding.scope.referenceContext;
// Deal with the raw/basic type to give us an entry in the world type map
simpleTx = UnresolvedType.forName(getName(binding));
}
ReferenceType name = getWorld().lookupOrCreateName(simpleTx);
- EclipseSourceType t = new EclipseSourceType(name, this, binding, decl);
+ EclipseSourceType t = new EclipseSourceType(name, this, binding, decl, unit);
// For generics, go a bit further - build a typex for the generic type
// give it the same delegate and link it to the raw type
ReferenceBinding[] memberTypes = binding.memberTypes;
for (int i = 0, length = memberTypes.length; i < length; i++) {
- addSourceTypeBinding((SourceTypeBinding) memberTypes[i]);
+ addSourceTypeBinding((SourceTypeBinding) memberTypes[i], unit);
}
}
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteral;
private SourceTypeBinding binding;
private TypeDeclaration declaration;
+ private CompilationUnitDeclaration unit;
private boolean annotationsResolved = false;
private ResolvedType[] resolvedAnnotations = null;
}
public EclipseSourceType(ReferenceType resolvedTypeX, EclipseFactory factory,
- SourceTypeBinding binding, TypeDeclaration declaration)
+ SourceTypeBinding binding, TypeDeclaration declaration,
+ CompilationUnitDeclaration unit)
{
super(resolvedTypeX, true);
this.factory = factory;
this.binding = binding;
this.declaration = declaration;
+ this.unit = unit;
resolvedTypeX.setSourceContext(new EclipseSourceContext(declaration.compilationResult));
resolvedTypeX.setStartPos(declaration.sourceStart);
declaredPointcuts.add(df);
} else {
if (amd.binding == null || !amd.binding.isValidBinding()) continue;
- declaredMethods.add(factory.makeResolvedMember(amd.binding));
+ ResolvedMember member = factory.makeResolvedMember(amd.binding);
+ if (unit != null) {
+ member.setSourceContext(new EclipseSourceContext(unit.compilationResult,amd.binding.sourceStart()));
+ member.setPosition(amd.binding.sourceStart(),amd.binding.sourceEnd());
+ }
+ declaredMethods.add(member);
}
}
}
</compile>
<compile files="FinalITDMOnInterface2.aj">
<message kind="error" line="8" text="Cannot override the final method from A.TestInterface"></message>
+ <message kind="error" line="8" text="can't override final void A$TestInterface.m()"></message>
</compile>
</ajc-test>
keywords="from-design">
<compile files="MultiInheritCF.java">
<message kind="error" line="0"/>
+ <message kind="error" line="17"/>
+ <message kind="error" line="18"/>
<message kind="error" line="21"/>
<message kind="error" line="41"/>
<message kind="error" line="42"/>
parameterizedParameterTypes[i] =
parameterize(getGenericParameterTypes()[i], typeMap,isParameterized);
}
- return new ResolvedMemberImpl(
+ ResolvedMemberImpl ret = new ResolvedMemberImpl(
getKind(),
newDeclaringType,
getModifiers(),
getExceptions(),
this
);
+ ret.setSourceContext(getSourceContext());
+ return ret;
}
public boolean checkLegalOverride(ResolvedMember parent, ResolvedMember child) {
//System.err.println("check: " + child.getDeclaringType() + " overrides " + parent.getDeclaringType());
if (Modifier.isFinal(parent.getModifiers())) {
- // XXX horrible test, if we're in eclipes, child.getSourceLocation will be
- // null, and this message will have already been issued.
- if (child.getSourceLocation() == null) return false;
world.showMessage(Message.ERROR,
WeaverMessages.format(WeaverMessages.CANT_OVERRIDE_FINAL_MEMBER,parent),
child.getSourceLocation(),null);