Object (Set<PsiVariable> visitedVars) { if (!hasModifierProperty(PsiModifier.FINAL)) return null; PsiType type = getType(); // javac rejects all non primitive and non String constants, although JLS states constants "variables whose initializers are constant expressions" if (!(type instanceof PsiPrimitiveType) && !type.equalsToText("java.lang.String")) return null; PsiExpression initializer = getInitializer(); if (initializer == null) return null; return PsiConstantEvaluationHelperImpl.computeCastTo(initializer, getType(), visitedVars); }