mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-164159 Nullability annotations don't work with generics
This commit is contained in:
+1
-1
@@ -353,7 +353,7 @@ public class StandardInstructionVisitor extends InstructionVisitor {
|
||||
return qualifierValue;
|
||||
}
|
||||
|
||||
if (type != null && (type instanceof PsiClassType || type.getArrayDimensions() > 0)) {
|
||||
if (type != null && !(type instanceof PsiPrimitiveType)) {
|
||||
Nullness nullability = myReturnTypeNullability.get(instruction);
|
||||
if (nullability == Nullness.UNKNOWN && factory.isUnknownMembersAreNullable()) {
|
||||
nullability = Nullness.NULLABLE;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
abstract class Foo {
|
||||
@NotNull
|
||||
abstract <T> T get(@NotNull Class<? extends T> type);
|
||||
|
||||
void foo(Field field) {
|
||||
Object value = get(field.getType());
|
||||
if (<warning descr="Condition 'value != null' is always 'true'">value != null</warning>) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface Field {
|
||||
Class<?> getType();
|
||||
}
|
||||
@@ -100,4 +100,6 @@ public class DataFlowInspection8Test extends DataFlowInspectionTestCase {
|
||||
nnnManager.setNullables();
|
||||
});
|
||||
}
|
||||
|
||||
public void testCapturedWildcardNotNull() { doTest(); }
|
||||
}
|
||||
@@ -410,4 +410,6 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testNullLiteralArgumentValueUsedAsReturnValue() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCapturedWildcardNotNull() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user