[java-analysis] Do not apply container annotation to local variables if their type is a bounded type parameter

Fixes IDEA-362982 JSpecify: Local variable incorrectly asserted as NotNull with generics

GitOrigin-RevId: c310d57d875b4f63370daf0b77caece902681a06
This commit is contained in:
Tagir Valeev
2025-02-12 20:34:11 +00:00
committed by intellij-monorepo-bot
parent 3ac1ccb7ea
commit b9cd1e1a86
4 changed files with 29 additions and 7 deletions
@@ -0,0 +1,15 @@
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import java.io.Serializable;
@NullMarked
class LocalsWithGenericsNullness {
public <R extends Serializable> @Nullable R fetchOne() {
throw new UnsupportedOperationException("Not relevant");
}
public <R extends Serializable> void fetchOneDelegate() {
R record = fetchOne();
}
}