mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
[java-inspections] IDEA-381019 Invalid local variable type inference in JSpecify mode with generic functions
GitOrigin-RevId: 4a99f16a371b9ad909500aadc14031ebcf547149
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bcf0ff8249
commit
581215e7e9
@@ -255,6 +255,7 @@ public abstract class PsiClassType extends PsiType implements JvmReferenceType {
|
||||
|
||||
/**
|
||||
* If class-type is created from the explicit reference in the code returns that reference.
|
||||
* If type is created from `var` keyword, return this keyword
|
||||
* @return reference which the type is created from. Returns null if not applicable.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
|
||||
@@ -71,7 +71,8 @@ public final class JavaTypeNullabilityUtil {
|
||||
|
||||
private static boolean isLocal(PsiClassType classType) {
|
||||
PsiElement context = classType.getPsiContext();
|
||||
return context instanceof PsiJavaCodeReferenceElement &&
|
||||
//PsiKeyword is used for `var` case
|
||||
return (context instanceof PsiJavaCodeReferenceElement || PsiUtil.isJavaToken(context, JavaTokenType.VAR_KEYWORD)) &&
|
||||
context.getParent() instanceof PsiTypeElement &&
|
||||
context.getParent().getParent() instanceof PsiLocalVariable;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user