String (PsiAnnotation annotation, String attribute) { PsiAnnotationMemberValue value = annotation.findAttributeValue(attribute); if (value == null) { return null; } if (value instanceof PsiExpression) { Object res = ExpressionUtils.computeConstantExpression(((PsiExpression)value)); if (res instanceof String) { return (String)res; } } throw new IllegalStateException("Constant string expression expected, but was " + value); }