Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ interface Builder {

@Test
public void testInheritedGetterRemainsNullable() throws NoSuchMethodException {
assumeTrue(javacHandlesTypeAnnotationsCorrectly);
// Ensure that the implementation has `@Nullable String thing()`.
StringThing instance = new AutoValue_AutoValueJava8Test_StringThing(null);
Method getter = instance.getClass().getDeclaredMethod("thing");
Expand All @@ -352,6 +353,7 @@ public void testInheritedGetterRemainsNullable() throws NoSuchMethodException {

@Test
public void testInheritedBuilderGetterRemainsNullable() throws NoSuchMethodException {
assumeTrue(javacHandlesTypeAnnotationsCorrectly);
StringThingWithBuilder instance = StringThingWithBuilder.builder().setThing(null).build();
Method getter = instance.getClass().getDeclaredMethod("thing");
assertThat(getter.getAnnotatedReturnType().getAnnotations()).asList().contains(nullable());
Expand Down Expand Up @@ -1211,6 +1213,7 @@ public abstract static class Builder<T> {

@Test
public void typeParameterBuilderFieldsAreNullable() throws ReflectiveOperationException {
assumeTrue(javacHandlesTypeAnnotationsCorrectly);
assertThrows(NullPointerException.class, () -> NotNullableVariableBound.builder().setT(null));

// Even though neither t() nor string() has a @Nullable return type, the corresponding builder
Expand Down
Loading