From 1bca00ea964d3445add563ea977ab01160ab941a Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Tue, 31 Jan 2012 14:49:20 +0400 Subject: [PATCH] A stub workaround for exception thrown when something is annotated with @Retention(RetentionPolicy.RUNITME) or something like this --- .../jet/lang/resolve/java/kt/PsiAnnotationUtils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationUtils.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationUtils.java index cae68d2cf2d..f789a80e4ac 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationUtils.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationUtils.java @@ -1,6 +1,7 @@ package org.jetbrains.jet.lang.resolve.java.kt; import com.intellij.psi.PsiAnnotation; +import com.intellij.psi.PsiAnnotationMemberValue; import com.intellij.psi.PsiLiteralExpression; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,10 +29,12 @@ public class PsiAnnotationUtils { if (annotation == null) { return defaultValue; } else { - PsiLiteralExpression attributeValue = (PsiLiteralExpression) annotation.findAttributeValue(field); - if (attributeValue != null) { + PsiAnnotationMemberValue value = annotation.findAttributeValue(field); + if (value instanceof PsiLiteralExpression) { + PsiLiteralExpression attributeValue = (PsiLiteralExpression) value; return (T) attributeValue.getValue(); - } else { + } + else { return defaultValue; } }