}
private Method addMethod(ClassOrInterface klass, MethodMirror methodMirror, ClassMirror classMirror,
boolean isCeylon, boolean isOverloaded) {
JavaMethod method = new JavaMethod(methodMirror);
String methodName = methodMirror.getName();
method.setContainer(klass);
method.setScope(klass);
method.setRealName(methodName);
method.setUnit(klass.getUnit());
method.setOverloaded(isOverloaded || isOverloadingMethod(methodMirror));
ProducedType type = null;
try{
setMethodOrValueFlags(klass, methodMirror, method, isCeylon);
}catch(ModelResolutionException x){
// collect an error in its type
type = logModelResolutionException(x, klass, "method '"+methodMirror.getName()+"' (checking if it is an overriding method");
}
if(methodName.equals("hash")
|| methodName.equals("string"))
method.setName(methodName+"_method");
else
method.setName(Util.strip(methodName, isCeylon, method.isShared()));
method.setDefaultedAnnotation(methodMirror.isDefault());
// type params first
setTypeParameters(method, methodMirror, isCeylon);
// and its return type
// do not log an additional error if we had one from checking if it was overriding
if(type == null)
type = obtainType(methodMirror.getReturnType(), methodMirror, method, Decl.getModuleContainer(method), VarianceLocation.COVARIANT,
"method '"+methodMirror.getName()+"'", klass);
method.setType(type);
// now its parameters
if(isEqualsMethod(methodMirror))
setEqualsParameters(method, methodMirror);
else
setParameters(method, methodMirror, isCeylon, klass);
method.setUncheckedNullType((!isCeylon && !methodMirror.getReturnType().isPrimitive()) || isUncheckedNull(methodMirror));
type.setRaw(isRaw(Decl.getModuleContainer(klass), methodMirror.getReturnType()));
markDeclaredVoid(method, methodMirror);
markUnboxed(method, methodMirror, methodMirror.getReturnType());
markTypeErased(method, methodMirror, methodMirror.getReturnType());
markUntrustedType(method, methodMirror, methodMirror.getReturnType());