Removed redundant checking for test mode. Exceptions will be thrown anyway.

This commit is contained in:
Evgeny Gerashchenko
2013-03-27 17:20:29 +04:00
parent 3917f11b12
commit d8ccfe55b6
3 changed files with 10 additions and 26 deletions
@@ -17,7 +17,6 @@
package org.jetbrains.jet.lang.resolve.java.kotlinSignature; package org.jetbrains.jet.lang.resolve.java.kotlinSignature;
import com.google.common.collect.*; import com.google.common.collect.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.SystemInfo;
@@ -655,16 +654,11 @@ public class SignaturesPropagationData {
private static void reportCantFindSuperFunction(PsiMethodWrapper method) { private static void reportCantFindSuperFunction(PsiMethodWrapper method) {
String errorMessage = "Can't find super function for " + method.getPsiMethod() + String errorMessage = "Can't find super function for " + method.getPsiMethod() +
" defined in " + method.getPsiMethod().getContainingClass(); " defined in " + method.getPsiMethod().getContainingClass();
if (ApplicationManager.getApplication().isUnitTestMode()) { if (SystemInfo.isMac) {
throw new IllegalStateException(errorMessage); LOG.error("Remove duplicates from your JDK definition\n" + errorMessage);
} }
else { else {
if (SystemInfo.isMac) { LOG.error(errorMessage);
LOG.error("Remove duplicates from your JDK definition\n" + errorMessage);
}
else {
LOG.error(errorMessage);
}
} }
} }
@@ -243,20 +243,13 @@ public final class JavaFunctionResolver {
boolean returnTypeOk = boolean returnTypeOk =
isReturnTypeOkForOverride(JetTypeChecker.INSTANCE, superFunctionSubstituted, functionDescriptor); isReturnTypeOkForOverride(JetTypeChecker.INSTANCE, superFunctionSubstituted, functionDescriptor);
if (!paramsOk || !returnTypeOk) { if (!paramsOk || !returnTypeOk) {
String errorMessage = "Loaded Java method overrides another, but resolved as Kotlin function, doesn't.\n" LOG.error("Loaded Java method overrides another, but resolved as Kotlin function, doesn't.\n"
+ "super function = " + superFunction + "\n" + "super function = " + superFunction + "\n"
+ "super class = " + superFunction.getContainingDeclaration() + "\n" + "super class = " + superFunction.getContainingDeclaration() + "\n"
+ "sub function = " + functionDescriptor + "\n" + "sub function = " + functionDescriptor + "\n"
+ "sub class = " + functionDescriptor.getContainingDeclaration() + "\n" + "sub class = " + functionDescriptor.getContainingDeclaration() + "\n"
+ "sub method = " + PsiFormatUtil.getExternalName(method.getPsiMethod()) + "\n" + "sub method = " + PsiFormatUtil.getExternalName(method.getPsiMethod()) + "\n"
+ "@KotlinSignature = " + method.getSignatureAnnotation().signature(); + "@KotlinSignature = " + method.getSignatureAnnotation().signature());
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw new IllegalStateException(errorMessage);
}
else {
LOG.error(errorMessage);
}
} }
} }
} }
@@ -134,9 +134,6 @@ public class JetPsiChecker implements Annotator {
// For failing tests and to notify about idea internal error in -ea mode // For failing tests and to notify about idea internal error in -ea mode
holder.createErrorAnnotation(element, e.getClass().getCanonicalName() + ": " + e.getMessage()); holder.createErrorAnnotation(element, e.getClass().getCanonicalName() + ": " + e.getMessage());
LOG.error(e); LOG.error(e);
if (ApplicationManager.getApplication().isUnitTestMode()) {
throw ExceptionUtils.rethrow(e);
}
} }
} }
} }