boolean (PsiExpression expression) { if (!(expression instanceof PsiReferenceExpression referenceExpression)) { return false; } @NonNls final String referenceName = referenceExpression.getReferenceName(); if (!"NaN".equals(referenceName)) { return false; } final PsiElement target = referenceExpression.resolve(); if (!(target instanceof PsiField field)) { return false; } final PsiClass containingClass = field.getContainingClass(); if (containingClass == null) { return false; } final String qualifiedName = containingClass.getQualifiedName(); return CommonClassNames.JAVA_LANG_DOUBLE.equals(qualifiedName) || CommonClassNames.JAVA_LANG_FLOAT.equals(qualifiedName); }