Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions runtime/src/main/java/dev/cel/runtime/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,6 @@ java_library(
"//:auto_value",
"@maven//:com_google_errorprone_error_prone_annotations",
"@maven//:com_google_guava_guava",
"@maven//:com_google_protobuf_protobuf_java",
],
)

Expand All @@ -1189,7 +1188,6 @@ cel_android_library(
"//:auto_value",
"@maven//:com_google_errorprone_error_prone_annotations",
"@maven_android//:com_google_guava_guava",
"@maven_android//:com_google_protobuf_protobuf_javalite",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.Immutable;
import com.google.protobuf.MessageLite;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -89,9 +88,7 @@ boolean canHandle(Object[] arguments) {
if (arg == null) {
// null can be assigned to messages, maps, and to objects.
// TODO: Remove null special casing
if (paramType != Object.class
&& !MessageLite.class.isAssignableFrom(paramType)
&& !Map.class.isAssignableFrom(paramType)) {
if (paramType != Object.class && !Map.class.isAssignableFrom(paramType)) {
return false;
}
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,13 @@ public void findOverload_nullPrimitiveArg_isEmpty() throws Exception {
}

@Test
public void findOverload_nullMessageArg_returnsOverload() throws Exception {
public void findOverload_nullMessageArg_isEmpty() throws Exception {
CelLateFunctionBindings bindings =
CelLateFunctionBindings.from(
CelFunctionBinding.from("identity_msg", TestAllTypes.class, (arg) -> arg));
Optional<CelResolvedOverload> overload =
bindings.findOverloadMatchingArgs(
"identity", ImmutableList.of("identity_msg"), new Object[] {null});
assertThat(overload).isPresent();
assertThat(overload.get().getOverloadId()).isEqualTo("identity_msg");
assertThat(overload.get().getParameterTypes()).containsExactly(TestAllTypes.class);
assertThat(overload.get().getDefinition().apply(new Object[] {null})).isNull();
assertThat(overload).isEmpty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public void canHandle_matchingTypes_returnsTrue() {
}

@Test
public void canHandle_nullMessageType_returnsTrue() {
public void canHandle_nullMessageType_returnsFalse() {
CelResolvedOverload overload =
CelResolvedOverload.of(
"identity", (args) -> args[0], /* isStrict= */ true, TestAllTypes.class);
assertThat(overload.canHandle(new Object[] {null})).isTrue();
assertThat(overload.canHandle(new Object[] {null})).isFalse();
}

@Test
Expand Down
Loading