Enum.valueOf throws inconsistent exception across multiple platforms #KT-35116

This commit is contained in:
Abduqodiri Qurbonzoda
2023-06-11 03:14:37 +03:00
committed by Space Team
parent d6867917c9
commit 295fdc36ce
10 changed files with 34 additions and 11 deletions
@@ -95,7 +95,7 @@ public final class Namer {
public static final String ANOTHER_THIS_PARAMETER_NAME = "$this";
public static final String THROW_CLASS_CAST_EXCEPTION_FUN_NAME = "throwCCE";
public static final String THROW_ILLEGAL_STATE_EXCEPTION_FUN_NAME = "throwISE";
public static final String THROW_ILLEGAL_ARGUMENT_EXCEPTION_FUN_NAME = "throwIAE";
public static final String THROW_UNINITIALIZED_PROPERTY_ACCESS_EXCEPTION = "throwUPAE";
public static final String NULL_CHECK_INTRINSIC_NAME = "ensureNotNull";
private static final String PROTOTYPE_NAME = "prototype";
@@ -66,7 +66,7 @@ class EnumTranslator(
val message = JsBinaryOperation(JsBinaryOperator.ADD,
JsStringLiteral("No enum constant ${descriptor.fqNameSafe}."),
nameParam.makeRef())
val throwFunction = context().getReferenceToIntrinsic(Namer.THROW_ILLEGAL_STATE_EXCEPTION_FUN_NAME)
val throwFunction = context().getReferenceToIntrinsic(Namer.THROW_ILLEGAL_ARGUMENT_EXCEPTION_FUN_NAME)
val throwStatement = JsExpressionStatement(JsInvocation(throwFunction, message).source(psi))
if (clauses.isNotEmpty()) {