diff --git a/common/src/main/java/dev/cel/common/internal/ProtoAdapter.java b/common/src/main/java/dev/cel/common/internal/ProtoAdapter.java index 29fece49..28da7e5d 100644 --- a/common/src/main/java/dev/cel/common/internal/ProtoAdapter.java +++ b/common/src/main/java/dev/cel/common/internal/ProtoAdapter.java @@ -17,7 +17,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.ImmutableMap.toImmutableMap; -import dev.cel.expr.ExprValue; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.primitives.Ints; @@ -205,9 +204,6 @@ public Object adaptProtoToValue(MessageOrBuilder proto) { @SuppressWarnings({"unchecked", "rawtypes"}) public Optional adaptFieldToValue(FieldDescriptor fieldDescriptor, Object fieldValue) { - if (isUnknown(fieldValue)) { - return Optional.of(fieldValue); - } if (fieldDescriptor.isMapField()) { Descriptor entryDescriptor = fieldDescriptor.getMessageType(); FieldDescriptor keyFieldDescriptor = entryDescriptor.findFieldByNumber(1); @@ -255,9 +251,6 @@ public Optional adaptValueToFieldType( if (isWrapperType(fieldDescriptor) && fieldValue.equals(NullValue.NULL_VALUE)) { return Optional.empty(); } - if (isUnknown(fieldValue)) { - return Optional.of(fieldValue); - } if (fieldDescriptor.isMapField()) { Descriptor entryDescriptor = fieldDescriptor.getMessageType(); FieldDescriptor keyDescriptor = entryDescriptor.findFieldByNumber(1); @@ -590,11 +583,6 @@ private static boolean isWrapperType(FieldDescriptor fieldDescriptor) { return wellKnownProto != null && wellKnownProto.isWrapperType(); } - private static boolean isUnknown(Object object) { - return object instanceof ExprValue - && ((ExprValue) object).getKindCase() == ExprValue.KindCase.UNKNOWN; - } - private static int intCheckedCast(long value) { try { return Ints.checkedCast(value);