Add constructors with messages and causes to runtime exceptions
This commit is contained in:
@@ -17,4 +17,10 @@
|
|||||||
package kotlin;
|
package kotlin;
|
||||||
|
|
||||||
public class KotlinNullPointerException extends NullPointerException {
|
public class KotlinNullPointerException extends NullPointerException {
|
||||||
|
public KotlinNullPointerException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public KotlinNullPointerException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,18 @@
|
|||||||
package kotlin;
|
package kotlin;
|
||||||
|
|
||||||
public class NoWhenBranchMatchedException extends RuntimeException {
|
public class NoWhenBranchMatchedException extends RuntimeException {
|
||||||
|
public NoWhenBranchMatchedException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoWhenBranchMatchedException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoWhenBranchMatchedException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoWhenBranchMatchedException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,10 @@
|
|||||||
package kotlin;
|
package kotlin;
|
||||||
|
|
||||||
public class TypeCastException extends ClassCastException {
|
public class TypeCastException extends ClassCastException {
|
||||||
public TypeCastException(String s) {
|
public TypeCastException() {
|
||||||
super(s);
|
}
|
||||||
|
|
||||||
|
public TypeCastException(String message) {
|
||||||
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,12 @@
|
|||||||
|
|
||||||
package kotlin
|
package kotlin
|
||||||
|
|
||||||
public class UninitializedPropertyAccessException(name: String): RuntimeException("lateinit property $name has not been initialized")
|
class UninitializedPropertyAccessException : RuntimeException {
|
||||||
|
constructor()
|
||||||
|
|
||||||
|
constructor(message: String) : super(message)
|
||||||
|
|
||||||
|
constructor(message: String, cause: Throwable) : super(message, cause)
|
||||||
|
|
||||||
|
constructor(cause: Throwable) : super(cause)
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ package kotlin.jvm.internal;
|
|||||||
|
|
||||||
import kotlin.KotlinNullPointerException;
|
import kotlin.KotlinNullPointerException;
|
||||||
import kotlin.UninitializedPropertyAccessException;
|
import kotlin.UninitializedPropertyAccessException;
|
||||||
import kotlin.jvm.internal.markers.*;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class Intrinsics {
|
public class Intrinsics {
|
||||||
@@ -35,8 +35,16 @@ public class Intrinsics {
|
|||||||
throw sanitizeStackTrace(new KotlinNullPointerException());
|
throw sanitizeStackTrace(new KotlinNullPointerException());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void throwNpe(String message) {
|
||||||
|
throw sanitizeStackTrace(new KotlinNullPointerException(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void throwUninitializedProperty(String message) {
|
||||||
|
throw sanitizeStackTrace(new UninitializedPropertyAccessException(message));
|
||||||
|
}
|
||||||
|
|
||||||
public static void throwUninitializedPropertyAccessException(String propertyName) {
|
public static void throwUninitializedPropertyAccessException(String propertyName) {
|
||||||
throw sanitizeStackTrace(new UninitializedPropertyAccessException(propertyName));
|
throwUninitializedProperty("lateinit property " + propertyName + " has not been initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkExpressionValueIsNotNull(Object value, String message) {
|
public static void checkExpressionValueIsNotNull(Object value, String message) {
|
||||||
|
|||||||
Reference in New Issue
Block a user