From 4afdac3efad6763e71ec935a68e66b91f6c32b16 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 14 Feb 2014 21:59:40 +0400 Subject: [PATCH] Move and rename exception classes in module 'runtime.jvm' --- .../src/org/jetbrains/jet/codegen/ExpressionCodegen.java | 7 ++----- .../NoWhenBranchMatchedException.java} | 4 ++-- .../runtime.jvm/src/{jet => kotlin}/TypeCastException.java | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) rename core/runtime.jvm/src/{jet/NoPatternMatchedException.java => kotlin/NoWhenBranchMatchedException.java} (87%) rename core/runtime.jvm/src/{jet => kotlin}/TypeCastException.java (97%) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java index f1a73813439..b3fa217e3fb 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ExpressionCodegen.java @@ -77,9 +77,6 @@ import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.*; import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER; public class ExpressionCodegen extends JetVisitor implements LocalLookup, ParentCodegenAware { - - private static final String CLASS_NO_PATTERN_MATCHED_EXCEPTION = "jet/NoPatternMatchedException"; - private static final String CLASS_TYPE_CAST_EXCEPTION = "jet/TypeCastException"; private static final Set INTEGRAL_RANGES = KotlinBuiltIns.getInstance().getIntegralRanges(); private int myLastLineNumber = -1; @@ -3587,7 +3584,7 @@ The "returned" value of try expression with no finally is either the last expres v.ifnonnull(nonnull); JetType leftType = bindingContext.get(BindingContext.EXPRESSION_TYPE, left); assert leftType != null; - throwNewException(CLASS_TYPE_CAST_EXCEPTION, DescriptorRenderer.TEXT.renderType(leftType) + + throwNewException("kotlin/TypeCastException", DescriptorRenderer.TEXT.renderType(leftType) + " cannot be cast to " + DescriptorRenderer.TEXT.renderType(rightType)); v.mark(nonnull); @@ -3730,7 +3727,7 @@ The "returned" value of try expression with no finally is either the last expres // a result is expected if (Boolean.TRUE.equals(bindingContext.get(BindingContext.EXHAUSTIVE_WHEN, expression))) { // when() is supposed to be exhaustive - throwNewException(CLASS_NO_PATTERN_MATCHED_EXCEPTION); + throwNewException("kotlin/NoWhenBranchMatchedException"); } else { // non-exhaustive when() with no else -> Unit must be expected diff --git a/core/runtime.jvm/src/jet/NoPatternMatchedException.java b/core/runtime.jvm/src/kotlin/NoWhenBranchMatchedException.java similarity index 87% rename from core/runtime.jvm/src/jet/NoPatternMatchedException.java rename to core/runtime.jvm/src/kotlin/NoWhenBranchMatchedException.java index c8cc5921fcb..5f4167fae52 100644 --- a/core/runtime.jvm/src/jet/NoPatternMatchedException.java +++ b/core/runtime.jvm/src/kotlin/NoWhenBranchMatchedException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package jet; +package kotlin; -public class NoPatternMatchedException extends RuntimeException { +public class NoWhenBranchMatchedException extends RuntimeException { } diff --git a/core/runtime.jvm/src/jet/TypeCastException.java b/core/runtime.jvm/src/kotlin/TypeCastException.java similarity index 97% rename from core/runtime.jvm/src/jet/TypeCastException.java rename to core/runtime.jvm/src/kotlin/TypeCastException.java index 8a458052fb7..05ffd1bfe64 100644 --- a/core/runtime.jvm/src/jet/TypeCastException.java +++ b/core/runtime.jvm/src/kotlin/TypeCastException.java @@ -14,10 +14,9 @@ * limitations under the License. */ -package jet; +package kotlin; public class TypeCastException extends ClassCastException { - public TypeCastException(String s) { super(s); }