boolean (PsiType from, PsiClassType to, PsiExpression context) { if (from.equals(PsiTypes.intType().createArrayType()) && to.getCanonicalText().equals(AtomicIntegerArray.class.getName())) { return true; } if (from.equals(PsiTypes.longType().createArrayType()) && to.getCanonicalText().equals(AtomicLongArray.class.getName())) { return true; } final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(to); final PsiClass atomicClass = resolveResult.getElement(); if (atomicClass != null) { final String typeQualifiedName = atomicClass.getQualifiedName(); if (!Comparing.strEqual(typeQualifiedName, AtomicReference.class.getName()) && !Comparing.strEqual(typeQualifiedName, AtomicReferenceArray.class.getName())) { return false; } final PsiTypeParameter[] typeParameters = atomicClass.getTypeParameters(); if (typeParameters.length != 1) return false; final PsiType toTypeParameterValue = resolveResult.getSubstitutor().substitute(typeParameters[0]); if (from instanceof PsiArrayType arrayType) { from = arrayType.getComponentType(); } if (toTypeParameterValue != null) { if (from instanceof PsiPrimitiveType) { final PsiPrimitiveType unboxedInitialType = PsiPrimitiveType.getUnboxedType(toTypeParameterValue); if (unboxedInitialType != null) { return TypeConversionUtil.areTypesConvertible(unboxedInitialType, from); } } else { return TypeConversionUtil.isAssignable(PsiUtil.captureToplevelWildcards(toTypeParameterValue, context), from); } } } return false; }