EclipseDefaultTypeUse: lambda tests (IDEA-CR-62110)

GitOrigin-RevId: 32c42e7bf331ca2301f2e7de336923480004be52
This commit is contained in:
Tagir Valeev
2020-04-29 06:26:28 +00:00
committed by intellij-monorepo-bot
parent a7149e200a
commit 86d6e5863b
@@ -16,4 +16,26 @@ public class EclipseDefaultTypeUse {
// List::add is not annotated but ArrayList<String> is defined in context of TYPE_USE NonNullByDefault annotation
a.add(<warning descr="Passing 'null' argument to parameter annotated as @NotNull">null</warning>);
}
}
@NonNullByDefault
@FunctionalInterface
interface DefNotNull {
String apply(String s);
}
@FunctionalInterface
interface Plain {
String apply(String s);
}
@NonNullByDefault
class UseNotNull {
void test() {
DefNotNull l1 = s -> <warning descr="Condition 's == null' is always 'false'">s == null</warning> ? "null" : s.isEmpty() ? <warning descr="'null' is returned by the method declared as @NonNullByDefault">null</warning> : s;
Plain l2 = s -> s == null ? "null" : s.isEmpty() ? null : s;
}
}
class UsePlain {
void test() {
DefNotNull l1 = s -> <warning descr="Condition 's == null' is always 'false'">s == null</warning> ? "null" : s.isEmpty() ? <warning descr="'null' is returned by the method declared as @NonNullByDefault">null</warning> : s;
Plain l2 = s -> s == null ? "null" : s.isEmpty() ? null : s;
}
}