Light Methods: Change PSI element language to Kotlin
This commit is contained in:
+8
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.asJava;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -27,6 +28,7 @@ import org.jetbrains.jet.lang.psi.JetClassOrObject;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.java.jetAsJava.JetJavaMirrorMarker;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
/**
|
||||
* This class serves as a workaround for usages of {@link JavaElementFinder#findClasses} which eventually only need names of files
|
||||
@@ -88,4 +90,10 @@ public class FakeLightClassForFileOfPackage extends AbstractLightClass implement
|
||||
public String getText() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return JetLanguage.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.asJava;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
@@ -27,6 +28,7 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.psi.JetDeclaration;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
// Copied from com.intellij.psi.impl.light.LightField
|
||||
public abstract class KotlinLightField<T extends JetDeclaration, D extends PsiField> extends LightElement
|
||||
@@ -166,4 +168,10 @@ public abstract class KotlinLightField<T extends JetDeclaration, D extends PsiFi
|
||||
public PsiElement getNavigationElement() {
|
||||
return getOrigin();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return JetLanguage.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -31,6 +31,7 @@ import org.jetbrains.jet.lang.psi.JetProperty
|
||||
import org.jetbrains.jet.lang.psi.JetClassOrObject
|
||||
import com.intellij.psi.impl.light.LightTypeParameterListBuilder
|
||||
import com.intellij.psi.search.SearchScope
|
||||
import com.intellij.lang.Language
|
||||
|
||||
open public class KotlinLightMethodForDeclaration(
|
||||
manager: PsiManager,
|
||||
@@ -103,6 +104,8 @@ open public class KotlinLightMethodForDeclaration(
|
||||
|
||||
override fun getUseScope(): SearchScope = origin.getUseScope()
|
||||
|
||||
override fun getLanguage(): Language = JetLanguage.INSTANCE
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is KotlinLightMethodForDeclaration &&
|
||||
getName() == other.getName() &&
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.asJava;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.psi.PsiAnnotationOwner;
|
||||
import com.intellij.psi.PsiModifierList;
|
||||
import com.intellij.psi.PsiParameter;
|
||||
@@ -98,4 +99,10 @@ public class KotlinLightParameter extends LightParameter implements KotlinLightE
|
||||
|
||||
return setter != null ? setter.getParameter() : null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return JetLanguage.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.asJava;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.light.AbstractLightClass;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -127,4 +128,10 @@ public class KotlinLightTypeParameter
|
||||
public PsiElement getNavigationElement() {
|
||||
return getOrigin();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return JetLanguage.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import kotlin.KotlinPackage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -171,6 +172,12 @@ public abstract class KotlinWrappingLightClass extends AbstractLightClass implem
|
||||
return origin == null ? null : origin.getText();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return JetLanguage.INSTANCE;
|
||||
}
|
||||
|
||||
private boolean isTraitFakeOverride(@NotNull JetDeclaration originMethodDeclaration) {
|
||||
if (!(originMethodDeclaration instanceof JetNamedFunction ||
|
||||
originMethodDeclaration instanceof JetPropertyAccessor ||
|
||||
|
||||
Reference in New Issue
Block a user