Minor. Simplified code.

This commit is contained in:
Evgeny Gerashchenko
2013-01-31 17:19:33 +04:00
parent 2e64aac788
commit 0f401d4c9d
@@ -216,24 +216,13 @@ public class SignaturesPropagationData {
PsiElement superDeclaration = superMethod instanceof JetClsMethod ? ((JetClsMethod) superMethod).getOrigin() : superMethod;
DeclarationDescriptor superFun = trace.get(BindingContext.DECLARATION_TO_DESCRIPTOR, superDeclaration);
if (superFun instanceof FunctionDescriptor) {
superFunctions.add(((FunctionDescriptor) superFun));
}
else {
String errorMessage = "Can't find super function for " + method.getPsiMethod() +
" defined in " + method.getPsiMethod().getContainingClass();
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new IllegalStateException(errorMessage);
}
else {
if (SystemInfo.isMac) {
LOG.error("Remove duplicates from your JDK definition\n" + errorMessage);
}
else {
LOG.error(errorMessage);
}
}
if (superFun == null) {
reportCantFindSuperFunction(method);
continue;
}
assert superFun instanceof FunctionDescriptor : superFun.getClass().getName();
superFunctions.add((FunctionDescriptor) superFun);
}
// sorting for diagnostic stability
@@ -576,6 +565,22 @@ public class SignaturesPropagationData {
return builtIns.isArray(type) || builtIns.isPrimitiveArray(type);
}
private static void reportCantFindSuperFunction(PsiMethodWrapper method) {
String errorMessage = "Can't find super function for " + method.getPsiMethod() +
" defined in " + method.getPsiMethod().getContainingClass();
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new IllegalStateException(errorMessage);
}
else {
if (SystemInfo.isMac) {
LOG.error("Remove duplicates from your JDK definition\n" + errorMessage);
}
else {
LOG.error(errorMessage);
}
}
}
private static class VarargCheckResult {
public final JetType parameterType;
public final boolean isVararg;