diff --git a/uast/uast-common/src/org/jetbrains/uast/baseElements/UElement.kt b/uast/uast-common/src/org/jetbrains/uast/baseElements/UElement.kt index 0837c939189b..6c4a91bad15f 100644 --- a/uast/uast-common/src/org/jetbrains/uast/baseElements/UElement.kt +++ b/uast/uast-common/src/org/jetbrains/uast/baseElements/UElement.kt @@ -32,9 +32,29 @@ interface UElement { /** * Returns the PSI element underlying this element. Note that some UElements are synthetic and do not have * an underlying PSI element; this doesn't mean that they are invalid. + * + * **Node for implementors**: please implement both [sourcePsi] and [javaPsi] fields or make them return `null` explicitly + * if implementing is not possible. Redirect `psi` to one of them keeping existing behavior, use [sourcePsi] if nothing else is specified. */ + @Deprecated("ambiguous psi element, use `sourcePsi` or `javaPsi`", ReplaceWith("javaPsi")) val psi: PsiElement? + + /** + * Returns the PSI element in original (physical) tree to which this UElement corresponds. + * **Note**: that some UElements are synthetic and do not have an underlying PSI element; + * this doesn't mean that they are invalid. + */ + val sourcePsi: PsiElement? + get() = psi + + /** + * Returns the element which try to mimic Java-api psi element: [com.intellij.psi.PsiClass], [com.intellij.psi.PsiMethod] or [com.intellij.psi.PsiAnnotation] etc. + * Will return null if this UElement doesn't have Java representation or it is not implemented. + */ + val javaPsi: PsiElement? + get() = psi + /** * Returns true if this element is valid, false otherwise. */ @@ -102,38 +122,8 @@ interface UElement { fun accept(visitor: UastTypedVisitor, data: D): R = visitor.visitElement(this, data) } -/** - * This is transitional type, all its content will be moved to `UElement` as soon as all implementations will implement it, - * and someday this interface will be dropped. - */ -@ApiStatus.Experimental -interface JvmDeclarationUElement : UElement { - - /** - * Returns the PSI element in original (physical) tree to which this UElement corresponds. - * **Note**: that some UElements are synthetic and do not have an underlying PSI element; - * this doesn't mean that they are invalid. - */ - val sourcePsi: PsiElement? - get() = psi - - /** - * Returns the element which try to mimic Java-api psi element: [com.intellij.psi.PsiClass], [com.intellij.psi.PsiMethod] or [com.intellij.psi.PsiAnnotation] etc. - * Will return null if this UElement doesn't have Java representation or it is not implemented. - */ - val javaPsi: PsiElement? - get() = psi - - /** - * Returns the PSI element underlying this element. Note that some UElements are synthetic and do not have - * an underlying PSI element; this doesn't mean that they are invalid. - * - * **Node for implementors**: please implement both [sourcePsi] and [javaPsi] fields or make them return `null` explicitly - * if implementing is not possible. Redirect `psi` to one of them keeping existing behavior, use [sourcePsi] if nothing else is specified. - */ - @Deprecated("ambiguous psi element, use `sourcePsi` or `javaPsi`", ReplaceWith("javaPsi")) - override val psi: PsiElement? -} +@Deprecated("No use anymore, all declarations were moved to UElement. To be removed in 2018.2") +interface JvmDeclarationUElement : UElement /** * Experimental API diff --git a/uast/uast-java/src/org/jetbrains/uast/java/JavaAbstractUElement.kt b/uast/uast-java/src/org/jetbrains/uast/java/JavaAbstractUElement.kt index 620d50e08f86..6a743ad346ea 100644 --- a/uast/uast-java/src/org/jetbrains/uast/java/JavaAbstractUElement.kt +++ b/uast/uast-java/src/org/jetbrains/uast/java/JavaAbstractUElement.kt @@ -60,9 +60,9 @@ abstract class JavaAbstractUElement(givenParent: UElement?) : JavaUElementWithCo override val comments: List get() = super.comments override val sourcePsi: PsiElement? - get() = super.sourcePsi + get() = super.sourcePsi override val javaPsi: PsiElement? - get() = super.javaPsi + get() = super.javaPsi }