Example input code:
import java.util.List;
import java.util.Map;
import org.immutables.value.Value;
import org.jspecify.annotations.Nullable;
@Value.Immutable
@Value.Style(fallbackNullableAnnotation = Nullable.class)
public abstract class Test {
public abstract @Nullable List<String> getList();
public abstract @Nullable Map<String, String> getMap();
}
This results in correct signatures of withList:
public final ImmutableTest withList(String @Nullable ... elements) {
public final ImmutableTest withList(@Nullable Iterable<String> elements) {
but an incorrect signature of withMap (missing @Nullable):
public final ImmutableTest withMap(Map<String, ? extends String> entries) {
The null check still exists within the method, only the parameter is missing its annotation.
Example input code:
This results in correct signatures of withList:
but an incorrect signature of withMap (missing
@Nullable):The null check still exists within the method, only the parameter is missing its annotation.