mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 23:39:39 +07:00
[java-dfa] getArrayElementValue: fix unboxing Object[] arrays
Fixes IDEA-288566 Wrong warning at array element instanceof when it was autoboxed GitOrigin-RevId: f4c1a4bceca84db8842541ed0468af8785a839c7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6754c44959
commit
b2fd2611de
@@ -97,6 +97,12 @@ public final class ArrayElementDescriptor extends JvmVariableDescriptor {
|
||||
if (arrayPsiVar != null) {
|
||||
PsiExpression constantArrayElement = ExpressionUtils.getConstantArrayElement(arrayPsiVar, index);
|
||||
if (constantArrayElement != null) {
|
||||
PsiType elementType = constantArrayElement.getType();
|
||||
if (componentType instanceof DfReferenceType && elementType instanceof PsiPrimitiveType &&
|
||||
!TypeConstraint.fromDfType(componentType).isPrimitiveWrapper()) {
|
||||
componentType = DfTypes.typedObject(((PsiPrimitiveType)elementType).getBoxedType(constantArrayElement), Nullability.UNKNOWN)
|
||||
.meet(componentType);
|
||||
}
|
||||
return getAdvancedExpressionDfaValue(factory, constantArrayElement, componentType);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user