JS: fix support of throwable constructors without message and/or cause parameters
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
class CustomException : Throwable {
|
||||
constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
constructor(message: String?) : super(message, null)
|
||||
|
||||
constructor(cause: Throwable?) : super(cause)
|
||||
|
||||
constructor() : super()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var t = CustomException("O", Throwable("K"))
|
||||
if (t.message != "O" || t.cause?.message != "K") return "fail1"
|
||||
|
||||
t = CustomException(Throwable("OK"))
|
||||
if (t.message == null || t.message == "OK" || t.cause?.message != "OK") return "fail2"
|
||||
|
||||
t = CustomException("OK")
|
||||
if (t.message != "OK" || t.cause != null) return "fail3"
|
||||
|
||||
t = CustomException()
|
||||
if (t.message != null || t.cause != null) return "fail4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -3,7 +3,13 @@ fun box(): String {
|
||||
if (t.message != "O" || t.cause?.message != "K") return "fail1"
|
||||
|
||||
t = Throwable(Throwable("OK"))
|
||||
if (t.message != null || t.cause?.message != "OK") return "fail2"
|
||||
if (t.message == null || t.message == "OK" || t.cause?.message != "OK") return "fail2"
|
||||
|
||||
t = Throwable("OK")
|
||||
if (t.message != "OK" || t.cause != null) return "fail3"
|
||||
|
||||
t = Throwable()
|
||||
if (t.message != null || t.cause != null) return "fail4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
public final class CustomException {
|
||||
public method <init>(): void
|
||||
public method <init>(@org.jetbrains.annotations.Nullable p0: java.lang.String): void
|
||||
public method <init>(@org.jetbrains.annotations.Nullable p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): void
|
||||
public method <init>(@org.jetbrains.annotations.Nullable p0: java.lang.Throwable): void
|
||||
}
|
||||
|
||||
public final class ExceptionCauseKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
public final class MyThrowable {
|
||||
private final @org.jetbrains.annotations.NotNull field x: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: java.lang.String, @org.jetbrains.annotations.Nullable p2: java.lang.Throwable): void
|
||||
public synthetic method <init>(p0: java.lang.String, p1: java.lang.String, p2: java.lang.Throwable, p3: int, p4: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
public final @org.jetbrains.annotations.NotNull method getX(): java.lang.String
|
||||
}
|
||||
|
||||
public final class ThrowableImplWithSecondaryConstructorKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
Reference in New Issue
Block a user