From b283cbe186028e56be56d8a241e920493a481ae7 Mon Sep 17 00:00:00 2001 From: Soy Authors Date: Mon, 11 Nov 2024 05:48:45 -0800 Subject: [PATCH] No public description PiperOrigin-RevId: 695300416 --- .../com/google/template/soy/jbcsrc/ExternCompiler.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/java/src/com/google/template/soy/jbcsrc/ExternCompiler.java b/java/src/com/google/template/soy/jbcsrc/ExternCompiler.java index d7f255da64..323ebfe011 100644 --- a/java/src/com/google/template/soy/jbcsrc/ExternCompiler.java +++ b/java/src/com/google/template/soy/jbcsrc/ExternCompiler.java @@ -306,11 +306,13 @@ private static Expression adaptParameter( // For protocol enums, we need to call forNumber on the type w/ the param (as casted to an int). // This is because Soy internally stores enums as ints. We know this is safe because we // already validated that the enum type matches the signature. - if (soyType.getKind() == Kind.PROTO_ENUM) { + if (nonNullableSoyType.getKind() == Kind.PROTO_ENUM) { if (soyTypeBoxed) { - return JbcSrcExternRuntime.SOY_VALUE_TO_ENUM.invoke( - actualParam, - BytecodeUtils.constant(BytecodeUtils.getTypeForClassName(javaType.getClassName()))); + return JbcSrcExternRuntime.SOY_VALUE_TO_ENUM + .invoke( + actualParam, + BytecodeUtils.constant(BytecodeUtils.getTypeForClassName(javaType.getClassName()))) + .checkedCast(javaType); } return MethodRef.createStaticMethod( javaTypeInfo,