mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-analysis] Pass nullability in PsiConditionalExpressionImpl::getType and in PsiCorrectedClassType
Fixes IDEA-375416 False-positive nullability report on lambda with ternary and null in one branch GitOrigin-RevId: 5679bb57205cb4d49b9e87cbc4b8236c30aced67
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b84d468a40
commit
7d4934114b
@@ -0,0 +1,23 @@
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.List;
|
||||
|
||||
public class JSpecifyLambdaTernary {
|
||||
static <T, R> R process(List<T> list, Function<? super T, ? extends R> fn) {
|
||||
return fn.apply(list.get(0));
|
||||
}
|
||||
|
||||
@NullMarked
|
||||
static class Use {
|
||||
static void processList(List<Integer> list) {
|
||||
Integer result = process(list, s -> s == 0 ? null : s);
|
||||
if (result == null) {}
|
||||
}
|
||||
|
||||
static void processListNonNumeric(List<String> list) {
|
||||
String result = process(list, s -> s.isEmpty() ? null : s);
|
||||
if (result == null) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user