You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrade from 3.32.0 > 3.40.0, I get warnings on following code
public Optional<String> test(@Nullable String param) {
var first = Optional.ofNullable(param);
var second = first.isPresent() ? first : Optional.ofNullable(param);
return second;
}
It now produces
java: [return] incompatible types in return.
type of expression: @Initialized @NonNull Optional<@Initialized @Nullable String>
method return type: @Initialized @NonNull Optional<@Initialized @NonNull String>
which I believe is false positive.
Equivalent code with both variables using explicit type
public Optional<String> test(@Nullable String param) {
Optional<String> first = Optional.ofNullable(param);
Optional<String> second = first.isPresent() ? first : Optional.ofNullable(param);
return second;
}
produces no warnings
The text was updated successfully, but these errors were encountered:
After upgrade from 3.32.0 > 3.40.0, I get warnings on following code
It now produces
which I believe is false positive.
Equivalent code with both variables using explicit type
produces no warnings
The text was updated successfully, but these errors were encountered: