use of org.eclipse.ceylon.model.loader.model.JavaMethod in project ceylon by eclipse.
the class AbstractModelLoader method completeActual.
@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 (!ModelUtil.isCeylonDeclaration((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), klass.isVariadic());
decl.setRefinedDeclaration(refined);
}
} else {
// Function 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), decl.isVariadic());
decl.setRefinedDeclaration(refined);
}
} else {
if (isOverridingMethod(methodMirror)) {
Declaration refined = klass.getRefinedMember(decl.getName(), getSignature(decl), decl.isVariadic());
if (refined instanceof FieldValue == false) {
decl.setActual(true);
decl.setRefinedDeclaration(refined);
}
}
}
// for Ceylon methods
if (decl instanceof JavaMethod && ModelUtil.isCeylonDeclaration(klass)) {
if (!methodMirror.getTypeParameters().isEmpty() && // lazy loading just to check.
JvmBackendUtil.supportsReified(decl)) {
checkReifiedTypeDescriptors(methodMirror.getTypeParameters().size(), container.getQualifiedNameString(), methodMirror, false);
}
}
}
}
completeVariable(decl);
}
Aggregations