diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/CollectionStubMethodGenerator.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/CollectionStubMethodGenerator.kt index d1611393e5b..05ee64287d0 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/CollectionStubMethodGenerator.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/CollectionStubMethodGenerator.kt @@ -323,7 +323,10 @@ class CollectionStubMethodGenerator( val genericSignature = if (synthetic) null else signature.genericsSignature val mv = v.newMethod(JvmDeclarationOrigin.NO_ORIGIN, access, asmMethod.name, asmMethod.descriptor, genericSignature, null) 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) } } diff --git a/compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt b/compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt index e55ae496483..711021f904b 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt @@ -43,7 +43,7 @@ fun box(): String { method.invoke(c, "") return "fail 4" } 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"