Uast update due to new diagnostic for delegation by
This commit is contained in:
@@ -18,6 +18,7 @@ package org.jetbrains.uast.java
|
|||||||
|
|
||||||
import com.intellij.psi.PsiAnonymousClass
|
import com.intellij.psi.PsiAnonymousClass
|
||||||
import com.intellij.psi.PsiClass
|
import com.intellij.psi.PsiClass
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.uast.*
|
import org.jetbrains.uast.*
|
||||||
import org.jetbrains.uast.java.internal.JavaUElementWithComments
|
import org.jetbrains.uast.java.internal.JavaUElementWithComments
|
||||||
|
|
||||||
@@ -57,8 +58,12 @@ abstract class AbstractJavaUClass : UClass, JavaUElementWithComments {
|
|||||||
override fun hashCode() = psi.hashCode()
|
override fun hashCode() = psi.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
class JavaUClass private constructor(psi: PsiClass, override val containingElement: UElement?) : AbstractJavaUClass(), PsiClass by psi {
|
class JavaUClass private constructor(psiClass: PsiClass, override val containingElement: UElement?) : AbstractJavaUClass(), PsiClass by psiClass {
|
||||||
override val psi = unwrap<UClass, PsiClass>(psi)
|
override val psi = unwrap<UClass, PsiClass>(psiClass)
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun create(psi: PsiClass, containingElement: UElement?): UClass {
|
fun create(psi: PsiClass, containingElement: UElement?): UClass {
|
||||||
@@ -75,4 +80,8 @@ class JavaUAnonymousClass(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : AbstractJavaUClass(), UAnonymousClass, PsiAnonymousClass by psi {
|
) : AbstractJavaUClass(), UAnonymousClass, PsiAnonymousClass by psi {
|
||||||
override val psi: PsiAnonymousClass = unwrap<UAnonymousClass, PsiAnonymousClass>(psi)
|
override val psi: PsiAnonymousClass = unwrap<UAnonymousClass, PsiAnonymousClass>(psi)
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractJavaUClass>.getOriginalElement()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
package org.jetbrains.uast.java
|
package org.jetbrains.uast.java
|
||||||
|
|
||||||
import com.intellij.psi.PsiClassInitializer
|
import com.intellij.psi.PsiClassInitializer
|
||||||
|
import com.intellij.psi.PsiCodeBlock
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.uast.*
|
import org.jetbrains.uast.*
|
||||||
import org.jetbrains.uast.java.internal.JavaUElementWithComments
|
import org.jetbrains.uast.java.internal.JavaUElementWithComments
|
||||||
|
|
||||||
@@ -26,6 +28,14 @@ class JavaUClassInitializer(
|
|||||||
) : UClassInitializer, JavaUElementWithComments, PsiClassInitializer by psi {
|
) : UClassInitializer, JavaUElementWithComments, PsiClassInitializer by psi {
|
||||||
override val psi = unwrap<UClassInitializer, PsiClassInitializer>(psi)
|
override val psi = unwrap<UClassInitializer, PsiClassInitializer>(psi)
|
||||||
|
|
||||||
|
override fun getBody(): PsiCodeBlock {
|
||||||
|
return super.getBody()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
override val uastAnchor: UElement?
|
override val uastAnchor: UElement?
|
||||||
get() = null
|
get() = null
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.uast.java
|
package org.jetbrains.uast.java
|
||||||
|
|
||||||
import com.intellij.psi.PsiAnnotationMethod
|
import com.intellij.psi.*
|
||||||
import com.intellij.psi.PsiMethod
|
|
||||||
import com.intellij.psi.PsiNameIdentifierOwner
|
|
||||||
import org.jetbrains.uast.*
|
import org.jetbrains.uast.*
|
||||||
import org.jetbrains.uast.java.internal.JavaUElementWithComments
|
import org.jetbrains.uast.java.internal.JavaUElementWithComments
|
||||||
|
|
||||||
@@ -27,7 +25,15 @@ open class JavaUMethod(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : UMethod, JavaUElementWithComments, PsiMethod by psi {
|
) : UMethod, JavaUElementWithComments, PsiMethod by psi {
|
||||||
override val psi = unwrap<UMethod, PsiMethod>(psi)
|
override val psi = unwrap<UMethod, PsiMethod>(psi)
|
||||||
|
|
||||||
|
override fun getBody(): PsiCodeBlock? {
|
||||||
|
return super.getBody()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
override val uastBody by lz {
|
override val uastBody by lz {
|
||||||
val body = psi.body ?: return@lz null
|
val body = psi.body ?: return@lz null
|
||||||
getLanguagePlugin().convertElement(body, this) as? UExpression
|
getLanguagePlugin().convertElement(body, this) as? UExpression
|
||||||
|
|||||||
@@ -44,7 +44,15 @@ open class JavaUVariable(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : AbstractJavaUVariable(), UVariable, PsiVariable by psi {
|
) : AbstractJavaUVariable(), UVariable, PsiVariable by psi {
|
||||||
override val psi = unwrap<UVariable, PsiVariable>(psi)
|
override val psi = unwrap<UVariable, PsiVariable>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractJavaUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractJavaUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun create(psi: PsiVariable, containingElement: UElement?): UVariable {
|
fun create(psi: PsiVariable, containingElement: UElement?): UVariable {
|
||||||
return when (psi) {
|
return when (psi) {
|
||||||
@@ -63,6 +71,14 @@ open class JavaUParameter(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : AbstractJavaUVariable(), UParameter, PsiParameter by psi {
|
) : AbstractJavaUVariable(), UParameter, PsiParameter by psi {
|
||||||
override val psi = unwrap<UParameter, PsiParameter>(psi)
|
override val psi = unwrap<UParameter, PsiParameter>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractJavaUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractJavaUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class JavaUField(
|
open class JavaUField(
|
||||||
@@ -70,6 +86,14 @@ open class JavaUField(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : AbstractJavaUVariable(), UField, PsiField by psi {
|
) : AbstractJavaUVariable(), UField, PsiField by psi {
|
||||||
override val psi = unwrap<UField, PsiField>(psi)
|
override val psi = unwrap<UField, PsiField>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractJavaUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractJavaUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class JavaULocalVariable(
|
open class JavaULocalVariable(
|
||||||
@@ -77,6 +101,14 @@ open class JavaULocalVariable(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : AbstractJavaUVariable(), ULocalVariable, PsiLocalVariable by psi {
|
) : AbstractJavaUVariable(), ULocalVariable, PsiLocalVariable by psi {
|
||||||
override val psi = unwrap<ULocalVariable, PsiLocalVariable>(psi)
|
override val psi = unwrap<ULocalVariable, PsiLocalVariable>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractJavaUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractJavaUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class JavaUEnumConstant(
|
open class JavaUEnumConstant(
|
||||||
@@ -85,6 +117,14 @@ open class JavaUEnumConstant(
|
|||||||
) : AbstractJavaUVariable(), UEnumConstant, PsiEnumConstant by psi {
|
) : AbstractJavaUVariable(), UEnumConstant, PsiEnumConstant by psi {
|
||||||
override val psi = unwrap<UEnumConstant, PsiEnumConstant>(psi)
|
override val psi = unwrap<UEnumConstant, PsiEnumConstant>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractJavaUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractJavaUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
override val kind: UastCallKind
|
override val kind: UastCallKind
|
||||||
get() = UastCallKind.CONSTRUCTOR_CALL
|
get() = UastCallKind.CONSTRUCTOR_CALL
|
||||||
override val receiver: UExpression?
|
override val receiver: UExpression?
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.uast.kotlin
|
|||||||
|
|
||||||
import com.intellij.psi.PsiAnonymousClass
|
import com.intellij.psi.PsiAnonymousClass
|
||||||
import com.intellij.psi.PsiClass
|
import com.intellij.psi.PsiClass
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
import org.jetbrains.kotlin.asJava.classes.KtLightClass
|
import org.jetbrains.kotlin.asJava.classes.KtLightClass
|
||||||
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
|
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
|
||||||
import org.jetbrains.kotlin.asJava.toLightMethods
|
import org.jetbrains.kotlin.asJava.toLightMethods
|
||||||
@@ -33,6 +34,10 @@ class KotlinUClass private constructor(
|
|||||||
val ktClass = psi.kotlinOrigin
|
val ktClass = psi.kotlinOrigin
|
||||||
override val psi = unwrap<UClass, PsiClass>(psi)
|
override val psi = unwrap<UClass, PsiClass>(psi)
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
override val uastAnchor: UElement
|
override val uastAnchor: UElement
|
||||||
get() = UIdentifier(psi.nameIdentifier, this)
|
get() = UIdentifier(psi.nameIdentifier, this)
|
||||||
|
|
||||||
@@ -86,6 +91,10 @@ class KotlinUAnonymousClass(
|
|||||||
) : AbstractJavaUClass(), UAnonymousClass, PsiAnonymousClass by psi {
|
) : AbstractJavaUClass(), UAnonymousClass, PsiAnonymousClass by psi {
|
||||||
override val psi: PsiAnonymousClass = unwrap<UAnonymousClass, PsiAnonymousClass>(psi)
|
override val psi: PsiAnonymousClass = unwrap<UAnonymousClass, PsiAnonymousClass>(psi)
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractJavaUClass>.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
override val uastAnchor: UElement?
|
override val uastAnchor: UElement?
|
||||||
get() {
|
get() {
|
||||||
val ktClassOrObject = (psi.originalElement as? KtLightClass)?.kotlinOrigin as? KtObjectDeclaration ?: return null
|
val ktClassOrObject = (psi.originalElement as? KtLightClass)?.kotlinOrigin as? KtObjectDeclaration ?: return null
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.uast.kotlin.declarations
|
package org.jetbrains.uast.kotlin.declarations
|
||||||
|
|
||||||
|
import com.intellij.psi.PsiCodeBlock
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiMethod
|
import com.intellij.psi.PsiMethod
|
||||||
import com.intellij.psi.PsiNameIdentifierOwner
|
import com.intellij.psi.PsiNameIdentifierOwner
|
||||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||||
@@ -38,6 +40,7 @@ open class KotlinUMethod(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : UMethod, JavaUElementWithComments, PsiMethod by psi {
|
) : UMethod, JavaUElementWithComments, PsiMethod by psi {
|
||||||
override val psi: KtLightMethod = unwrap<UMethod, KtLightMethod>(psi)
|
override val psi: KtLightMethod = unwrap<UMethod, KtLightMethod>(psi)
|
||||||
|
|
||||||
private val kotlinOrigin = (psi.originalElement as KtLightElement<*, *>).kotlinOrigin
|
private val kotlinOrigin = (psi.originalElement as KtLightElement<*, *>).kotlinOrigin
|
||||||
|
|
||||||
override val annotations by lz { psi.annotations.map { JavaUAnnotation(it, this) } }
|
override val annotations by lz { psi.annotations.map { JavaUAnnotation(it, this) } }
|
||||||
@@ -58,6 +61,10 @@ open class KotlinUMethod(
|
|||||||
override val isOverride: Boolean
|
override val isOverride: Boolean
|
||||||
get() = (kotlinOrigin as? KtCallableDeclaration)?.hasModifier(KtTokens.OVERRIDE_KEYWORD) ?: false
|
get() = (kotlinOrigin as? KtCallableDeclaration)?.hasModifier(KtTokens.OVERRIDE_KEYWORD) ?: false
|
||||||
|
|
||||||
|
override fun getBody(): PsiCodeBlock? = super.getBody()
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? = super.getOriginalElement()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun create(psi: KtLightMethod, containingElement: UElement?) = when (psi) {
|
fun create(psi: KtLightMethod, containingElement: UElement?) = when (psi) {
|
||||||
is KtLightMethodImpl.KtLightAnnotationMethod -> KotlinUAnnotationMethod(psi, containingElement)
|
is KtLightMethodImpl.KtLightAnnotationMethod -> KotlinUAnnotationMethod(psi, containingElement)
|
||||||
|
|||||||
@@ -58,6 +58,14 @@ class KotlinUVariable(
|
|||||||
) : AbstractKotlinUVariable(), UVariable, PsiVariable by psi {
|
) : AbstractKotlinUVariable(), UVariable, PsiVariable by psi {
|
||||||
override val psi = unwrap<UVariable, PsiVariable>(psi)
|
override val psi = unwrap<UVariable, PsiVariable>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractKotlinUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractKotlinUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
override val annotations by lz { psi.annotations.map { JavaUAnnotation(it, this) } }
|
override val annotations by lz { psi.annotations.map { JavaUAnnotation(it, this) } }
|
||||||
override val typeReference by lz { getLanguagePlugin().convertOpt<UTypeReferenceExpression>(psi.typeElement, this) }
|
override val typeReference by lz { getLanguagePlugin().convertOpt<UTypeReferenceExpression>(psi.typeElement, this) }
|
||||||
|
|
||||||
@@ -79,6 +87,15 @@ open class KotlinUParameter(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : AbstractKotlinUVariable(), UParameter, PsiParameter by psi {
|
) : AbstractKotlinUVariable(), UParameter, PsiParameter by psi {
|
||||||
override val psi = unwrap<UParameter, PsiParameter>(psi)
|
override val psi = unwrap<UParameter, PsiParameter>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractKotlinUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractKotlinUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open class KotlinUField(
|
open class KotlinUField(
|
||||||
@@ -86,6 +103,15 @@ open class KotlinUField(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : AbstractKotlinUVariable(), UField, PsiField by psi {
|
) : AbstractKotlinUVariable(), UField, PsiField by psi {
|
||||||
override val psi = unwrap<UField, PsiField>(psi)
|
override val psi = unwrap<UField, PsiField>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractKotlinUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractKotlinUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open class KotlinULocalVariable(
|
open class KotlinULocalVariable(
|
||||||
@@ -93,6 +119,15 @@ open class KotlinULocalVariable(
|
|||||||
override val containingElement: UElement?
|
override val containingElement: UElement?
|
||||||
) : AbstractKotlinUVariable(), ULocalVariable, PsiLocalVariable by psi {
|
) : AbstractKotlinUVariable(), ULocalVariable, PsiLocalVariable by psi {
|
||||||
override val psi = unwrap<ULocalVariable, PsiLocalVariable>(psi)
|
override val psi = unwrap<ULocalVariable, PsiLocalVariable>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractKotlinUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractKotlinUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open class KotlinUEnumConstant(
|
open class KotlinUEnumConstant(
|
||||||
@@ -101,6 +136,14 @@ open class KotlinUEnumConstant(
|
|||||||
) : AbstractKotlinUVariable(), UEnumConstant, PsiEnumConstant by psi {
|
) : AbstractKotlinUVariable(), UEnumConstant, PsiEnumConstant by psi {
|
||||||
override val psi = unwrap<UEnumConstant, PsiEnumConstant>(psi)
|
override val psi = unwrap<UEnumConstant, PsiEnumConstant>(psi)
|
||||||
|
|
||||||
|
override fun getInitializer(): PsiExpression? {
|
||||||
|
return super<AbstractKotlinUVariable>.getInitializer()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getOriginalElement(): PsiElement? {
|
||||||
|
return super<AbstractKotlinUVariable>.getOriginalElement()
|
||||||
|
}
|
||||||
|
|
||||||
override val kind: UastCallKind
|
override val kind: UastCallKind
|
||||||
get() = UastCallKind.CONSTRUCTOR_CALL
|
get() = UastCallKind.CONSTRUCTOR_CALL
|
||||||
override val receiver: UExpression?
|
override val receiver: UExpression?
|
||||||
|
|||||||
Reference in New Issue
Block a user