decl.setActualCompleter(this);
}
@Override
public void completeActual(Declaration decl){
Scope container = decl.getContainer();
if(container instanceof ClassOrInterface){
ClassOrInterface klass = (ClassOrInterface) container;
decl.setRefinedDeclaration(decl);
// we never consider Interface and other stuff, since we never register the actualCompleter for them
if(decl instanceof Class){
// Java member classes are never actual
if(!Decl.isCeylon((Class)decl))
return;
// we already set the actual bit for member classes, we just need the refined decl
if(decl.isActual()){
Declaration refined = klass.getRefinedMember(decl.getName(), getSignature(decl), false);
decl.setRefinedDeclaration(refined);
}
}else{ // Method or Value
MethodMirror methodMirror;
if(decl instanceof JavaBeanValue)
methodMirror = ((JavaBeanValue) decl).mirror;
else if(decl instanceof JavaMethod)
methodMirror = ((JavaMethod) decl).mirror;
else
throw new ModelResolutionException("Unknown type of declaration: "+decl+": "+decl.getClass().getName());
decl.setRefinedDeclaration(decl);
// For Ceylon interfaces we rely on annotation
if(klass instanceof LazyInterface
&& ((LazyInterface)klass).isCeylon()){
boolean actual = methodMirror.getAnnotation(CEYLON_LANGUAGE_ACTUAL_ANNOTATION) != null;
decl.setActual(actual);
if(actual){
Declaration refined = klass.getRefinedMember(decl.getName(), getSignature(decl), false);
decl.setRefinedDeclaration(refined);
}
}else{
if(isOverridingMethod(methodMirror)){
decl.setActual(true);
Declaration refined = klass.getRefinedMember(decl.getName(), getSignature(decl), false);
decl.setRefinedDeclaration(refined);
}
}
// now that we know the refined declaration, we can check for reified type param support
// for Ceylon methods
if(decl instanceof JavaMethod && Decl.isCeylon(klass)){
if(!methodMirror.getTypeParameters().isEmpty()
// because this requires the refined decl, we defer this check until we've set it, to not trigger
// lazy loading just to check.
&& AbstractTransformer.supportsReified(decl)){
checkReifiedTypeDescriptors(methodMirror.getTypeParameters().size(),
container.getQualifiedNameString(), methodMirror, false);
}
}
}
}
}