From 0f401d4c9d14be11824074451cac42b800d48b46 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Thu, 31 Jan 2013 17:19:33 +0400 Subject: [PATCH] Minor. Simplified code. --- .../SignaturesPropagationData.java | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java index a84e608bd49..0c1889afece 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kotlinSignature/SignaturesPropagationData.java @@ -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;