diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/annotationArgumentsImpl.kt b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/annotationArgumentsImpl.kt index d3ba290aaf9..b7142c12f05 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/annotationArgumentsImpl.kt +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/annotationArgumentsImpl.kt @@ -20,10 +20,9 @@ import com.intellij.psi.* import org.jetbrains.jet.lang.resolve.java.structure.* import org.jetbrains.jet.lang.resolve.name.Name -abstract class JavaAnnotationArgumentImpl( - psiAnnotationMemberValue: Psi, +abstract class JavaAnnotationArgumentImpl( override val name: Name? -) : JavaElementImpl(psiAnnotationMemberValue), JavaAnnotationArgument { +) : JavaAnnotationArgument { class object { fun create(argument: PsiAnnotationMemberValue, name: Name?): JavaAnnotationArgument { val value = JavaPsiFacade.getInstance(argument.getProject()).getConstantEvaluationHelper().computeConstantExpression(argument) @@ -48,18 +47,18 @@ class JavaLiteralAnnotationArgumentImpl( ) : JavaLiteralAnnotationArgument class JavaArrayAnnotationArgumentImpl( - psiValue: PsiArrayInitializerMemberValue, + private val psiValue: PsiArrayInitializerMemberValue, name: Name? -) : JavaAnnotationArgumentImpl(psiValue, name), JavaArrayAnnotationArgument { - override fun getElements() = getPsi().getInitializers().map { JavaAnnotationArgumentImpl.create(it, null) } +) : JavaAnnotationArgumentImpl(name), JavaArrayAnnotationArgument { + override fun getElements() = psiValue.getInitializers().map { JavaAnnotationArgumentImpl.create(it, null) } } class JavaEnumValueAnnotationArgumentImpl( - psiReference: PsiReferenceExpression, + private val psiReference: PsiReferenceExpression, name: Name? -) : JavaAnnotationArgumentImpl(psiReference, name), JavaEnumValueAnnotationArgument { +) : JavaAnnotationArgumentImpl(name), JavaEnumValueAnnotationArgument { override fun resolve(): JavaField? { - val element = getPsi().resolve() + val element = psiReference.resolve() return when (element) { null -> null is PsiEnumConstant -> JavaFieldImpl(element) @@ -69,15 +68,15 @@ class JavaEnumValueAnnotationArgumentImpl( } class JavaClassObjectAnnotationArgumentImpl( - psiExpression: PsiClassObjectAccessExpression, + private val psiExpression: PsiClassObjectAccessExpression, name: Name? -) : JavaAnnotationArgumentImpl(psiExpression, name), JavaClassObjectAnnotationArgument { - override fun getReferencedType() = JavaTypeImpl.create(getPsi().getOperand().getType()) +) : JavaAnnotationArgumentImpl(name), JavaClassObjectAnnotationArgument { + override fun getReferencedType() = JavaTypeImpl.create(psiExpression.getOperand().getType()) } class JavaAnnotationAsAnnotationArgumentImpl( - psiAnnotation: PsiAnnotation, + private val psiAnnotation: PsiAnnotation, name: Name? -) : JavaAnnotationArgumentImpl(psiAnnotation, name), JavaAnnotationAsAnnotationArgument { - override fun getAnnotation() = JavaAnnotationImpl(getPsi()) +) : JavaAnnotationArgumentImpl(name), JavaAnnotationAsAnnotationArgument { + override fun getAnnotation() = JavaAnnotationImpl(psiAnnotation) } diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/annotationArguments.kt b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/annotationArguments.kt index 197de0b1680..085a120aa20 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/annotationArguments.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/annotationArguments.kt @@ -18,7 +18,7 @@ package org.jetbrains.jet.lang.resolve.java.structure import org.jetbrains.jet.lang.resolve.name.Name -public trait JavaAnnotationArgument : JavaElement { +public trait JavaAnnotationArgument { public val name: Name? }