Move and rename exception classes in module 'runtime.jvm'

This commit is contained in:
Alexander Udalov
2014-02-14 21:59:40 +04:00
parent aef0fabd53
commit 4afdac3efa
3 changed files with 5 additions and 9 deletions
@@ -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; import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER;
public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implements LocalLookup, ParentCodegenAware { public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> 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<DeclarationDescriptor> INTEGRAL_RANGES = KotlinBuiltIns.getInstance().getIntegralRanges(); private static final Set<DeclarationDescriptor> INTEGRAL_RANGES = KotlinBuiltIns.getInstance().getIntegralRanges();
private int myLastLineNumber = -1; 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); v.ifnonnull(nonnull);
JetType leftType = bindingContext.get(BindingContext.EXPRESSION_TYPE, left); JetType leftType = bindingContext.get(BindingContext.EXPRESSION_TYPE, left);
assert leftType != null; assert leftType != null;
throwNewException(CLASS_TYPE_CAST_EXCEPTION, DescriptorRenderer.TEXT.renderType(leftType) + throwNewException("kotlin/TypeCastException", DescriptorRenderer.TEXT.renderType(leftType) +
" cannot be cast to " + " cannot be cast to " +
DescriptorRenderer.TEXT.renderType(rightType)); DescriptorRenderer.TEXT.renderType(rightType));
v.mark(nonnull); 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 // a result is expected
if (Boolean.TRUE.equals(bindingContext.get(BindingContext.EXHAUSTIVE_WHEN, expression))) { if (Boolean.TRUE.equals(bindingContext.get(BindingContext.EXHAUSTIVE_WHEN, expression))) {
// when() is supposed to be exhaustive // when() is supposed to be exhaustive
throwNewException(CLASS_NO_PATTERN_MATCHED_EXCEPTION); throwNewException("kotlin/NoWhenBranchMatchedException");
} }
else { else {
// non-exhaustive when() with no else -> Unit must be expected // non-exhaustive when() with no else -> Unit must be expected
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package jet; package kotlin;
public class NoPatternMatchedException extends RuntimeException { public class NoWhenBranchMatchedException extends RuntimeException {
} }
@@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package jet; package kotlin;
public class TypeCastException extends ClassCastException { public class TypeCastException extends ClassCastException {
public TypeCastException(String s) { public TypeCastException(String s) {
super(s); super(s);
} }