boolean (PsiExpression expression, LanguageLevel languageLevel, Set<Object> existingCaseValues) { if (expression == null) { return false; } if (languageLevel.isAtLeast(LanguageLevel.JDK_1_5) && expression instanceof PsiReferenceExpression) { final PsiElement referent = ((PsiReference)expression).resolve(); if (referent instanceof PsiEnumConstant) { return existingCaseValues == null || existingCaseValues.add(referent); } } final PsiType type = expression.getType(); if ((!languageLevel.isAtLeast(LanguageLevel.JDK_1_7) || !TypeUtils.isJavaLangString(type)) && !PsiTypes.intType().equals(type) && !PsiTypes.shortType().equals(type) && !PsiTypes.byteType().equals(type) && !PsiTypes.charType().equals(type)) { return false; } final Object value = ExpressionUtils.computeConstantExpression(expression); if (value == null) { return false; } return existingCaseValues == null || existingCaseValues.add(value); }