Object (Set<PsiVariable> visitedVars) { if (!hasModifierProperty(PsiModifier.FINAL)) { return null; } PsiClass containingClass = getContainingClass(); if (containingClass != null) { String qName = containingClass.getQualifiedName(); if ("java.lang.Float".equals(qName)) { String name = getName(); if ("POSITIVE_INFINITY".equals(name)) return Float.POSITIVE_INFINITY; if ("NEGATIVE_INFINITY".equals(name)) return Float.NEGATIVE_INFINITY; if ("NaN".equals(name)) return Float.NaN; } else if ("java.lang.Double".equals(qName)) { String name = getName(); if ("POSITIVE_INFINITY".equals(name)) return Double.POSITIVE_INFINITY; if ("NEGATIVE_INFINITY".equals(name)) return Double.NEGATIVE_INFINITY; if ("NaN".equals(name)) return Double.NaN; } // Wrapper classes have a TYPE field holding the Class object of the primitive type if (qName != null && "TYPE".equals(getName())) { switch (qName) { case "java.lang.Byte": { return PsiTypes.byteType(); } case "java.lang.Character": { return PsiTypes.charType(); } case "java.lang.Double": { return PsiTypes.doubleType(); } case "java.lang.Float": { return PsiTypes.floatType(); } case "java.lang.Integer": { return PsiTypes.intType(); } case "java.lang.Long": { return PsiTypes.longType(); } case "java.lang.Short": { return PsiTypes.shortType(); } case "java.lang.Boolean": { return PsiTypes.booleanType(); } case "java.lang.Void": { return PsiTypes.voidType(); } } } } PsiExpression initializer = getInitializer(); if (initializer == null) { return null; } return PsiConstantEvaluationHelperImpl.computeCastTo(initializer, getType(), visitedVars); }