Improve exception message in collection stubs
This commit is contained in:
@@ -323,7 +323,10 @@ class CollectionStubMethodGenerator(
|
|||||||
val genericSignature = if (synthetic) null else signature.genericsSignature
|
val genericSignature = if (synthetic) null else signature.genericsSignature
|
||||||
val mv = v.newMethod(JvmDeclarationOrigin.NO_ORIGIN, access, asmMethod.name, asmMethod.descriptor, genericSignature, null)
|
val mv = v.newMethod(JvmDeclarationOrigin.NO_ORIGIN, access, asmMethod.name, asmMethod.descriptor, genericSignature, null)
|
||||||
mv.visitCode()
|
mv.visitCode()
|
||||||
AsmUtil.genThrow(InstructionAdapter(mv), "java/lang/UnsupportedOperationException", "Mutating immutable collection")
|
AsmUtil.genThrow(
|
||||||
|
InstructionAdapter(mv),
|
||||||
|
"java/lang/UnsupportedOperationException",
|
||||||
|
"Operation is not supported for read-only collection")
|
||||||
FunctionCodegen.endVisit(mv, "built-in stub for $signature", null)
|
FunctionCodegen.endVisit(mv, "built-in stub for $signature", null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ fun box(): String {
|
|||||||
method.invoke(c, "")
|
method.invoke(c, "")
|
||||||
return "fail 4"
|
return "fail 4"
|
||||||
} catch (e: java.lang.reflect.InvocationTargetException) {
|
} catch (e: java.lang.reflect.InvocationTargetException) {
|
||||||
if (e.cause!!.message != "Mutating immutable collection") return "fail 5: ${e.cause!!.message}"
|
if (e.cause!!.message != "Operation is not supported for read-only collection") return "fail 5: ${e.cause!!.message}"
|
||||||
}
|
}
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
|
|||||||
Reference in New Issue
Block a user