Java To Kotlin: KtLightModifierList

This commit is contained in:
Alexey Sedunov
2016-03-01 16:31:56 +03:00
parent 19850ffb86
commit 4debf0cc45
2 changed files with 18 additions and 38 deletions
@@ -263,9 +263,8 @@ open class KtLightClassForExplicitDeclaration(
private val _modifierList : PsiModifierList by lazy { private val _modifierList : PsiModifierList by lazy {
object : KtLightModifierList(this.manager, computeModifiers()) { object : KtLightModifierList(this.manager, computeModifiers()) {
override fun getDelegate(): PsiModifierList { override val delegate: PsiAnnotationOwner
return this@KtLightClassForExplicitDeclaration.getDelegate().modifierList!! get() = this@KtLightClassForExplicitDeclaration.getDelegate().modifierList!!
}
} }
} }
@@ -14,45 +14,26 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.kotlin.asJava; package org.jetbrains.kotlin.asJava
import com.intellij.psi.PsiAnnotation; import com.intellij.psi.PsiAnnotation
import com.intellij.psi.PsiAnnotationOwner; import com.intellij.psi.PsiAnnotationOwner
import com.intellij.psi.PsiManager; import com.intellij.psi.PsiManager
import com.intellij.psi.impl.light.LightModifierList; import com.intellij.psi.impl.light.LightModifierList
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.idea.KotlinLanguage;
public abstract class KtLightModifierList extends LightModifierList { abstract class KtLightModifierList(
public KtLightModifierList(PsiManager psiManager, @NotNull String[] modifiers) { psiManager: PsiManager,
super(psiManager, KotlinLanguage.INSTANCE, modifiers); modifiers: Array<String>
} ) : LightModifierList(psiManager, KotlinLanguage.INSTANCE, *modifiers) {
abstract val delegate: PsiAnnotationOwner
public abstract PsiAnnotationOwner getDelegate(); override fun getAnnotations() = delegate.annotations
@Override override fun getApplicableAnnotations() = delegate.applicableAnnotations
@NotNull
public PsiAnnotation[] getAnnotations() {
return getDelegate().getAnnotations();
}
@Override override fun findAnnotation(@NonNls qualifiedName: String) = delegate.findAnnotation(qualifiedName)
@NotNull
public PsiAnnotation[] getApplicableAnnotations() {
return getDelegate().getApplicableAnnotations();
}
@Override override fun addAnnotation(@NonNls qualifiedName: String) = delegate.addAnnotation(qualifiedName)
@Nullable
public PsiAnnotation findAnnotation(@NotNull @NonNls String qualifiedName) {
return getDelegate().findAnnotation(qualifiedName);
}
@Override
@NotNull
public PsiAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) {
return getDelegate().addAnnotation(qualifiedName);
}
} }