rename "Jet" from names of IDE classes; consistently use Kt prefix for PSI elements and classes directly related to specific PSI elements
This commit is contained in:
+5
-5
@@ -25,8 +25,8 @@ import com.intellij.util.Function
|
||||
import com.intellij.util.SmartList
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightClassForExplicitDeclaration
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightClassForFacade
|
||||
import org.jetbrains.kotlin.asJava.KtLightClassForExplicitDeclaration
|
||||
import org.jetbrains.kotlin.asJava.KtLightClassForFacade
|
||||
import org.jetbrains.kotlin.asJava.LightClassConstructionContext
|
||||
import org.jetbrains.kotlin.asJava.LightClassGenerationSupport
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
@@ -139,7 +139,7 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
}
|
||||
|
||||
override fun getPsiClass(classOrObject: KtClassOrObject): PsiClass? {
|
||||
return KotlinLightClassForExplicitDeclaration.create(psiManager, classOrObject)
|
||||
return KtLightClassForExplicitDeclaration.create(psiManager, classOrObject)
|
||||
}
|
||||
|
||||
override fun resolveClassToDescriptor(classOrObject: KtClassOrObject): ClassDescriptor? {
|
||||
@@ -151,7 +151,7 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
if (filesForFacade.isEmpty()) return emptyList()
|
||||
|
||||
return emptyOrSingletonList<PsiClass>(
|
||||
KotlinLightClassForFacade.createForFacade(psiManager, facadeFqName, scope, filesForFacade))
|
||||
KtLightClassForFacade.createForFacade(psiManager, facadeFqName, scope, filesForFacade))
|
||||
}
|
||||
|
||||
override fun findFilesForFacade(facadeFqName: FqName, scope: GlobalSearchScope): Collection<KtFile> {
|
||||
@@ -216,7 +216,7 @@ public class CliLightClassGenerationSupport(project: Project) : LightClassGenera
|
||||
override fun getFacadeClassesInPackage(packageFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> {
|
||||
return PackagePartClassUtils.getFilesWithCallables(findFilesForPackage(packageFqName, scope)).groupBy {
|
||||
JvmFileClassUtil.getFileClassInfoNoResolve(it).facadeClassFqName
|
||||
}.map { KotlinLightClassForFacade.createForFacade(psiManager, it.key, scope, it.value) }.filterNotNull()
|
||||
}.map { KtLightClassForFacade.createForFacade(psiManager, it.key, scope, it.value) }.filterNotNull()
|
||||
}
|
||||
|
||||
override fun getFacadeNames(packageFqName: FqName, scope: GlobalSearchScope): Collection<String> {
|
||||
|
||||
@@ -50,7 +50,7 @@ import com.intellij.psi.stubs.BinaryFileStubBuilders
|
||||
import com.intellij.psi.util.JavaClassSupers
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.kotlin.asJava.JavaElementFinder
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightClassForFacade
|
||||
import org.jetbrains.kotlin.asJava.KtLightClassForFacade
|
||||
import org.jetbrains.kotlin.asJava.LightClassGenerationSupport
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.CliModuleVisibilityManagerImpl
|
||||
@@ -370,7 +370,7 @@ public class KotlinCoreEnvironment private constructor(
|
||||
with (projectEnvironment.getProject()) {
|
||||
registerService(javaClass<JetScriptDefinitionProvider>(), JetScriptDefinitionProvider())
|
||||
registerService(javaClass<KotlinJavaPsiFacade>(), KotlinJavaPsiFacade(this))
|
||||
registerService(javaClass<KotlinLightClassForFacade.FacadeStubCache>(), KotlinLightClassForFacade.FacadeStubCache(this))
|
||||
registerService(javaClass<KtLightClassForFacade.FacadeStubCache>(), KtLightClassForFacade.FacadeStubCache(this))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ open class FakeFileForLightClass(
|
||||
private val packageFqName: FqName,
|
||||
virtualFile: VirtualFile,
|
||||
psiManager: PsiManager,
|
||||
private val lightClass: KotlinLightClass,
|
||||
private val lightClass: KtLightClass,
|
||||
private val stub: () -> PsiClassHolderFileStub<*>
|
||||
) : ClsFileImpl(ClassFileViewProvider(psiManager, virtualFile)) {
|
||||
override fun getPackageName() = packageFqName.asString()
|
||||
|
||||
+4
-4
@@ -32,17 +32,17 @@ import org.jetbrains.kotlin.psi.KtFile;
|
||||
/**
|
||||
* This class serves as a workaround for usages of {@link JavaElementFinder#findClasses} which eventually only need names of files
|
||||
* containing the class. When queried for a package class (e.g. test/TestPackage), {@code findClasses} along with a
|
||||
* {@link KotlinLightClassForFacade} would also return multiple instances of this class for each file present in the package. The client
|
||||
* {@link KtLightClassForFacade} would also return multiple instances of this class for each file present in the package. The client
|
||||
* code can make use of every file in the package then, since {@code getContainingFile} of these instances will represent the whole package.
|
||||
* <p/>
|
||||
* See {@link LineBreakpoint#findClassCandidatesInSourceContent} for the primary usage this was introduced
|
||||
*/
|
||||
public class FakeLightClassForFileOfPackage extends AbstractLightClass implements KotlinLightClass, JetJavaMirrorMarker {
|
||||
private final KotlinLightClassForFacade delegate;
|
||||
public class FakeLightClassForFileOfPackage extends AbstractLightClass implements KtLightClass, JetJavaMirrorMarker {
|
||||
private final KtLightClassForFacade delegate;
|
||||
private final KtFile file;
|
||||
|
||||
public FakeLightClassForFileOfPackage(
|
||||
@NotNull PsiManager manager, @NotNull KotlinLightClassForFacade delegate, @NotNull KtFile file
|
||||
@NotNull PsiManager manager, @NotNull KtLightClassForFacade delegate, @NotNull KtFile file
|
||||
) {
|
||||
super(manager);
|
||||
this.delegate = delegate;
|
||||
|
||||
@@ -189,7 +189,7 @@ public class JavaElementFinder extends PsiElementFinder implements KotlinFinderM
|
||||
// allScope() because the contract says that the whole project
|
||||
GlobalSearchScope allScope = GlobalSearchScope.allScope(project);
|
||||
if (lightClassGenerationSupport.packageExists(fqName, allScope)) {
|
||||
return new KotlinLightPackage(psiManager, fqName, allScope);
|
||||
return new KtLightPackage(psiManager, fqName, allScope);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -205,7 +205,7 @@ public class JavaElementFinder extends PsiElementFinder implements KotlinFinderM
|
||||
Collection<PsiPackage> answer = Collections2.transform(subpackages, new Function<FqName, PsiPackage>() {
|
||||
@Override
|
||||
public PsiPackage apply(@Nullable FqName input) {
|
||||
return new KotlinLightPackage(psiManager, input, scope);
|
||||
return new KtLightPackage(psiManager, input, scope);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -20,6 +20,6 @@ import com.intellij.psi.PsiClass;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
|
||||
public interface KotlinLightClass : PsiClass, KotlinLightElement<KtClassOrObject, PsiClass> {
|
||||
public interface KtLightClass : PsiClass, KtLightElement<KtClassOrObject, PsiClass> {
|
||||
public fun getFqName(): FqName
|
||||
}
|
||||
+3
-3
@@ -32,12 +32,12 @@ import org.jetbrains.kotlin.types.KotlinType;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
class KotlinLightClassForAnonymousDeclaration extends KotlinLightClassForExplicitDeclaration implements PsiAnonymousClass {
|
||||
private static final Logger LOG = Logger.getInstance(KotlinLightClassForAnonymousDeclaration.class);
|
||||
class KtLightClassForAnonymousDeclaration extends KtLightClassForExplicitDeclaration implements PsiAnonymousClass {
|
||||
private static final Logger LOG = Logger.getInstance(KtLightClassForAnonymousDeclaration.class);
|
||||
|
||||
private SoftReference<PsiClassType> cachedBaseType = null;
|
||||
|
||||
KotlinLightClassForAnonymousDeclaration(@NotNull PsiManager manager, @NotNull FqName name, @NotNull KtClassOrObject classOrObject) {
|
||||
KtLightClassForAnonymousDeclaration(@NotNull PsiManager manager, @NotNull FqName name, @NotNull KtClassOrObject classOrObject) {
|
||||
super(manager, name, classOrObject);
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,11 +22,11 @@ import org.jetbrains.kotlin.psi.KtEnumEntry
|
||||
import com.intellij.psi.PsiEnumConstantInitializer
|
||||
import com.intellij.psi.PsiEnumConstant
|
||||
|
||||
internal class KotlinLightClassForEnumEntry(
|
||||
internal class KtLightClassForEnumEntry(
|
||||
psiManager: PsiManager,
|
||||
fqName: FqName,
|
||||
enumEntry: KtEnumEntry,
|
||||
private val enumConstant: PsiEnumConstant
|
||||
): KotlinLightClassForAnonymousDeclaration(psiManager, fqName, enumEntry), PsiEnumConstantInitializer {
|
||||
): KtLightClassForAnonymousDeclaration(psiManager, fqName, enumEntry), PsiEnumConstantInitializer {
|
||||
override fun getEnumConstant(): PsiEnumConstant = enumConstant
|
||||
}
|
||||
+15
-15
@@ -47,11 +47,11 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import javax.swing.Icon
|
||||
|
||||
public open class KotlinLightClassForExplicitDeclaration(
|
||||
public open class KtLightClassForExplicitDeclaration(
|
||||
manager: PsiManager,
|
||||
protected val classFqName: FqName, // FqName of (possibly inner) class
|
||||
protected val classOrObject: KtClassOrObject)
|
||||
: KotlinWrappingLightClass(manager), JetJavaMirrorMarker, StubBasedPsiElement<KotlinClassOrObjectStub<out KtClassOrObject>> {
|
||||
: KtWrappingLightClass(manager), JetJavaMirrorMarker, StubBasedPsiElement<KotlinClassOrObjectStub<out KtClassOrObject>> {
|
||||
private var delegate: PsiClass? = null
|
||||
|
||||
private fun getLocalClassParent(): PsiElement? {
|
||||
@@ -64,8 +64,8 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
|
||||
var createWrapper = forceMethodWrapping
|
||||
// Use PsiClass wrapper instead of package light class to avoid names like "FooPackage" in Type Hierarchy and related views
|
||||
if (containingClass is KotlinLightClassForFacade) {
|
||||
containingClass = object : LightClass(containingClass as KotlinLightClassForFacade, KotlinLanguage.INSTANCE) {
|
||||
if (containingClass is KtLightClassForFacade) {
|
||||
containingClass = object : LightClass(containingClass as KtLightClassForFacade, KotlinLanguage.INSTANCE) {
|
||||
override fun getName(): String? {
|
||||
return currentFileName
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
override fun getFqName(): FqName = classFqName
|
||||
|
||||
override fun copy(): PsiElement {
|
||||
return KotlinLightClassForExplicitDeclaration(manager, classFqName, classOrObject.copy() as KtClassOrObject)
|
||||
return KtLightClassForExplicitDeclaration(manager, classFqName, classOrObject.copy() as KtClassOrObject)
|
||||
}
|
||||
|
||||
override fun getDelegate(): PsiClass {
|
||||
@@ -216,7 +216,7 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
if (this === o) return true
|
||||
if (o == null || javaClass != o.javaClass) return false
|
||||
|
||||
val aClass = o as KotlinLightClassForExplicitDeclaration
|
||||
val aClass = o as KtLightClassForExplicitDeclaration
|
||||
|
||||
if (classFqName != aClass.classFqName) return false
|
||||
|
||||
@@ -245,9 +245,9 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
override fun getQualifiedName(): String = classFqName.asString()
|
||||
|
||||
private val _modifierList : PsiModifierList by lazy {
|
||||
object : KotlinLightModifierList(this.manager, computeModifiers()) {
|
||||
object : KtLightModifierList(this.manager, computeModifiers()) {
|
||||
override fun getDelegate(): PsiModifierList {
|
||||
return this@KotlinLightClassForExplicitDeclaration.getDelegate().modifierList!!
|
||||
return this@KtLightClassForExplicitDeclaration.getDelegate().modifierList!!
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
|
||||
override fun isInheritor(baseClass: PsiClass, checkDeep: Boolean): Boolean {
|
||||
val qualifiedName: String?
|
||||
if (baseClass is KotlinLightClassForExplicitDeclaration) {
|
||||
if (baseClass is KtLightClassForExplicitDeclaration) {
|
||||
val baseDescriptor = baseClass.getDescriptor()
|
||||
qualifiedName = if (baseDescriptor != null) DescriptorUtils.getFqName(baseDescriptor).asString() else null
|
||||
}
|
||||
@@ -353,10 +353,10 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
|
||||
override fun toString(): String {
|
||||
try {
|
||||
return javaClass<KotlinLightClass>().simpleName + ":" + qualifiedName
|
||||
return javaClass<KtLightClass>().simpleName + ":" + qualifiedName
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return javaClass<KotlinLightClass>().simpleName + ":" + e.toString()
|
||||
return javaClass<KtLightClass>().simpleName + ":" + e.toString()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -390,7 +390,7 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
manager: PsiManager,
|
||||
classOrObject: KtClassOrObject,
|
||||
psiClass: PsiClass? = null
|
||||
): KotlinLightClassForExplicitDeclaration? {
|
||||
): KtLightClassForExplicitDeclaration? {
|
||||
if (LightClassUtil.belongsToKotlinBuiltIns(classOrObject.getContainingJetFile())) {
|
||||
return null
|
||||
}
|
||||
@@ -398,17 +398,17 @@ public open class KotlinLightClassForExplicitDeclaration(
|
||||
val fqName = predictFqName(classOrObject) ?: return null
|
||||
|
||||
if (classOrObject is KtObjectDeclaration && classOrObject.isObjectLiteral()) {
|
||||
return KotlinLightClassForAnonymousDeclaration(manager, fqName, classOrObject)
|
||||
return KtLightClassForAnonymousDeclaration(manager, fqName, classOrObject)
|
||||
}
|
||||
|
||||
if (classOrObject.hasInterfaceDefaultImpls) {
|
||||
val implsFqName = fqName.defaultImplsChild()
|
||||
if (implsFqName.asString() == psiClass?.qualifiedName) {
|
||||
return KotlinLightClassForInterfaceDefaultImpls(manager, implsFqName, classOrObject)
|
||||
return KtLightClassForInterfaceDefaultImpls(manager, implsFqName, classOrObject)
|
||||
}
|
||||
}
|
||||
|
||||
return KotlinLightClassForExplicitDeclaration(manager, fqName, classOrObject)
|
||||
return KtLightClassForExplicitDeclaration(manager, fqName, classOrObject)
|
||||
}
|
||||
|
||||
private fun predictFqName(classOrObject: KtClassOrObject): FqName? {
|
||||
+13
-13
@@ -35,14 +35,14 @@ import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import javax.swing.Icon
|
||||
|
||||
public class KotlinLightClassForFacade private constructor(
|
||||
public class KtLightClassForFacade private constructor(
|
||||
manager: PsiManager,
|
||||
private val facadeClassFqName: FqName,
|
||||
private val searchScope: GlobalSearchScope,
|
||||
private val lightClassDataCache: CachedValue<KotlinFacadeLightClassData>,
|
||||
files: Collection<KtFile>,
|
||||
private val deprecated: Boolean
|
||||
) : KotlinWrappingLightClass(manager), JetJavaMirrorMarker {
|
||||
) : KtWrappingLightClass(manager), JetJavaMirrorMarker {
|
||||
|
||||
private data class StubCacheKey(val fqName: FqName, val searchScope: GlobalSearchScope)
|
||||
|
||||
@@ -124,19 +124,19 @@ public class KotlinLightClassForFacade private constructor(
|
||||
override fun getImplementsListTypes() = PsiClassType.EMPTY_ARRAY
|
||||
|
||||
// TODO: Find a way to return just Object
|
||||
override fun getExtendsList() = super<KotlinWrappingLightClass>.getExtendsList()
|
||||
override fun getExtendsList() = super<KtWrappingLightClass>.getExtendsList()
|
||||
|
||||
// TODO see getExtendsList()
|
||||
override fun getExtendsListTypes() = super<KotlinWrappingLightClass>.getExtendsListTypes()
|
||||
override fun getExtendsListTypes() = super<KtWrappingLightClass>.getExtendsListTypes()
|
||||
|
||||
// TODO see getExtendsList()
|
||||
override fun getSuperClass(): PsiClass? = super<KotlinWrappingLightClass>.getSuperClass()
|
||||
override fun getSuperClass(): PsiClass? = super<KtWrappingLightClass>.getSuperClass()
|
||||
|
||||
// TODO see getExtendsList()
|
||||
override fun getSupers(): Array<PsiClass> = super<KotlinWrappingLightClass>.getSupers()
|
||||
override fun getSupers(): Array<PsiClass> = super<KtWrappingLightClass>.getSupers()
|
||||
|
||||
// TODO see getExtendsList()
|
||||
override fun getSuperTypes() = super<KotlinWrappingLightClass>.getSuperTypes()
|
||||
override fun getSuperTypes() = super<KtWrappingLightClass>.getSuperTypes()
|
||||
|
||||
override fun getInterfaces() = PsiClass.EMPTY_ARRAY
|
||||
|
||||
@@ -158,7 +158,7 @@ public class KotlinLightClassForFacade private constructor(
|
||||
|
||||
override fun isValid() = files.all { it.isValid() }
|
||||
|
||||
override fun copy() = KotlinLightClassForFacade(getManager(), facadeClassFqName, searchScope, lightClassDataCache, files, deprecated)
|
||||
override fun copy() = KtLightClassForFacade(getManager(), facadeClassFqName, searchScope, lightClassDataCache, files, deprecated)
|
||||
|
||||
override fun getDelegate(): PsiClass {
|
||||
val psiClass = LightClassUtil.findClass(facadeClassFqName, lightClassDataCache.value.javaFileStub)
|
||||
@@ -188,7 +188,7 @@ public class KotlinLightClassForFacade private constructor(
|
||||
return false
|
||||
}
|
||||
|
||||
val lightClass = other as KotlinLightClassForFacade
|
||||
val lightClass = other as KtLightClassForFacade
|
||||
if (this === other) return true
|
||||
|
||||
if (this.hashCode != lightClass.hashCode) return false
|
||||
@@ -201,10 +201,10 @@ public class KotlinLightClassForFacade private constructor(
|
||||
|
||||
override fun toString(): String {
|
||||
try {
|
||||
return javaClass<KotlinLightClassForFacade>().getSimpleName() + ":" + getQualifiedName()
|
||||
return javaClass<KtLightClassForFacade>().getSimpleName() + ":" + getQualifiedName()
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return javaClass<KotlinLightClassForFacade>().getSimpleName() + ":" + e.toString()
|
||||
return javaClass<KtLightClassForFacade>().getSimpleName() + ":" + e.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public class KotlinLightClassForFacade private constructor(
|
||||
facadeClassFqName: FqName,
|
||||
searchScope: GlobalSearchScope,
|
||||
files: Collection<KtFile>
|
||||
): KotlinLightClassForFacade? {
|
||||
): KtLightClassForFacade? {
|
||||
if (files.any { LightClassUtil.belongsToKotlinBuiltIns(it) }) {
|
||||
return null
|
||||
}
|
||||
@@ -222,7 +222,7 @@ public class KotlinLightClassForFacade private constructor(
|
||||
assert(files.isNotEmpty()) { "No files for facade $facadeClassFqName" }
|
||||
|
||||
val lightClassDataCache = FacadeStubCache.getInstance(manager.project).get(facadeClassFqName, searchScope)
|
||||
return KotlinLightClassForFacade(manager, facadeClassFqName, searchScope, lightClassDataCache, files, false)
|
||||
return KtLightClassForFacade(manager, facadeClassFqName, searchScope, lightClassDataCache, files, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -21,14 +21,14 @@ import com.intellij.util.IncorrectOperationException
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
|
||||
public open class KotlinLightClassForInterfaceDefaultImpls(
|
||||
public open class KtLightClassForInterfaceDefaultImpls(
|
||||
manager: PsiManager,
|
||||
classFqName: FqName,
|
||||
classOrObject: KtClassOrObject)
|
||||
: KotlinLightClassForExplicitDeclaration(manager, classFqName, classOrObject){
|
||||
: KtLightClassForExplicitDeclaration(manager, classFqName, classOrObject){
|
||||
|
||||
override fun copy(): PsiElement {
|
||||
return KotlinLightClassForInterfaceDefaultImpls(manager, classFqName, classOrObject.copy() as KtClassOrObject)
|
||||
return KtLightClassForInterfaceDefaultImpls(manager, classFqName, classOrObject.copy() as KtClassOrObject)
|
||||
}
|
||||
|
||||
override fun getTypeParameterList(): PsiTypeParameterList? = null
|
||||
+1
-1
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiNamedElement
|
||||
|
||||
public interface KotlinLightElement<T : KtDeclaration, D : PsiElement> : PsiNamedElement {
|
||||
public interface KtLightElement<T : KtDeclaration, D : PsiElement> : PsiNamedElement {
|
||||
public fun getOrigin(): T?
|
||||
|
||||
public fun getDelegate(): D
|
||||
+14
-14
@@ -26,14 +26,14 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtEnumEntry
|
||||
|
||||
public interface KotlinLightField : PsiField, KotlinLightElement<KtDeclaration, PsiField>
|
||||
public interface KtLightField : PsiField, KtLightElement<KtDeclaration, PsiField>
|
||||
|
||||
// Copied from com.intellij.psi.impl.light.LightField
|
||||
sealed class KotlinLightFieldImpl(
|
||||
sealed class KtLightFieldImpl(
|
||||
private val origin: KtDeclaration?,
|
||||
private val delegate: PsiField,
|
||||
private val containingClass: KotlinLightClass
|
||||
) : LightElement(delegate.manager, KotlinLanguage.INSTANCE), KotlinLightField {
|
||||
private val containingClass: KtLightClass
|
||||
) : LightElement(delegate.manager, KotlinLanguage.INSTANCE), KtLightField {
|
||||
@Throws(IncorrectOperationException::class)
|
||||
override fun setInitializer(initializer: PsiExpression?) = throw IncorrectOperationException("Not supported")
|
||||
|
||||
@@ -84,7 +84,7 @@ sealed class KotlinLightFieldImpl(
|
||||
override fun getNavigationElement() = origin ?: super.getNavigationElement()
|
||||
|
||||
override fun isEquivalentTo(another: PsiElement?): Boolean {
|
||||
if (another is KotlinLightField && origin == another.getOrigin() && delegate == another.getDelegate()) {
|
||||
if (another is KtLightField && origin == another.getOrigin() && delegate == another.getDelegate()) {
|
||||
return true
|
||||
}
|
||||
return super.isEquivalentTo(another)
|
||||
@@ -94,12 +94,12 @@ sealed class KotlinLightFieldImpl(
|
||||
|
||||
override fun copy() = Factory.create(origin?.copy() as? KtDeclaration, delegate, containingClass)
|
||||
|
||||
class KotlinLightEnumConstant(
|
||||
class KtLightEnumConstant(
|
||||
origin: KtEnumEntry?,
|
||||
enumConstant: PsiEnumConstant,
|
||||
containingClass: KotlinLightClass,
|
||||
containingClass: KtLightClass,
|
||||
private val initializingClass: PsiEnumConstantInitializer?
|
||||
) : KotlinLightFieldImpl(origin, enumConstant, containingClass), PsiEnumConstant {
|
||||
) : KtLightFieldImpl(origin, enumConstant, containingClass), PsiEnumConstant {
|
||||
override fun getDelegate() = super.getDelegate() as PsiEnumConstant
|
||||
|
||||
// NOTE: we don't use "delegation by" because the compiler would generate method calls to ALL of PsiEnumConstant members,
|
||||
@@ -115,22 +115,22 @@ sealed class KotlinLightFieldImpl(
|
||||
override fun resolveMethodGenerics() = getDelegate().resolveMethodGenerics()
|
||||
}
|
||||
|
||||
public class KotlinLightFieldForDeclaration(origin: KtDeclaration?, delegate: PsiField, containingClass: KotlinLightClass)
|
||||
: KotlinLightFieldImpl(origin, delegate, containingClass)
|
||||
public class KtLightFieldForDeclaration(origin: KtDeclaration?, delegate: PsiField, containingClass: KtLightClass)
|
||||
: KtLightFieldImpl(origin, delegate, containingClass)
|
||||
|
||||
companion object Factory {
|
||||
fun create(origin: KtDeclaration?, delegate: PsiField, containingClass: KotlinLightClass): KotlinLightField {
|
||||
fun create(origin: KtDeclaration?, delegate: PsiField, containingClass: KtLightClass): KtLightField {
|
||||
when (delegate) {
|
||||
is PsiEnumConstant -> {
|
||||
val kotlinEnumEntry = origin as? KtEnumEntry
|
||||
val initializingClass = if (kotlinEnumEntry != null && kotlinEnumEntry.declarations.isNotEmpty()) {
|
||||
val enumConstantFqName = FqName(containingClass.getFqName().asString() + "." + kotlinEnumEntry.name)
|
||||
KotlinLightClassForEnumEntry(delegate.manager, enumConstantFqName, kotlinEnumEntry, delegate)
|
||||
KtLightClassForEnumEntry(delegate.manager, enumConstantFqName, kotlinEnumEntry, delegate)
|
||||
}
|
||||
else null
|
||||
return KotlinLightEnumConstant(kotlinEnumEntry, delegate, containingClass, initializingClass)
|
||||
return KtLightEnumConstant(kotlinEnumEntry, delegate, containingClass, initializingClass)
|
||||
}
|
||||
else -> return KotlinLightFieldForDeclaration(origin, delegate, containingClass)
|
||||
else -> return KtLightFieldForDeclaration(origin, delegate, containingClass)
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
-21
@@ -25,14 +25,14 @@ import com.intellij.util.IncorrectOperationException
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
|
||||
public interface KotlinLightMethod: PsiMethod, KotlinLightElement<KtDeclaration, PsiMethod>
|
||||
public interface KtLightMethod : PsiMethod, KtLightElement<KtDeclaration, PsiMethod>
|
||||
|
||||
sealed class KotlinLightMethodImpl(
|
||||
sealed class KtLightMethodImpl(
|
||||
private val delegate: PsiMethod,
|
||||
private val origin: KtDeclaration?,
|
||||
containingClass: KotlinLightClass
|
||||
): LightMethod(delegate.manager, delegate, containingClass), KotlinLightMethod {
|
||||
override fun getContainingClass(): KotlinLightClass = super.getContainingClass() as KotlinLightClass
|
||||
containingClass: KtLightClass
|
||||
): LightMethod(delegate.manager, delegate, containingClass), KtLightMethod {
|
||||
override fun getContainingClass(): KtLightClass = super.getContainingClass() as KtLightClass
|
||||
|
||||
private val paramsList: CachedValue<PsiParameterList> by lazy {
|
||||
val cacheManager = CachedValuesManager.getManager(delegate.project)
|
||||
@@ -40,7 +40,7 @@ sealed class KotlinLightMethodImpl(
|
||||
val parameterBuilder = LightParameterListBuilder(manager, KotlinLanguage.INSTANCE, this)
|
||||
|
||||
for ((index, parameter) in delegate.parameterList.parameters.withIndex()) {
|
||||
parameterBuilder.addParameter(KotlinLightParameter(parameter, index, this))
|
||||
parameterBuilder.addParameter(KtLightParameter(parameter, index, this))
|
||||
}
|
||||
|
||||
CachedValueProvider.Result.create(parameterBuilder, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT)
|
||||
@@ -57,7 +57,7 @@ sealed class KotlinLightMethodImpl(
|
||||
delegate.typeParameterList
|
||||
}
|
||||
else {
|
||||
LightClassUtil.buildLightTypeParameterList(this@KotlinLightMethodImpl, origin)
|
||||
LightClassUtil.buildLightTypeParameterList(this@KtLightMethodImpl, origin)
|
||||
}
|
||||
CachedValueProvider.Result.create(list, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT)
|
||||
}, false)
|
||||
@@ -123,7 +123,7 @@ sealed class KotlinLightMethodImpl(
|
||||
}
|
||||
|
||||
override fun isEquivalentTo(another: PsiElement?): Boolean {
|
||||
if (another is KotlinLightMethod && origin == another.getOrigin() && delegate == another.getDelegate()) {
|
||||
if (another is KtLightMethod && origin == another.getOrigin() && delegate == another.getDelegate()) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ sealed class KotlinLightMethodImpl(
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is KotlinLightMethod &&
|
||||
other is KtLightMethod &&
|
||||
name == other.name &&
|
||||
origin == other.getOrigin() &&
|
||||
containingClass == other.containingClass &&
|
||||
@@ -141,39 +141,39 @@ sealed class KotlinLightMethodImpl(
|
||||
|
||||
override fun toString(): String = "${this.javaClass.simpleName}:$name"
|
||||
|
||||
private class KotlinLightMethodForDeclaration(
|
||||
delegate: PsiMethod, origin: KtDeclaration?, containingClass: KotlinLightClass
|
||||
) : KotlinLightMethodImpl(delegate, origin, containingClass)
|
||||
private class KtLightMethodForDeclaration(
|
||||
delegate: PsiMethod, origin: KtDeclaration?, containingClass: KtLightClass
|
||||
) : KtLightMethodImpl(delegate, origin, containingClass)
|
||||
|
||||
private class KotlinLightAnnotationMethod(
|
||||
private class KtLightAnnotationMethod(
|
||||
delegate: PsiAnnotationMethod,
|
||||
origin: KtDeclaration?,
|
||||
containingClass: KotlinLightClass
|
||||
) : KotlinLightMethodImpl(delegate, origin, containingClass), PsiAnnotationMethod {
|
||||
containingClass: KtLightClass
|
||||
) : KtLightMethodImpl(delegate, origin, containingClass), PsiAnnotationMethod {
|
||||
override fun getDefaultValue() = getDelegate().defaultValue
|
||||
override fun getDelegate() = super.getDelegate() as PsiAnnotationMethod
|
||||
}
|
||||
|
||||
companion object Factory {
|
||||
fun create(
|
||||
delegate: PsiMethod, origin: KtDeclaration?, containingClass: KotlinLightClass
|
||||
): KotlinLightMethodImpl {
|
||||
delegate: PsiMethod, origin: KtDeclaration?, containingClass: KtLightClass
|
||||
): KtLightMethodImpl {
|
||||
return when (delegate) {
|
||||
is PsiAnnotationMethod -> KotlinLightAnnotationMethod(delegate, origin, containingClass)
|
||||
else -> KotlinLightMethodForDeclaration(delegate, origin, containingClass)
|
||||
is PsiAnnotationMethod -> KtLightAnnotationMethod(delegate, origin, containingClass)
|
||||
else -> KtLightMethodForDeclaration(delegate, origin, containingClass)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun KotlinLightMethod.isTraitFakeOverride(): Boolean {
|
||||
fun KtLightMethod.isTraitFakeOverride(): Boolean {
|
||||
val methodOrigin = this.getOrigin()
|
||||
if (!(methodOrigin is KtNamedFunction || methodOrigin is KtPropertyAccessor || methodOrigin is KtProperty)) {
|
||||
return false
|
||||
}
|
||||
|
||||
val parentOfMethodOrigin = PsiTreeUtil.getParentOfType(methodOrigin, KtClassOrObject::class.java)
|
||||
val thisClassDeclaration = (this.containingClass as KotlinLightClass).getOrigin()
|
||||
val thisClassDeclaration = (this.containingClass as KtLightClass).getOrigin()
|
||||
|
||||
// Method was generated from declaration in some other trait
|
||||
return (parentOfMethodOrigin != null && thisClassDeclaration !== parentOfMethodOrigin && KtPsiUtil.isTrait(parentOfMethodOrigin))
|
||||
+2
-2
@@ -25,8 +25,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||
|
||||
public abstract class KotlinLightModifierList extends LightModifierList {
|
||||
public KotlinLightModifierList(PsiManager psiManager, @NotNull String[] modifiers) {
|
||||
public abstract class KtLightModifierList extends LightModifierList {
|
||||
public KtLightModifierList(PsiManager psiManager, @NotNull String[] modifiers) {
|
||||
super(psiManager, KotlinLanguage.INSTANCE, modifiers);
|
||||
}
|
||||
|
||||
+3
-3
@@ -23,12 +23,12 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
|
||||
public class KotlinLightPackage extends PsiPackageImpl {
|
||||
public class KtLightPackage extends PsiPackageImpl {
|
||||
|
||||
private final FqName fqName;
|
||||
private final GlobalSearchScope scope;
|
||||
|
||||
public KotlinLightPackage(PsiManager manager, FqName qualifiedName, GlobalSearchScope scope) {
|
||||
public KtLightPackage(PsiManager manager, FqName qualifiedName, GlobalSearchScope scope) {
|
||||
super(manager, qualifiedName.asString());
|
||||
this.fqName = qualifiedName;
|
||||
this.scope = scope;
|
||||
@@ -37,7 +37,7 @@ public class KotlinLightPackage extends PsiPackageImpl {
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiElement copy() {
|
||||
return new KotlinLightPackage(getManager(), fqName, scope);
|
||||
return new KtLightPackage(getManager(), fqName, scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
+5
-5
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.psi.psiUtil.JetPsiUtilKt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class KotlinLightParameter extends LightParameter implements KotlinLightElement<KtParameter, PsiParameter> {
|
||||
public class KtLightParameter extends LightParameter implements KtLightElement<KtParameter, PsiParameter> {
|
||||
private static String getName(PsiParameter delegate, int index) {
|
||||
String name = delegate.getName();
|
||||
return name != null ? name : "p" + index;
|
||||
@@ -40,16 +40,16 @@ public class KotlinLightParameter extends LightParameter implements KotlinLightE
|
||||
private final PsiModifierList modifierList;
|
||||
private final PsiParameter delegate;
|
||||
private final int index;
|
||||
private final KotlinLightMethod method;
|
||||
private final KtLightMethod method;
|
||||
|
||||
public KotlinLightParameter(final PsiParameter delegate, int index, KotlinLightMethod method) {
|
||||
public KtLightParameter(final PsiParameter delegate, int index, KtLightMethod method) {
|
||||
super(getName(delegate, index), delegate.getType(), method, KotlinLanguage.INSTANCE);
|
||||
|
||||
this.delegate = delegate;
|
||||
this.index = index;
|
||||
this.method = method;
|
||||
|
||||
this.modifierList = new KotlinLightModifierList(method.getManager(), ArrayUtil.EMPTY_STRING_ARRAY) {
|
||||
this.modifierList = new KtLightModifierList(method.getManager(), ArrayUtil.EMPTY_STRING_ARRAY) {
|
||||
@Override
|
||||
public PsiAnnotationOwner getDelegate() {
|
||||
return delegate.getModifierList();
|
||||
@@ -132,7 +132,7 @@ public class KotlinLightParameter extends LightParameter implements KotlinLightE
|
||||
return origin != null ? origin.getUseScope() : GlobalSearchScope.EMPTY_SCOPE;
|
||||
}
|
||||
|
||||
public KotlinLightMethod getMethod() {
|
||||
public KtLightMethod getMethod() {
|
||||
return method;
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -26,13 +26,13 @@ import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||
import org.jetbrains.kotlin.psi.KtTypeParameter;
|
||||
import org.jetbrains.kotlin.psi.KtTypeParameterListOwner;
|
||||
|
||||
public class KotlinLightTypeParameter
|
||||
extends AbstractLightClass implements PsiTypeParameter, KotlinLightElement<KtTypeParameter, PsiTypeParameter> {
|
||||
public class KtLightTypeParameter
|
||||
extends AbstractLightClass implements PsiTypeParameter, KtLightElement<KtTypeParameter, PsiTypeParameter> {
|
||||
private final PsiTypeParameterListOwner owner;
|
||||
private final int index;
|
||||
private final String name;
|
||||
|
||||
protected KotlinLightTypeParameter(
|
||||
protected KtLightTypeParameter(
|
||||
@NotNull PsiTypeParameterListOwner owner,
|
||||
int index,
|
||||
@NotNull String name) {
|
||||
@@ -59,15 +59,15 @@ public class KotlinLightTypeParameter
|
||||
|
||||
@NotNull
|
||||
private PsiTypeParameterListOwner getOwnerDelegate() {
|
||||
if (owner instanceof KotlinLightClass) return ((KotlinLightClass) owner).getDelegate();
|
||||
if (owner instanceof KotlinLightMethod) return ((KotlinLightMethod) owner).getDelegate();
|
||||
if (owner instanceof KtLightClass) return ((KtLightClass) owner).getDelegate();
|
||||
if (owner instanceof KtLightMethod) return ((KtLightMethod) owner).getDelegate();
|
||||
return owner;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiElement copy() {
|
||||
return new KotlinLightTypeParameter(owner, index, name);
|
||||
return new KtLightTypeParameter(owner, index, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -145,6 +145,6 @@ public class KotlinLightTypeParameter
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) return true;
|
||||
return obj instanceof KotlinLightTypeParameter && getOrigin().equals(((KotlinLightTypeParameter) obj).getOrigin());
|
||||
return obj instanceof KtLightTypeParameter && getOrigin().equals(((KtLightTypeParameter) obj).getOrigin());
|
||||
}
|
||||
}
|
||||
+4
-6
@@ -33,16 +33,14 @@ import kotlin.jvm.functions.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class KotlinWrappingLightClass extends AbstractLightClass implements KotlinLightClass, PsiExtensibleClass {
|
||||
public abstract class KtWrappingLightClass extends AbstractLightClass implements KtLightClass, PsiExtensibleClass {
|
||||
private final ClassInnerStuffCache myInnersCache = new ClassInnerStuffCache(this);
|
||||
|
||||
protected KotlinWrappingLightClass(PsiManager manager) {
|
||||
protected KtWrappingLightClass(PsiManager manager) {
|
||||
super(manager, KotlinLanguage.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -122,7 +120,7 @@ public abstract class KotlinWrappingLightClass extends AbstractLightClass implem
|
||||
@Override
|
||||
public PsiField fun(PsiField field) {
|
||||
KtDeclaration declaration = ClsWrapperStubPsiFactory.getOriginalDeclaration(field);
|
||||
return KotlinLightFieldImpl.Factory.create(declaration, field, KotlinWrappingLightClass.this);
|
||||
return KtLightFieldImpl.Factory.create(declaration, field, KtWrappingLightClass.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -138,7 +136,7 @@ public abstract class KotlinWrappingLightClass extends AbstractLightClass implem
|
||||
declaration = PsiTreeUtil.getParentOfType(declaration, KtProperty.class);
|
||||
}
|
||||
|
||||
return KotlinLightMethodImpl.Factory.create(method, declaration, KotlinWrappingLightClass.this);
|
||||
return KtLightMethodImpl.Factory.create(method, declaration, KtWrappingLightClass.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public object LightClassUtil {
|
||||
val outerPsiClass = getWrappingClass(companionObject, true)
|
||||
if (outerPsiClass != null) {
|
||||
for (fieldOfParent in outerPsiClass.fields) {
|
||||
if ((fieldOfParent is KotlinLightElement<*, *>) && fieldOfParent.getOrigin() === companionObject) {
|
||||
if ((fieldOfParent is KtLightElement<*, *>) && fieldOfParent.getOrigin() === companionObject) {
|
||||
return fieldOfParent
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public object LightClassUtil {
|
||||
private fun getLightClassBackingField(declaration: KtDeclaration): PsiField? {
|
||||
var psiClass: PsiClass = getWrappingClass(declaration, true) ?: return null
|
||||
|
||||
if (psiClass is KotlinLightClass) {
|
||||
if (psiClass is KtLightClass) {
|
||||
val origin = psiClass.getOrigin()
|
||||
if (origin is KtObjectDeclaration && origin.isCompanion()) {
|
||||
val containingClass = PsiTreeUtil.getParentOfType(origin, KtClass::class.java)
|
||||
@@ -179,7 +179,7 @@ public object LightClassUtil {
|
||||
}
|
||||
|
||||
for (field in psiClass.fields) {
|
||||
if (field is KotlinLightField && field.getOrigin() === declaration) {
|
||||
if (field is KtLightField && field.getOrigin() === declaration) {
|
||||
return field
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public object LightClassUtil {
|
||||
val methods = SmartList<PsiMethod>()
|
||||
for (method in psiClasses.flatMap { it.methods.asList() }) {
|
||||
try {
|
||||
if (method is KotlinLightMethod && method.getOrigin() === declaration) {
|
||||
if (method is KtLightMethod && method.getOrigin() === declaration) {
|
||||
methods.add(method)
|
||||
if (!collectAll) {
|
||||
return methods
|
||||
@@ -332,7 +332,7 @@ public object LightClassUtil {
|
||||
val jetTypeParameter = parameters.get(i)
|
||||
val name = jetTypeParameter.name
|
||||
val safeName = name ?: "__no_name__"
|
||||
builder.addParameter(KotlinLightTypeParameter(owner, i, safeName))
|
||||
builder.addParameter(KtLightTypeParameter(owner, i, safeName))
|
||||
}
|
||||
}
|
||||
return builder
|
||||
|
||||
+3
-3
@@ -27,10 +27,10 @@ import java.util.List;
|
||||
// Copy of com.intellij.psi.impl.light.LightParameterListBuilder
|
||||
public class LightParameterListBuilder extends LightElement implements PsiParameterList {
|
||||
private final List<PsiParameter> myParameters = new ArrayList<PsiParameter>();
|
||||
private final KotlinLightMethod parent;
|
||||
private final KtLightMethod parent;
|
||||
private PsiParameter[] myCachedParameters;
|
||||
|
||||
public LightParameterListBuilder(PsiManager manager, Language language, KotlinLightMethod parent) {
|
||||
public LightParameterListBuilder(PsiManager manager, Language language, KtLightMethod parent) {
|
||||
super(manager, language);
|
||||
this.parent = parent;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class LightParameterListBuilder extends LightElement implements PsiParame
|
||||
}
|
||||
|
||||
@Override
|
||||
public KotlinLightMethod getParent() {
|
||||
public KtLightMethod getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
||||
public fun getJvmSignatureDiagnostics(element: PsiElement, otherDiagnostics: Diagnostics, moduleScope: GlobalSearchScope): Diagnostics? {
|
||||
fun getDiagnosticsForFileFacade(file: KtFile): Diagnostics? {
|
||||
val project = file.project
|
||||
val cache = KotlinLightClassForFacade.FacadeStubCache.getInstance(project)
|
||||
val cache = KtLightClassForFacade.FacadeStubCache.getInstance(project)
|
||||
val facadeFqName = NoResolveFileClassesProvider.getFileClassInfo(file).facadeClassFqName
|
||||
return cache[facadeFqName, moduleScope].getValue()?.extraDiagnostics
|
||||
}
|
||||
|
||||
fun getDiagnosticsForClass(ktClassOrObject: KtClassOrObject): Diagnostics {
|
||||
return KotlinLightClassForExplicitDeclaration.getLightClassData(ktClassOrObject).extraDiagnostics
|
||||
return KtLightClassForExplicitDeclaration.getLightClassData(ktClassOrObject).extraDiagnostics
|
||||
}
|
||||
|
||||
fun doGetDiagnostics(): Diagnostics? {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.singletonList
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList
|
||||
import java.util.*
|
||||
|
||||
public fun KtClassOrObject.toLightClass(): KotlinLightClass? = LightClassUtil.getPsiClass(this) as KotlinLightClass?
|
||||
public fun KtClassOrObject.toLightClass(): KtLightClass? = LightClassUtil.getPsiClass(this) as KtLightClass?
|
||||
|
||||
public fun KtDeclaration.toLightElements(): List<PsiNamedElement> =
|
||||
when (this) {
|
||||
@@ -97,7 +97,7 @@ public fun KtTypeParameter.toPsiTypeParameters(): List<PsiTypeParameter> {
|
||||
|
||||
// Returns original declaration if given PsiElement is a Kotlin light element, and element itself otherwise
|
||||
public val PsiElement.unwrapped: PsiElement?
|
||||
get() = if (this is KotlinLightElement<*, *>) getOrigin() else this
|
||||
get() = if (this is KtLightElement<*, *>) getOrigin() else this
|
||||
|
||||
public val PsiElement.namedUnwrappedElement: PsiNamedElement?
|
||||
get() = unwrapped?.getNonStrictParentOfType<PsiNamedElement>()
|
||||
|
||||
@@ -49,7 +49,7 @@ public class KotlinLightClassCoherenceTest extends KotlinAsJavaTestBase {
|
||||
|
||||
@NotNull
|
||||
protected PsiClass doTest(String qualifiedName) {
|
||||
KotlinLightClass psiClass = (KotlinLightClass) finder.findClass(qualifiedName, GlobalSearchScope.allScope(getProject()));
|
||||
KtLightClass psiClass = (KtLightClass) finder.findClass(qualifiedName, GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull("Class not found: " + qualifiedName, psiClass);
|
||||
|
||||
Asserter asserter = new Asserter();
|
||||
@@ -76,7 +76,7 @@ public class KotlinLightClassCoherenceTest extends KotlinAsJavaTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void assertModifiersCoherent(KotlinLightClass lightClass) {
|
||||
public void assertModifiersCoherent(KtLightClass lightClass) {
|
||||
PsiClass delegate = lightClass.getDelegate();
|
||||
for (String modifier : PsiModifier.MODIFIERS) {
|
||||
assertEquals("Incoherent modifier: " + modifier,
|
||||
@@ -85,7 +85,7 @@ public class KotlinLightClassCoherenceTest extends KotlinAsJavaTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void assertPropertyCoherent(KotlinLightClass lightClass, String methodName) {
|
||||
public void assertPropertyCoherent(KtLightClass lightClass, String methodName) {
|
||||
Class<?> reflect = PsiClass.class;
|
||||
try {
|
||||
Method method = reflect.getMethod(methodName);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class LightClassAnnotationsTest extends KotlinAsJavaTestBase {
|
||||
|
||||
private void doTest(@NotNull String fqName) {
|
||||
PsiClass psiClass = finder.findClass(fqName, GlobalSearchScope.allScope(getProject()));
|
||||
if (!(psiClass instanceof KotlinLightClass)) {
|
||||
if (!(psiClass instanceof KtLightClass)) {
|
||||
throw new IllegalStateException("Not a light class: " + psiClass + " (" + fqName + ")");
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ object LightClassTestCommon {
|
||||
if (lightClass == null) {
|
||||
return "<not generated>"
|
||||
}
|
||||
TestCase.assertTrue("Not a light class: $lightClass ($fqName)", lightClass is KotlinLightClass)
|
||||
TestCase.assertTrue("Not a light class: $lightClass ($fqName)", lightClass is KtLightClass)
|
||||
|
||||
val delegate = (lightClass as KotlinLightClass).getDelegate()
|
||||
val delegate = (lightClass as KtLightClass).getDelegate()
|
||||
TestCase.assertTrue("Not a CLS element: $delegate", delegate is ClsElementImpl)
|
||||
|
||||
val buffer = StringBuilder()
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.jvm.compiler
|
||||
|
||||
import com.intellij.psi.JavaPsiFacade
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightClass
|
||||
import org.jetbrains.kotlin.asJava.KtLightClass
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl
|
||||
@@ -58,7 +58,7 @@ public class KotlinClassFinderTest : KotlinTestWithEnvironmentManagement() {
|
||||
val className = "test.A.B.C"
|
||||
val psiClass = JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.allScope(project))
|
||||
assertNotNull(psiClass, "Psi class not found for $className")
|
||||
assertTrue(psiClass !is KotlinLightClass, "Kotlin light classes are not not expected");
|
||||
assertTrue(psiClass !is KtLightClass, "Kotlin light classes are not not expected");
|
||||
|
||||
val binaryClass = JvmVirtualFileFinder.SERVICE.getInstance(project).findKotlinClass(JavaClassImpl(psiClass!!))
|
||||
assertNotNull(binaryClass, "No binary class for $className")
|
||||
|
||||
+3
-3
@@ -25,13 +25,13 @@ import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class JetBundle {
|
||||
public class KotlinBundle {
|
||||
private static Reference<ResourceBundle> ourBundle;
|
||||
|
||||
@NonNls
|
||||
private static final String BUNDLE = "org.jetbrains.kotlin.idea.JetBundle";
|
||||
private static final String BUNDLE = "org.jetbrains.kotlin.idea.KotlinBundle";
|
||||
|
||||
private JetBundle() {
|
||||
private KotlinBundle() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
+3
-3
@@ -29,11 +29,11 @@ import org.jetbrains.kotlin.psi.KtElement;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public final class JetDescriptorIconProvider {
|
||||
public final class KotlinDescriptorIconProvider {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.kotlin.idea.JetDescriptorIconProvider");
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.kotlin.idea.KotlinDescriptorIconProvider");
|
||||
|
||||
private JetDescriptorIconProvider() {
|
||||
private KotlinDescriptorIconProvider() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
+9
-9
@@ -28,18 +28,18 @@ import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightClassForExplicitDeclaration;
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightClassForFacade;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.KotlinLightClassForDecompiledDeclaration;
|
||||
import org.jetbrains.kotlin.asJava.KtLightClassForExplicitDeclaration;
|
||||
import org.jetbrains.kotlin.asJava.KtLightClassForFacade;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.KtLightClassForDecompiledDeclaration;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
public class JetIconProvider extends IconProvider implements DumbAware {
|
||||
public class KotlinIconProvider extends IconProvider implements DumbAware {
|
||||
|
||||
public static JetIconProvider INSTANCE = new JetIconProvider();
|
||||
public static KotlinIconProvider INSTANCE = new KotlinIconProvider();
|
||||
|
||||
@Nullable
|
||||
public static KtClassOrObject getMainClass(@NotNull KtFile file) {
|
||||
@@ -101,12 +101,12 @@ public class JetIconProvider extends IconProvider implements DumbAware {
|
||||
return PlatformIcons.PACKAGE_ICON;
|
||||
}
|
||||
|
||||
if (psiElement instanceof KotlinLightClassForFacade) {
|
||||
if (psiElement instanceof KtLightClassForFacade) {
|
||||
return KotlinIcons.FILE;
|
||||
}
|
||||
|
||||
if (psiElement instanceof KotlinLightClassForDecompiledDeclaration) {
|
||||
KtClassOrObject origin = ((KotlinLightClassForDecompiledDeclaration) psiElement).getOrigin();
|
||||
if (psiElement instanceof KtLightClassForDecompiledDeclaration) {
|
||||
KtClassOrObject origin = ((KtLightClassForDecompiledDeclaration) psiElement).getOrigin();
|
||||
if (origin != null) {
|
||||
psiElement = origin;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class JetIconProvider extends IconProvider implements DumbAware {
|
||||
}
|
||||
}
|
||||
|
||||
if (psiElement instanceof KotlinLightClassForExplicitDeclaration) {
|
||||
if (psiElement instanceof KtLightClassForExplicitDeclaration) {
|
||||
psiElement = psiElement.getNavigationElement();
|
||||
}
|
||||
|
||||
+10
-10
@@ -28,25 +28,25 @@ import com.intellij.util.containers.HashSet
|
||||
import org.jetbrains.kotlin.asJava.JavaElementFinder
|
||||
import org.jetbrains.kotlin.asJava.defaultImplsChild
|
||||
import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetClassShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetFileFacadeShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetFunctionShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinClassShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinFileFacadeShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinFunctionShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.PackageIndexUtil
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import java.util.*
|
||||
|
||||
public class JetShortNamesCache(private val project: Project) : PsiShortNamesCache() {
|
||||
public class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache() {
|
||||
/**
|
||||
* Return kotlin class names from project sources which should be visible from java.
|
||||
*/
|
||||
override fun getAllClassNames(): Array<String> {
|
||||
val classNames = JetClassShortNameIndex.getInstance().getAllKeys(project)
|
||||
val classNames = KotlinClassShortNameIndex.getInstance().getAllKeys(project)
|
||||
|
||||
// package classes can not be indexed, since they have no explicit declarations
|
||||
val packageClassShortNames = PackageIndexUtil.getAllPossiblePackageClasses(project).keySet()
|
||||
classNames.addAll(packageClassShortNames)
|
||||
classNames.addAll(JetFileFacadeShortNameIndex.INSTANCE.getAllKeys(project))
|
||||
classNames.addAll(KotlinFileFacadeShortNameIndex.INSTANCE.getAllKeys(project))
|
||||
|
||||
return classNames.toTypedArray()
|
||||
}
|
||||
@@ -60,10 +60,10 @@ public class JetShortNamesCache(private val project: Project) : PsiShortNamesCac
|
||||
val packageClassNames = PackageIndexUtil.getAllPossiblePackageClasses(project).get(name)
|
||||
allFqNames.addAll(packageClassNames)
|
||||
|
||||
JetClassShortNameIndex.getInstance().get(name, project, scope)
|
||||
KotlinClassShortNameIndex.getInstance().get(name, project, scope)
|
||||
.mapTo(allFqNames) { it.fqName }
|
||||
|
||||
JetFileFacadeShortNameIndex.INSTANCE.get(name, project, scope)
|
||||
KotlinFileFacadeShortNameIndex.INSTANCE.get(name, project, scope)
|
||||
.mapTo(allFqNames) { it.javaFileFacadeFqName }
|
||||
|
||||
val result = ArrayList<PsiClass>()
|
||||
@@ -103,10 +103,10 @@ public class JetShortNamesCache(private val project: Project) : PsiShortNamesCac
|
||||
= ContainerUtil.process(getMethodsByName(name, scope), processor)
|
||||
|
||||
override fun getAllMethodNames(): Array<String>
|
||||
= JetFunctionShortNameIndex.getInstance().getAllKeys(project).toTypedArray()
|
||||
= KotlinFunctionShortNameIndex.getInstance().getAllKeys(project).toTypedArray()
|
||||
|
||||
override fun getAllMethodNames(set: HashSet<String>) {
|
||||
set.addAll(JetFunctionShortNameIndex.getInstance().getAllKeys(project))
|
||||
set.addAll(KotlinFunctionShortNameIndex.getInstance().getAllKeys(project))
|
||||
}
|
||||
|
||||
override fun getFieldsByName(name: String, scope: GlobalSearchScope): Array<PsiField>
|
||||
+13
-13
@@ -32,11 +32,11 @@ import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.kotlin.asJava.*
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName
|
||||
import org.jetbrains.kotlin.idea.decompiler.navigation.JetSourceNavigationHelper
|
||||
import org.jetbrains.kotlin.idea.decompiler.navigation.SourceNavigationHelper
|
||||
import org.jetbrains.kotlin.idea.project.ResolveElementCache
|
||||
import org.jetbrains.kotlin.idea.resolve.ResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.stubindex.*
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetSourceFilterScope.kotlinSourceAndClassFiles
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope.kotlinSourceAndClassFiles
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
@@ -116,7 +116,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
}
|
||||
|
||||
override fun findClassOrObjectDeclarations(fqName: FqName, searchScope: GlobalSearchScope): Collection<KtClassOrObject> {
|
||||
return JetFullClassNameIndex.getInstance().get(fqName.asString(), project, kotlinSourceAndClassFiles(searchScope, project))
|
||||
return KotlinFullClassNameIndex.getInstance().get(fqName.asString(), project, kotlinSourceAndClassFiles(searchScope, project))
|
||||
}
|
||||
|
||||
override fun findFilesForPackage(fqName: FqName, searchScope: GlobalSearchScope): Collection<KtFile> {
|
||||
@@ -127,7 +127,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
packageFqName: FqName,
|
||||
searchScope: GlobalSearchScope
|
||||
): Collection<KtClassOrObject> {
|
||||
return JetTopLevelClassByPackageIndex.getInstance().get(
|
||||
return KotlinTopLevelClassByPackageIndex.getInstance().get(
|
||||
packageFqName.asString(), project, kotlinSourceAndClassFiles(searchScope, project))
|
||||
}
|
||||
|
||||
@@ -145,13 +145,13 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
if (ProjectRootsUtil.isLibraryClassFile(project, virtualFile)) {
|
||||
return getLightClassForDecompiledClassOrObject(classOrObject)
|
||||
}
|
||||
return JetSourceNavigationHelper.getOriginalClass(classOrObject)
|
||||
return SourceNavigationHelper.getOriginalClass(classOrObject)
|
||||
}
|
||||
return KotlinLightClassForExplicitDeclaration.create(psiManager, classOrObject)
|
||||
return KtLightClassForExplicitDeclaration.create(psiManager, classOrObject)
|
||||
}
|
||||
|
||||
private fun withFakeLightClasses(
|
||||
lightClassForFacade: KotlinLightClassForFacade?,
|
||||
lightClassForFacade: KtLightClassForFacade?,
|
||||
facadeFiles: List<KtFile>
|
||||
): List<PsiClass> {
|
||||
if (lightClassForFacade == null) return emptyList()
|
||||
@@ -182,7 +182,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
moduleInfo: IdeaModuleInfo
|
||||
): List<PsiClass> {
|
||||
if (moduleInfo is ModuleSourceInfo) {
|
||||
val lightClassForFacade = KotlinLightClassForFacade.createForFacade(
|
||||
val lightClassForFacade = KtLightClassForFacade.createForFacade(
|
||||
psiManager, facadeFqName, moduleInfo.contentScope(), facadeFiles)
|
||||
return withFakeLightClasses(lightClassForFacade, facadeFiles)
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
}
|
||||
|
||||
override fun findFilesForFacade(facadeFqName: FqName, scope: GlobalSearchScope): Collection<KtFile> {
|
||||
return JetFileFacadeFqNameIndex.INSTANCE.get(facadeFqName.asString(), project, scope)
|
||||
return KotlinFileFacadeFqNameIndex.INSTANCE.get(facadeFqName.asString(), project, scope)
|
||||
}
|
||||
|
||||
override fun resolveClassToDescriptor(classOrObject: KtClassOrObject): ClassDescriptor? {
|
||||
@@ -205,12 +205,12 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
}
|
||||
|
||||
override fun getFacadeNames(packageFqName: FqName, scope: GlobalSearchScope): Collection<String> {
|
||||
val facadeFilesInPackage = JetFileFacadeClassByPackageIndex.getInstance().get(packageFqName.asString(), project, scope)
|
||||
val facadeFilesInPackage = KotlinFileFacadeClassByPackageIndex.getInstance().get(packageFqName.asString(), project, scope)
|
||||
return facadeFilesInPackage.map { it.javaFileFacadeFqName.shortName().asString() }
|
||||
}
|
||||
|
||||
override fun getFacadeClassesInPackage(packageFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> {
|
||||
val facadeFilesInPackage = JetFileFacadeClassByPackageIndex.getInstance().get(packageFqName.asString(), project, scope)
|
||||
val facadeFilesInPackage = KotlinFileFacadeClassByPackageIndex.getInstance().get(packageFqName.asString(), project, scope)
|
||||
val groupedByFqNameAndModuleInfo = facadeFilesInPackage.groupBy {
|
||||
Pair(it.javaFileFacadeFqName, it.getModuleInfo())
|
||||
}
|
||||
@@ -304,7 +304,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
return getClassRelativeName(parent).child(name)
|
||||
}
|
||||
|
||||
private fun createLightClassForDecompiledKotlinFile(file: KtFile): KotlinLightClassForDecompiledDeclaration? {
|
||||
private fun createLightClassForDecompiledKotlinFile(file: KtFile): KtLightClassForDecompiledDeclaration? {
|
||||
val virtualFile = file.virtualFile ?: return null
|
||||
|
||||
val classOrObject = file.declarations.filterIsInstance<KtClassOrObject>().singleOrNull()
|
||||
@@ -314,7 +314,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
correspondingClassOrObject = classOrObject
|
||||
) ?: return null
|
||||
|
||||
return KotlinLightClassForDecompiledDeclaration(javaClsClass, classOrObject)
|
||||
return KtLightClassForDecompiledDeclaration(javaClsClass, classOrObject)
|
||||
}
|
||||
|
||||
private fun createClsJavaClassFromVirtualFile(
|
||||
|
||||
+6
-6
@@ -18,14 +18,14 @@ package org.jetbrains.kotlin.idea.caches.resolve
|
||||
|
||||
import com.intellij.psi.PsiClass
|
||||
import com.intellij.psi.impl.compiled.ClsClassImpl
|
||||
import org.jetbrains.kotlin.asJava.KotlinWrappingLightClass
|
||||
import org.jetbrains.kotlin.asJava.KtWrappingLightClass
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
|
||||
class KotlinLightClassForDecompiledDeclaration(
|
||||
class KtLightClassForDecompiledDeclaration(
|
||||
private val clsClass: ClsClassImpl,
|
||||
private val origin: KtClassOrObject?
|
||||
) : KotlinWrappingLightClass(clsClass.getManager()) {
|
||||
) : KtWrappingLightClass(clsClass.getManager()) {
|
||||
private val fqName = origin?.getFqName() ?: FqName(clsClass.getQualifiedName())
|
||||
|
||||
override fun copy() = this
|
||||
@@ -33,8 +33,8 @@ class KotlinLightClassForDecompiledDeclaration(
|
||||
override fun getOwnInnerClasses(): List<PsiClass> {
|
||||
val nestedClasses = origin?.getDeclarations()?.filterIsInstance<KtClassOrObject>() ?: emptyList()
|
||||
return clsClass.getOwnInnerClasses().map { innerClsClass ->
|
||||
KotlinLightClassForDecompiledDeclaration(innerClsClass as ClsClassImpl,
|
||||
nestedClasses.firstOrNull { innerClsClass.getName() == it.getName() })
|
||||
KtLightClassForDecompiledDeclaration(innerClsClass as ClsClassImpl,
|
||||
nestedClasses.firstOrNull { innerClsClass.getName() == it.getName() })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class KotlinLightClassForDecompiledDeclaration(
|
||||
override fun getParent() = clsClass.parent
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is KotlinLightClassForDecompiledDeclaration &&
|
||||
other is KtLightClassForDecompiledDeclaration &&
|
||||
getFqName() == other.getFqName()
|
||||
|
||||
override fun hashCode(): Int =
|
||||
@@ -17,13 +17,13 @@
|
||||
package org.jetbrains.kotlin.idea.caches.resolve
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightElement
|
||||
import org.jetbrains.kotlin.asJava.KtLightElement
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import com.intellij.openapi.roots.ProjectFileIndex
|
||||
import com.intellij.openapi.roots.LibraryOrderEntry
|
||||
import com.intellij.openapi.roots.JdkOrderEntry
|
||||
import org.jetbrains.kotlin.asJava.FakeLightClassForFileOfPackage
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightClassForFacade
|
||||
import org.jetbrains.kotlin.asJava.KtLightClassForFacade
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.roots.ModuleRootManager
|
||||
@@ -35,7 +35,7 @@ fun PsiElement.getModuleInfo(): IdeaModuleInfo {
|
||||
return NotUnderContentRootModuleInfo
|
||||
}
|
||||
|
||||
if (this is KotlinLightElement<*, *>) return this.getModuleInfoForLightElement()
|
||||
if (this is KtLightElement<*, *>) return this.getModuleInfoForLightElement()
|
||||
|
||||
val containingJetFile = (this as? KtElement)?.getContainingFile() as? KtFile
|
||||
val context = containingJetFile?.analysisContext
|
||||
@@ -114,13 +114,13 @@ private fun getModuleInfoByVirtualFile(project: Project, virtualFile: VirtualFil
|
||||
return NotUnderContentRootModuleInfo
|
||||
}
|
||||
|
||||
private fun KotlinLightElement<*, *>.getModuleInfoForLightElement(): IdeaModuleInfo {
|
||||
if (this is KotlinLightClassForDecompiledDeclaration) {
|
||||
private fun KtLightElement<*, *>.getModuleInfoForLightElement(): IdeaModuleInfo {
|
||||
if (this is KtLightClassForDecompiledDeclaration) {
|
||||
return getModuleInfoByVirtualFile(getProject(), getContainingFile().getVirtualFile(), false)
|
||||
}
|
||||
val element = getOrigin() ?: when (this) {
|
||||
is FakeLightClassForFileOfPackage -> this.getContainingFile()!!
|
||||
is KotlinLightClassForFacade -> this.files.first()
|
||||
is KtLightClassForFacade -> this.files.first()
|
||||
else -> throw IllegalStateException("Unknown light class without origin is referenced by IDE lazy resolve: $javaClass")
|
||||
}
|
||||
return element.getModuleInfo()
|
||||
|
||||
+4
-13
@@ -16,21 +16,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.codeInsight
|
||||
|
||||
import org.jetbrains.kotlin.psi.KtReferenceExpression
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtTreeVisitorVoid
|
||||
import org.jetbrains.kotlin.psi.KtUserType
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.psi.KtCallExpression
|
||||
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
||||
import java.util.Collections
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.psi.KtQualifiedExpression
|
||||
import java.util.LinkedHashMap
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import java.util.*
|
||||
|
||||
object JetFileReferencesResolver {
|
||||
object KotlinFileReferencesResolver {
|
||||
fun resolve(
|
||||
element: KtElement,
|
||||
resolveQualifiers: Boolean = true,
|
||||
+3
-3
@@ -20,9 +20,9 @@ import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class JetModuleTypeManager {
|
||||
public static JetModuleTypeManager getInstance() {
|
||||
return ServiceManager.getService(JetModuleTypeManager.class);
|
||||
public abstract class KotlinModuleTypeManager {
|
||||
public static KotlinModuleTypeManager getInstance() {
|
||||
return ServiceManager.getService(KotlinModuleTypeManager.class);
|
||||
}
|
||||
|
||||
public abstract boolean isAndroidGradleModule(@NotNull Module module);
|
||||
+2
-2
@@ -21,7 +21,7 @@ import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers
|
||||
import org.jetbrains.kotlin.idea.decompiler.stubBuilder.KotlinClsStubBuilder
|
||||
|
||||
public class JetClassFileDecompiler : ClassFileDecompilers.Full() {
|
||||
public class KotlinClassFileDecompiler : ClassFileDecompilers.Full() {
|
||||
private val stubBuilder = KotlinClsStubBuilder()
|
||||
|
||||
override fun accepts(file: VirtualFile) = isKotlinJvmCompiledFile(file)
|
||||
@@ -29,5 +29,5 @@ public class JetClassFileDecompiler : ClassFileDecompilers.Full() {
|
||||
override fun getStubBuilder() = stubBuilder
|
||||
|
||||
override fun createFileViewProvider(file: VirtualFile, manager: PsiManager, physical: Boolean)
|
||||
= JetClassFileViewProvider(manager, file, physical, isKotlinInternalCompiledFile(file))
|
||||
= KotlinClassFileViewProvider(manager, file, physical, isKotlinInternalCompiledFile(file))
|
||||
}
|
||||
+2
-3
@@ -16,12 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.decompiler
|
||||
|
||||
import com.intellij.psi.FileViewProvider
|
||||
import org.jetbrains.kotlin.idea.decompiler.textBuilder.buildDecompiledTextFromJsMetadata
|
||||
import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText
|
||||
import org.jetbrains.kotlin.idea.decompiler.textBuilder.buildDecompiledTextFromJsMetadata
|
||||
import org.jetbrains.kotlin.utils.concurrent.block.LockedClearableLazyValue
|
||||
|
||||
public class KotlinJavascriptMetaFile(provider: KotlinClassFileViewProvider) : KotlinClsFileBase(provider) {
|
||||
public class KotlinJavascriptMetaFile(provider: KotlinClassFileViewProviderBase) : KtClsFileBase(provider) {
|
||||
protected override val decompiledText: LockedClearableLazyValue<DecompiledText> = LockedClearableLazyValue(Any()) {
|
||||
buildDecompiledTextFromJsMetadata(getVirtualFile())
|
||||
}
|
||||
|
||||
+1
-2
@@ -16,12 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.decompiler
|
||||
|
||||
import com.intellij.psi.FileViewProvider
|
||||
import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText
|
||||
import org.jetbrains.kotlin.idea.decompiler.textBuilder.buildDecompiledText
|
||||
import org.jetbrains.kotlin.utils.concurrent.block.LockedClearableLazyValue
|
||||
|
||||
public class JetClsFile(provider: KotlinClassFileViewProvider) : KotlinClsFileBase(provider) {
|
||||
public class KtClsFile(provider: KotlinClassFileViewProviderBase) : KtClsFileBase(provider) {
|
||||
protected override val decompiledText: LockedClearableLazyValue<DecompiledText> = LockedClearableLazyValue(Any()) {
|
||||
buildDecompiledText(getVirtualFile())
|
||||
}
|
||||
+1
-1
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.utils.concurrent.block.LockedClearableLazyValue
|
||||
|
||||
public abstract class KotlinClsFileBase(val provider: KotlinClassFileViewProvider) : KtFile(provider, true) {
|
||||
public abstract class KtClsFileBase(val provider: KotlinClassFileViewProviderBase) : KtFile(provider, true) {
|
||||
protected abstract val decompiledText: LockedClearableLazyValue<DecompiledText>
|
||||
|
||||
public fun getDeclarationForDescriptor(descriptor: DeclarationDescriptor): KtDeclaration? {
|
||||
+6
-6
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.utils.concurrent.block.LockedClearableLazyValue
|
||||
|
||||
abstract class KotlinClassFileViewProvider(
|
||||
abstract class KotlinClassFileViewProviderBase(
|
||||
manager: PsiManager,
|
||||
file: VirtualFile,
|
||||
physical: Boolean) : SingleRootFileViewProvider(manager, file, physical, KotlinLanguage.INSTANCE) {
|
||||
@@ -50,11 +50,11 @@ abstract class KotlinClassFileViewProvider(
|
||||
override fun getContents() = content.get()
|
||||
}
|
||||
|
||||
public class JetClassFileViewProvider(
|
||||
public class KotlinClassFileViewProvider(
|
||||
manager: PsiManager,
|
||||
file: VirtualFile,
|
||||
physical: Boolean,
|
||||
val isInternal: Boolean) : KotlinClassFileViewProvider(manager, file, physical) {
|
||||
val isInternal: Boolean) : KotlinClassFileViewProviderBase(manager, file, physical) {
|
||||
|
||||
override fun createFile(project: Project, file: VirtualFile, fileType: FileType): PsiFile? {
|
||||
val fileIndex = ServiceManager.getService(project, javaClass<FileIndexFacade>())
|
||||
@@ -64,17 +64,17 @@ public class JetClassFileViewProvider(
|
||||
|
||||
if (isInternal) return null
|
||||
|
||||
return JetClsFile(this)
|
||||
return KtClsFile(this)
|
||||
}
|
||||
|
||||
override fun createCopy(copy: VirtualFile) = JetClassFileViewProvider(getManager(), copy, false, isInternal)
|
||||
override fun createCopy(copy: VirtualFile) = KotlinClassFileViewProvider(getManager(), copy, false, isInternal)
|
||||
}
|
||||
|
||||
public class KotlinJavascriptMetaFileViewProvider (
|
||||
manager: PsiManager,
|
||||
val file: VirtualFile,
|
||||
physical: Boolean,
|
||||
val isInternal: Boolean) : KotlinClassFileViewProvider(manager, file, physical) {
|
||||
val isInternal: Boolean) : KotlinClassFileViewProviderBase(manager, file, physical) {
|
||||
|
||||
//TODO: check index that file is library file, as in ClassFileViewProvider
|
||||
override fun createFile(project: Project, file: VirtualFile, fileType: FileType) =
|
||||
|
||||
+5
-5
@@ -25,8 +25,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
|
||||
import org.jetbrains.kotlin.idea.decompiler.KotlinClsFileBase;
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetSourceFilterScope;
|
||||
import org.jetbrains.kotlin.idea.decompiler.KtClsFileBase;
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope;
|
||||
import org.jetbrains.kotlin.idea.stubindex.StaticFacadeIndexUtil;
|
||||
import org.jetbrains.kotlin.idea.vfilefinder.JsVirtualFileFinderFactory;
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmVirtualFileFinderFactory;
|
||||
@@ -62,11 +62,11 @@ public final class DecompiledNavigationUtils {
|
||||
if (virtualFile == null) return null;
|
||||
|
||||
PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
|
||||
if (!(psiFile instanceof KotlinClsFileBase)) {
|
||||
if (!(psiFile instanceof KtClsFileBase)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ((KotlinClsFileBase) psiFile).getDeclarationForDescriptor(referencedDescriptor);
|
||||
return ((KtClsFileBase) psiFile).getDeclarationForDescriptor(referencedDescriptor);
|
||||
}
|
||||
|
||||
private static boolean isLocal(DeclarationDescriptor descriptor) {
|
||||
@@ -91,7 +91,7 @@ public final class DecompiledNavigationUtils {
|
||||
ClassId containerClassId = getContainerClassId(project, referencedDescriptor);
|
||||
if (containerClassId == null) return null;
|
||||
|
||||
GlobalSearchScope scopeToSearchIn = JetSourceFilterScope.kotlinSourceAndClassFiles(GlobalSearchScope.allScope(project), project);
|
||||
GlobalSearchScope scopeToSearchIn = KotlinSourceFilterScope.kotlinSourceAndClassFiles(GlobalSearchScope.allScope(project), project);
|
||||
|
||||
VirtualFileFinderFactory virtualFileFinderFactory;
|
||||
if (isFromKotlinJavasriptMetadata(referencedDescriptor)) {
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import com.intellij.openapi.project.DumbService
|
||||
|
||||
public class KotlinDeclarationNavigationPolicyImpl : KotlinDeclarationNavigationPolicy {
|
||||
override fun getOriginalElement(declaration: KtDeclaration) =
|
||||
JetSourceNavigationHelper.getOriginalElement(declaration)
|
||||
SourceNavigationHelper.getOriginalElement(declaration)
|
||||
override fun getNavigationElement(declaration: KtDeclaration) =
|
||||
JetSourceNavigationHelper.getNavigationElement(declaration)
|
||||
SourceNavigationHelper.getNavigationElement(declaration)
|
||||
}
|
||||
|
||||
+13
-13
@@ -47,10 +47,10 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptorKt;
|
||||
import org.jetbrains.kotlin.fileClasses.NoResolveFileClassesProvider;
|
||||
import org.jetbrains.kotlin.frontend.di.InjectionKt;
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetFullClassNameIndex;
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetSourceFilterScope;
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetTopLevelFunctionFqnNameIndex;
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetTopLevelPropertyFqnNameIndex;
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinFullClassNameIndex;
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope;
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionFqnNameIndex;
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelPropertyFqnNameIndex;
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.name.ClassId;
|
||||
@@ -74,8 +74,8 @@ import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.idea.decompiler.navigation.MemberMatching.*;
|
||||
|
||||
public class JetSourceNavigationHelper {
|
||||
private static final Logger LOG = Logger.getInstance(JetSourceNavigationHelper.class);
|
||||
public class SourceNavigationHelper {
|
||||
private static final Logger LOG = Logger.getInstance(SourceNavigationHelper.class);
|
||||
|
||||
public enum NavigationKind {
|
||||
CLASS_FILES_TO_SOURCES,
|
||||
@@ -84,7 +84,7 @@ public class JetSourceNavigationHelper {
|
||||
|
||||
private static boolean forceResolve = false;
|
||||
|
||||
private JetSourceNavigationHelper() {
|
||||
private SourceNavigationHelper() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -103,8 +103,8 @@ public class JetSourceNavigationHelper {
|
||||
|
||||
Project project = declaration.getProject();
|
||||
return includeLibrarySources
|
||||
? JetSourceFilterScope.kotlinLibrarySources(GlobalSearchScope.allScope(project), project)
|
||||
: JetSourceFilterScope.kotlinLibraryClassFiles(GlobalSearchScope.allScope(project), project);
|
||||
? KotlinSourceFilterScope.kotlinLibrarySources(GlobalSearchScope.allScope(project), project)
|
||||
: KotlinSourceFilterScope.kotlinLibraryClassFiles(GlobalSearchScope.allScope(project), project);
|
||||
}
|
||||
|
||||
private static List<KtFile> getContainingFiles(@NotNull Iterable<KtNamedDeclaration> declarations) {
|
||||
@@ -279,7 +279,7 @@ public class JetSourceNavigationHelper {
|
||||
if (librarySourcesScope == GlobalSearchScope.EMPTY_SCOPE) { // .getProject() == null for EMPTY_SCOPE, and this breaks code
|
||||
return null;
|
||||
}
|
||||
Collection<KtClassOrObject> classes = JetFullClassNameIndex.getInstance()
|
||||
Collection<KtClassOrObject> classes = KotlinFullClassNameIndex.getInstance()
|
||||
.get(classFqName.asString(), classOrObject.getProject(), librarySourcesScope);
|
||||
if (classes.isEmpty()) {
|
||||
return null;
|
||||
@@ -309,10 +309,10 @@ public class JetSourceNavigationHelper {
|
||||
@NotNull KtNamedDeclaration decompiledDeclaration
|
||||
) {
|
||||
if (decompiledDeclaration instanceof KtNamedFunction) {
|
||||
return JetTopLevelFunctionFqnNameIndex.getInstance();
|
||||
return KotlinTopLevelFunctionFqnNameIndex.getInstance();
|
||||
}
|
||||
if (decompiledDeclaration instanceof KtProperty) {
|
||||
return JetTopLevelPropertyFqnNameIndex.getInstance();
|
||||
return KotlinTopLevelPropertyFqnNameIndex.getInstance();
|
||||
}
|
||||
throw new IllegalArgumentException("Neither function nor declaration: " + decompiledDeclaration.getClass().getName());
|
||||
}
|
||||
@@ -360,7 +360,7 @@ public class JetSourceNavigationHelper {
|
||||
|
||||
@TestOnly
|
||||
public static void setForceResolve(boolean forceResolve) {
|
||||
JetSourceNavigationHelper.forceResolve = forceResolve;
|
||||
SourceNavigationHelper.forceResolve = forceResolve;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
+1
-2
@@ -16,13 +16,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.findUsages
|
||||
|
||||
import com.intellij.lang.cacheBuilder.WordsScanner
|
||||
import com.intellij.lang.findUsages.FindUsagesProvider
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiNamedElement
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
|
||||
public class JetFindUsagesProvider : FindUsagesProvider {
|
||||
public class KotlinFindUsagesProvider : FindUsagesProvider {
|
||||
public override fun canFindUsagesFor(psiElement: PsiElement): Boolean =
|
||||
psiElement is KtNamedDeclaration
|
||||
|
||||
+3
-3
@@ -53,20 +53,20 @@ public class DebugInfoAnnotator implements Annotator {
|
||||
@Override
|
||||
public void reportElementWithErrorType(@NotNull KtReferenceExpression expression) {
|
||||
holder.createErrorAnnotation(expression, "[DEBUG] Resolved to error element")
|
||||
.setTextAttributes(JetHighlightingColors.RESOLVED_TO_ERROR);
|
||||
.setTextAttributes(KotlinHighlightingColors.RESOLVED_TO_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportMissingUnresolved(@NotNull KtReferenceExpression expression) {
|
||||
holder.createErrorAnnotation(expression,
|
||||
"[DEBUG] Reference is not resolved to anything, but is not marked unresolved")
|
||||
.setTextAttributes(JetHighlightingColors.DEBUG_INFO);
|
||||
.setTextAttributes(KotlinHighlightingColors.DEBUG_INFO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportUnresolvedWithTarget(@NotNull KtReferenceExpression expression, @NotNull String target) {
|
||||
holder.createErrorAnnotation(expression, "[DEBUG] Reference marked as unresolved is actually resolved to " + target)
|
||||
.setTextAttributes(JetHighlightingColors.DEBUG_INFO);
|
||||
.setTextAttributes(KotlinHighlightingColors.DEBUG_INFO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,6 +47,6 @@ public class DuplicateJvmSignatureAnnotator implements Annotator {
|
||||
Diagnostics diagnostics = DuplicateJvmSignatureUtilKt.getJvmSignatureDiagnostics(element, otherDiagnostics, moduleScope);
|
||||
|
||||
if (diagnostics == null) return;
|
||||
new JetPsiChecker().annotateElement(element, holder, diagnostics);
|
||||
new KotlinPsiChecker().annotateElement(element, holder, diagnostics);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -40,7 +40,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
|
||||
public void visitNamedFunction(@NotNull KtNamedFunction function) {
|
||||
PsiElement nameIdentifier = function.getNameIdentifier();
|
||||
if (nameIdentifier != null) {
|
||||
NameHighlighter.highlightName(holder, nameIdentifier, JetHighlightingColors.FUNCTION_DECLARATION);
|
||||
NameHighlighter.highlightName(holder, nameIdentifier, KotlinHighlightingColors.FUNCTION_DECLARATION);
|
||||
}
|
||||
|
||||
super.visitNamedFunction(function);
|
||||
@@ -55,7 +55,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
|
||||
if (typeElement instanceof KtUserType) {
|
||||
KtSimpleNameExpression nameExpression = ((KtUserType)typeElement).getReferenceExpression();
|
||||
if (nameExpression != null) {
|
||||
NameHighlighter.highlightName(holder, nameExpression, JetHighlightingColors.CONSTRUCTOR_CALL);
|
||||
NameHighlighter.highlightName(holder, nameExpression, KotlinHighlightingColors.CONSTRUCTOR_CALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,25 +70,25 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
|
||||
CallableDescriptor calleeDescriptor = resolvedCall.getResultingDescriptor();
|
||||
|
||||
if (DynamicCallsKt.isDynamic(calleeDescriptor)) {
|
||||
NameHighlighter.highlightName(holder, callee, JetHighlightingColors.DYNAMIC_FUNCTION_CALL);
|
||||
NameHighlighter.highlightName(holder, callee, KotlinHighlightingColors.DYNAMIC_FUNCTION_CALL);
|
||||
}
|
||||
else if (resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
NameHighlighter.highlightName(holder, callee, containedInFunctionClassOrSubclass(calleeDescriptor)
|
||||
? JetHighlightingColors.VARIABLE_AS_FUNCTION_CALL
|
||||
: JetHighlightingColors.VARIABLE_AS_FUNCTION_LIKE_CALL);
|
||||
? KotlinHighlightingColors.VARIABLE_AS_FUNCTION_CALL
|
||||
: KotlinHighlightingColors.VARIABLE_AS_FUNCTION_LIKE_CALL);
|
||||
}
|
||||
else {
|
||||
if (calleeDescriptor instanceof ConstructorDescriptor) {
|
||||
NameHighlighter.highlightName(holder, callee, JetHighlightingColors.CONSTRUCTOR_CALL);
|
||||
NameHighlighter.highlightName(holder, callee, KotlinHighlightingColors.CONSTRUCTOR_CALL);
|
||||
}
|
||||
else if (calleeDescriptor instanceof FunctionDescriptor) {
|
||||
FunctionDescriptor fun = (FunctionDescriptor) calleeDescriptor;
|
||||
NameHighlighter.highlightName(holder, callee, JetHighlightingColors.FUNCTION_CALL);
|
||||
NameHighlighter.highlightName(holder, callee, KotlinHighlightingColors.FUNCTION_CALL);
|
||||
if (DescriptorUtils.isTopLevelDeclaration(fun)) {
|
||||
NameHighlighter.highlightName(holder, callee, JetHighlightingColors.PACKAGE_FUNCTION_CALL);
|
||||
NameHighlighter.highlightName(holder, callee, KotlinHighlightingColors.PACKAGE_FUNCTION_CALL);
|
||||
}
|
||||
if (fun.getExtensionReceiverParameter() != null) {
|
||||
NameHighlighter.highlightName(holder, callee, JetHighlightingColors.EXTENSION_FUNCTION_CALL);
|
||||
NameHighlighter.highlightName(holder, callee, KotlinHighlightingColors.EXTENSION_FUNCTION_CALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.highlighter;
|
||||
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.kdoc.lexer.KDocTokens;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class JetHighlighter extends SyntaxHighlighterBase {
|
||||
private static final Map<IElementType, TextAttributesKey> keys1;
|
||||
private static final Map<IElementType, TextAttributesKey> keys2;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Lexer getHighlightingLexer() {
|
||||
return new JetHighlightingLexer();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
|
||||
return pack(keys1.get(tokenType), keys2.get(tokenType));
|
||||
}
|
||||
|
||||
static {
|
||||
keys1 = new HashMap<IElementType, TextAttributesKey>();
|
||||
keys2 = new HashMap<IElementType, TextAttributesKey>();
|
||||
|
||||
fillMap(keys1, KtTokens.KEYWORDS, JetHighlightingColors.KEYWORD);
|
||||
|
||||
keys1.put(KtTokens.AS_SAFE, JetHighlightingColors.KEYWORD);
|
||||
keys1.put(KtTokens.INTEGER_LITERAL, JetHighlightingColors.NUMBER);
|
||||
keys1.put(KtTokens.FLOAT_LITERAL, JetHighlightingColors.NUMBER);
|
||||
|
||||
fillMap(keys1,
|
||||
TokenSet.andNot(KtTokens.OPERATIONS,
|
||||
TokenSet.orSet(
|
||||
TokenSet.create(KtTokens.IDENTIFIER, KtTokens.AT),
|
||||
KtTokens.KEYWORDS)),
|
||||
JetHighlightingColors.OPERATOR_SIGN);
|
||||
|
||||
keys1.put(KtTokens.LPAR, JetHighlightingColors.PARENTHESIS);
|
||||
keys1.put(KtTokens.RPAR, JetHighlightingColors.PARENTHESIS);
|
||||
keys1.put(KtTokens.LBRACE, JetHighlightingColors.BRACES);
|
||||
keys1.put(KtTokens.RBRACE, JetHighlightingColors.BRACES);
|
||||
keys1.put(KtTokens.LBRACKET, JetHighlightingColors.BRACKETS);
|
||||
keys1.put(KtTokens.RBRACKET, JetHighlightingColors.BRACKETS);
|
||||
keys1.put(KtTokens.COMMA, JetHighlightingColors.COMMA);
|
||||
keys1.put(KtTokens.SEMICOLON, JetHighlightingColors.SEMICOLON);
|
||||
keys1.put(KtTokens.DOT, JetHighlightingColors.DOT);
|
||||
keys1.put(KtTokens.ARROW, JetHighlightingColors.ARROW);
|
||||
|
||||
keys1.put(KtTokens.OPEN_QUOTE, JetHighlightingColors.STRING);
|
||||
keys1.put(KtTokens.CLOSING_QUOTE, JetHighlightingColors.STRING);
|
||||
keys1.put(KtTokens.REGULAR_STRING_PART, JetHighlightingColors.STRING);
|
||||
keys1.put(KtTokens.LONG_TEMPLATE_ENTRY_END, JetHighlightingColors.STRING_ESCAPE);
|
||||
keys1.put(KtTokens.LONG_TEMPLATE_ENTRY_START, JetHighlightingColors.STRING_ESCAPE);
|
||||
keys1.put(KtTokens.SHORT_TEMPLATE_ENTRY_START, JetHighlightingColors.STRING_ESCAPE);
|
||||
|
||||
keys1.put(KtTokens.ESCAPE_SEQUENCE, JetHighlightingColors.STRING_ESCAPE);
|
||||
|
||||
keys1.put(KtTokens.CHARACTER_LITERAL, JetHighlightingColors.STRING);
|
||||
|
||||
keys1.put(KtTokens.EOL_COMMENT, JetHighlightingColors.LINE_COMMENT);
|
||||
keys1.put(KtTokens.SHEBANG_COMMENT, JetHighlightingColors.LINE_COMMENT);
|
||||
keys1.put(KtTokens.BLOCK_COMMENT, JetHighlightingColors.BLOCK_COMMENT);
|
||||
keys1.put(KtTokens.DOC_COMMENT, JetHighlightingColors.DOC_COMMENT);
|
||||
|
||||
fillMap(keys1, KDocTokens.KDOC_HIGHLIGHT_TOKENS, JetHighlightingColors.DOC_COMMENT);
|
||||
keys1.put(KDocTokens.TAG_NAME, JetHighlightingColors.KDOC_TAG);
|
||||
keys2.put(KDocTokens.TAG_NAME, JetHighlightingColors.DOC_COMMENT);
|
||||
|
||||
keys1.put(TokenType.BAD_CHARACTER, JetHighlightingColors.BAD_CHARACTER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.highlighter;
|
||||
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.kdoc.lexer.KDocTokens;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class KotlinHighlighter extends SyntaxHighlighterBase {
|
||||
private static final Map<IElementType, TextAttributesKey> keys1;
|
||||
private static final Map<IElementType, TextAttributesKey> keys2;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Lexer getHighlightingLexer() {
|
||||
return new KotlinHighlightingLexer();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
|
||||
return pack(keys1.get(tokenType), keys2.get(tokenType));
|
||||
}
|
||||
|
||||
static {
|
||||
keys1 = new HashMap<IElementType, TextAttributesKey>();
|
||||
keys2 = new HashMap<IElementType, TextAttributesKey>();
|
||||
|
||||
fillMap(keys1, KtTokens.KEYWORDS, KotlinHighlightingColors.KEYWORD);
|
||||
|
||||
keys1.put(KtTokens.AS_SAFE, KotlinHighlightingColors.KEYWORD);
|
||||
keys1.put(KtTokens.INTEGER_LITERAL, KotlinHighlightingColors.NUMBER);
|
||||
keys1.put(KtTokens.FLOAT_LITERAL, KotlinHighlightingColors.NUMBER);
|
||||
|
||||
fillMap(keys1,
|
||||
TokenSet.andNot(KtTokens.OPERATIONS,
|
||||
TokenSet.orSet(
|
||||
TokenSet.create(KtTokens.IDENTIFIER, KtTokens.AT),
|
||||
KtTokens.KEYWORDS)),
|
||||
KotlinHighlightingColors.OPERATOR_SIGN);
|
||||
|
||||
keys1.put(KtTokens.LPAR, KotlinHighlightingColors.PARENTHESIS);
|
||||
keys1.put(KtTokens.RPAR, KotlinHighlightingColors.PARENTHESIS);
|
||||
keys1.put(KtTokens.LBRACE, KotlinHighlightingColors.BRACES);
|
||||
keys1.put(KtTokens.RBRACE, KotlinHighlightingColors.BRACES);
|
||||
keys1.put(KtTokens.LBRACKET, KotlinHighlightingColors.BRACKETS);
|
||||
keys1.put(KtTokens.RBRACKET, KotlinHighlightingColors.BRACKETS);
|
||||
keys1.put(KtTokens.COMMA, KotlinHighlightingColors.COMMA);
|
||||
keys1.put(KtTokens.SEMICOLON, KotlinHighlightingColors.SEMICOLON);
|
||||
keys1.put(KtTokens.DOT, KotlinHighlightingColors.DOT);
|
||||
keys1.put(KtTokens.ARROW, KotlinHighlightingColors.ARROW);
|
||||
|
||||
keys1.put(KtTokens.OPEN_QUOTE, KotlinHighlightingColors.STRING);
|
||||
keys1.put(KtTokens.CLOSING_QUOTE, KotlinHighlightingColors.STRING);
|
||||
keys1.put(KtTokens.REGULAR_STRING_PART, KotlinHighlightingColors.STRING);
|
||||
keys1.put(KtTokens.LONG_TEMPLATE_ENTRY_END, KotlinHighlightingColors.STRING_ESCAPE);
|
||||
keys1.put(KtTokens.LONG_TEMPLATE_ENTRY_START, KotlinHighlightingColors.STRING_ESCAPE);
|
||||
keys1.put(KtTokens.SHORT_TEMPLATE_ENTRY_START, KotlinHighlightingColors.STRING_ESCAPE);
|
||||
|
||||
keys1.put(KtTokens.ESCAPE_SEQUENCE, KotlinHighlightingColors.STRING_ESCAPE);
|
||||
|
||||
keys1.put(KtTokens.CHARACTER_LITERAL, KotlinHighlightingColors.STRING);
|
||||
|
||||
keys1.put(KtTokens.EOL_COMMENT, KotlinHighlightingColors.LINE_COMMENT);
|
||||
keys1.put(KtTokens.SHEBANG_COMMENT, KotlinHighlightingColors.LINE_COMMENT);
|
||||
keys1.put(KtTokens.BLOCK_COMMENT, KotlinHighlightingColors.BLOCK_COMMENT);
|
||||
keys1.put(KtTokens.DOC_COMMENT, KotlinHighlightingColors.DOC_COMMENT);
|
||||
|
||||
fillMap(keys1, KDocTokens.KDOC_HIGHLIGHT_TOKENS, KotlinHighlightingColors.DOC_COMMENT);
|
||||
keys1.put(KDocTokens.TAG_NAME, KotlinHighlightingColors.KDOC_TAG);
|
||||
keys2.put(KDocTokens.TAG_NAME, KotlinHighlightingColors.DOC_COMMENT);
|
||||
|
||||
keys1.put(TokenType.BAD_CHARACTER, KotlinHighlightingColors.BAD_CHARACTER);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -24,7 +24,7 @@ import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
|
||||
import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey;
|
||||
|
||||
public class JetHighlightingColors {
|
||||
public class KotlinHighlightingColors {
|
||||
// default keys (mostly syntax elements)
|
||||
public static final TextAttributesKey KEYWORD = createTextAttributesKey("KOTLIN_KEYWORD", JavaHighlightingColors.KEYWORD);
|
||||
public static final TextAttributesKey BUILTIN_ANNOTATION = createTextAttributesKey("KOTLIN_BUILTIN_ANNOTATION", JavaHighlightingColors.KEYWORD);
|
||||
@@ -87,6 +87,6 @@ public class JetHighlightingColors {
|
||||
public static final TextAttributesKey DEBUG_INFO = createTextAttributesKey("KOTLIN_DEBUG_INFO");
|
||||
public static final TextAttributesKey RESOLVED_TO_ERROR = createTextAttributesKey("KOTLIN_RESOLVED_TO_ERROR");
|
||||
|
||||
private JetHighlightingColors() {
|
||||
private KotlinHighlightingColors() {
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -22,8 +22,8 @@ import org.jetbrains.kotlin.kdoc.lexer.KDocLexer;
|
||||
import org.jetbrains.kotlin.lexer.KotlinLexer;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
|
||||
public class JetHighlightingLexer extends LayeredLexer {
|
||||
public JetHighlightingLexer() {
|
||||
public class KotlinHighlightingLexer extends LayeredLexer {
|
||||
public KotlinHighlightingLexer() {
|
||||
super(new KotlinLexer());
|
||||
|
||||
registerSelfStoppingLayer(new KDocLexer(), new IElementType[]{KtTokens.DOC_COMMENT}, IElementType.EMPTY_ARRAY);
|
||||
+2
-2
@@ -54,7 +54,7 @@ import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import java.lang.reflect.*
|
||||
import java.util.*
|
||||
|
||||
public open class JetPsiChecker : Annotator, HighlightRangeExtension {
|
||||
public open class KotlinPsiChecker : Annotator, HighlightRangeExtension {
|
||||
|
||||
override fun annotate(element: PsiElement, holder: AnnotationHolder) {
|
||||
if (!(ProjectRootsUtil.isInProjectOrLibraryContent(element) || element.getContainingFile() is KtCodeFragment)) return
|
||||
@@ -199,7 +199,7 @@ private class ElementAnnotator(private val element: PsiElement,
|
||||
}
|
||||
}
|
||||
|
||||
Errors.ILLEGAL_ESCAPE -> AnnotationPresentationInfo(ranges, textAttributes = JetHighlightingColors.INVALID_STRING_ESCAPE)
|
||||
Errors.ILLEGAL_ESCAPE -> AnnotationPresentationInfo(ranges, textAttributes = KotlinHighlightingColors.INVALID_STRING_ESCAPE)
|
||||
|
||||
Errors.REDECLARATION -> AnnotationPresentationInfo(
|
||||
ranges = listOf(diagnostic.getTextRanges().first()), nonDefaultMessage = "")
|
||||
+2
-2
@@ -20,10 +20,10 @@ import com.intellij.openapi.fileTypes.SingleLazyInstanceSyntaxHighlighterFactory
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class JetSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
|
||||
public class KotlinSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
|
||||
@Override
|
||||
@NotNull
|
||||
protected SyntaxHighlighter createHighlighter() {
|
||||
return new JetHighlighter();
|
||||
return new KotlinHighlighter();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -33,7 +33,7 @@ class LabelsHighlightingVisitor extends KtVisitorVoid {
|
||||
public void visitExpressionWithLabel(@NotNull KtExpressionWithLabel expression) {
|
||||
KtSimpleNameExpression targetLabel = expression.getTargetLabel();
|
||||
if (targetLabel != null) {
|
||||
NameHighlighter.highlightName(holder, targetLabel, JetHighlightingColors.LABEL);
|
||||
NameHighlighter.highlightName(holder, targetLabel, KotlinHighlightingColors.LABEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.KtParameter;
|
||||
import org.jetbrains.kotlin.psi.KtProperty;
|
||||
import org.jetbrains.kotlin.psi.KtSimpleNameExpression;
|
||||
@@ -44,7 +43,7 @@ class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
}
|
||||
DeclarationDescriptor target = bindingContext.get(BindingContext.REFERENCE_TARGET, expression);
|
||||
if (target instanceof SyntheticFieldDescriptor) {
|
||||
NameHighlighter.highlightName(holder, expression, JetHighlightingColors.BACKING_FIELD_VARIABLE);
|
||||
NameHighlighter.highlightName(holder, expression, KotlinHighlightingColors.BACKING_FIELD_VARIABLE);
|
||||
return;
|
||||
}
|
||||
if (!(target instanceof PropertyDescriptor)) {
|
||||
@@ -86,21 +85,21 @@ class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
boolean withBackingField
|
||||
) {
|
||||
if (DynamicCallsKt.isDynamic(descriptor)) {
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, JetHighlightingColors.DYNAMIC_PROPERTY_CALL);
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, KotlinHighlightingColors.DYNAMIC_PROPERTY_CALL);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isStatic = DescriptorUtils.isStaticDeclaration(descriptor);
|
||||
NameHighlighter.highlightName(
|
||||
holder, elementToHighlight,
|
||||
isStatic ? JetHighlightingColors.PACKAGE_PROPERTY : JetHighlightingColors.INSTANCE_PROPERTY
|
||||
isStatic ? KotlinHighlightingColors.PACKAGE_PROPERTY : KotlinHighlightingColors.INSTANCE_PROPERTY
|
||||
);
|
||||
if (descriptor.getExtensionReceiverParameter() != null) {
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, JetHighlightingColors.EXTENSION_PROPERTY);
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, KotlinHighlightingColors.EXTENSION_PROPERTY);
|
||||
}
|
||||
if (withBackingField) {
|
||||
holder.createInfoAnnotation(elementToHighlight, "This property has a backing field")
|
||||
.setTextAttributes(JetHighlightingColors.PROPERTY_WITH_BACKING_FIELD);
|
||||
.setTextAttributes(KotlinHighlightingColors.PROPERTY_WITH_BACKING_FIELD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -40,14 +40,14 @@ class SoftKeywordsHighlightingVisitor extends KtVisitorVoid {
|
||||
if (element instanceof LeafPsiElement) {
|
||||
IElementType elementType = ((LeafPsiElement)element).getElementType();
|
||||
if (KtTokens.SOFT_KEYWORDS.contains(elementType)) {
|
||||
TextAttributesKey attributes = JetHighlightingColors.KEYWORD;
|
||||
TextAttributesKey attributes = KotlinHighlightingColors.KEYWORD;
|
||||
if (KtTokens.MODIFIER_KEYWORDS.contains(elementType)) {
|
||||
attributes = JetHighlightingColors.BUILTIN_ANNOTATION;
|
||||
attributes = KotlinHighlightingColors.BUILTIN_ANNOTATION;
|
||||
}
|
||||
holder.createInfoAnnotation(element, null).setTextAttributes(attributes);
|
||||
}
|
||||
if (KtTokens.SAFE_ACCESS.equals(elementType)) {
|
||||
holder.createInfoAnnotation(element, null).setTextAttributes(JetHighlightingColors.SAFE_ACCESS);
|
||||
holder.createInfoAnnotation(element, null).setTextAttributes(KotlinHighlightingColors.SAFE_ACCESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,14 +56,14 @@ class SoftKeywordsHighlightingVisitor extends KtVisitorVoid {
|
||||
public void visitFunctionLiteralExpression(@NotNull KtFunctionLiteralExpression expression) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) return;
|
||||
KtFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
||||
holder.createInfoAnnotation(functionLiteral.getLBrace(), null).setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW);
|
||||
holder.createInfoAnnotation(functionLiteral.getLBrace(), null).setTextAttributes(KotlinHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW);
|
||||
PsiElement closingBrace = functionLiteral.getRBrace();
|
||||
if (closingBrace != null) {
|
||||
holder.createInfoAnnotation(closingBrace, null).setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW);
|
||||
holder.createInfoAnnotation(closingBrace, null).setTextAttributes(KotlinHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW);
|
||||
}
|
||||
PsiElement arrow = functionLiteral.getArrow();
|
||||
if (arrow != null) {
|
||||
holder.createInfoAnnotation(arrow, null).setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW);
|
||||
holder.createInfoAnnotation(arrow, null).setTextAttributes(KotlinHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -44,7 +44,7 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
|
||||
if (referenceTarget instanceof ClassDescriptor) {
|
||||
TextAttributesKey textAttributesKey = textAttributesKeyForClass((ClassDescriptor) referenceTarget);
|
||||
if (textAttributesKey == JetHighlightingColors.ANNOTATION) {
|
||||
if (textAttributesKey == KotlinHighlightingColors.ANNOTATION) {
|
||||
highlightAnnotation(expression);
|
||||
}
|
||||
else {
|
||||
@@ -52,21 +52,21 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
}
|
||||
}
|
||||
else if (referenceTarget instanceof TypeParameterDescriptor) {
|
||||
highlightName(expression, JetHighlightingColors.TYPE_PARAMETER);
|
||||
highlightName(expression, KotlinHighlightingColors.TYPE_PARAMETER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void highlightAnnotation(@NotNull KtSimpleNameExpression expression) {
|
||||
TextRange toHighlight = JetPsiUtilKt.getCalleeHighlightingRange(expression);
|
||||
NameHighlighter.highlightName(holder, toHighlight, JetHighlightingColors.ANNOTATION);
|
||||
NameHighlighter.highlightName(holder, toHighlight, KotlinHighlightingColors.ANNOTATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTypeParameter(@NotNull KtTypeParameter parameter) {
|
||||
PsiElement identifier = parameter.getNameIdentifier();
|
||||
if (identifier != null) {
|
||||
highlightName(identifier, JetHighlightingColors.TYPE_PARAMETER);
|
||||
highlightName(identifier, KotlinHighlightingColors.TYPE_PARAMETER);
|
||||
}
|
||||
super.visitTypeParameter(parameter);
|
||||
}
|
||||
@@ -94,17 +94,17 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
private static TextAttributesKey textAttributesKeyForClass(@NotNull ClassDescriptor descriptor) {
|
||||
switch (descriptor.getKind()) {
|
||||
case INTERFACE:
|
||||
return JetHighlightingColors.TRAIT;
|
||||
return KotlinHighlightingColors.TRAIT;
|
||||
case ANNOTATION_CLASS:
|
||||
return JetHighlightingColors.ANNOTATION;
|
||||
return KotlinHighlightingColors.ANNOTATION;
|
||||
case OBJECT:
|
||||
return JetHighlightingColors.OBJECT;
|
||||
return KotlinHighlightingColors.OBJECT;
|
||||
case ENUM_ENTRY:
|
||||
return JetHighlightingColors.ENUM_ENTRY;
|
||||
return KotlinHighlightingColors.ENUM_ENTRY;
|
||||
default:
|
||||
return descriptor.getModality() == Modality.ABSTRACT
|
||||
? JetHighlightingColors.ABSTRACT_CLASS
|
||||
: JetHighlightingColors.CLASS;
|
||||
? KotlinHighlightingColors.ABSTRACT_CLASS
|
||||
: KotlinHighlightingColors.CLASS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -47,7 +47,7 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
ValueParameterDescriptor parameterDescriptor = (ValueParameterDescriptor) target;
|
||||
if (Boolean.TRUE.equals(bindingContext.get(AUTO_CREATED_IT, parameterDescriptor))) {
|
||||
holder.createInfoAnnotation(expression, "Automatically declared based on the expected type").setTextAttributes(
|
||||
JetHighlightingColors.FUNCTION_LITERAL_DEFAULT_PARAMETER);
|
||||
KotlinHighlightingColors.FUNCTION_LITERAL_DEFAULT_PARAMETER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
KotlinType smartCast = bindingContext.get(SMARTCAST, expression);
|
||||
if (smartCast != null) {
|
||||
holder.createInfoAnnotation(expression, "Smart cast to " + DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(smartCast)).setTextAttributes(
|
||||
JetHighlightingColors.SMART_CAST_VALUE);
|
||||
KotlinHighlightingColors.SMART_CAST_VALUE);
|
||||
}
|
||||
super.visitExpression(expression);
|
||||
}
|
||||
@@ -90,27 +90,27 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
VariableDescriptor variableDescriptor = (VariableDescriptor) descriptor;
|
||||
|
||||
if (DynamicCallsKt.isDynamic(variableDescriptor)) {
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, JetHighlightingColors.DYNAMIC_PROPERTY_CALL);
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, KotlinHighlightingColors.DYNAMIC_PROPERTY_CALL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (variableDescriptor.isVar()) {
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, JetHighlightingColors.MUTABLE_VARIABLE);
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, KotlinHighlightingColors.MUTABLE_VARIABLE);
|
||||
}
|
||||
|
||||
if (bindingContext.get(CAPTURED_IN_CLOSURE, variableDescriptor) == CaptureKind.NOT_INLINE) {
|
||||
String msg = ((VariableDescriptor) descriptor).isVar()
|
||||
? "Wrapped into a reference object to be modified when captured in a closure"
|
||||
: "Value captured in a closure";
|
||||
holder.createInfoAnnotation(elementToHighlight, msg).setTextAttributes(JetHighlightingColors.WRAPPED_INTO_REF);
|
||||
holder.createInfoAnnotation(elementToHighlight, msg).setTextAttributes(KotlinHighlightingColors.WRAPPED_INTO_REF);
|
||||
}
|
||||
|
||||
if (descriptor instanceof LocalVariableDescriptor) {
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, JetHighlightingColors.LOCAL_VARIABLE);
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, KotlinHighlightingColors.LOCAL_VARIABLE);
|
||||
}
|
||||
|
||||
if (descriptor instanceof ValueParameterDescriptor) {
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, JetHighlightingColors.PARAMETER);
|
||||
NameHighlighter.highlightName(holder, elementToHighlight, KotlinHighlightingColors.PARAMETER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -31,7 +31,7 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.util.SmartList
|
||||
import org.jetbrains.kotlin.idea.intentions.JetSelfTargetingRangeIntention
|
||||
import org.jetbrains.kotlin.idea.intentions.SelfTargetingRangeIntention
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
|
||||
public abstract class IntentionBasedInspection<TElement : KtElement>(
|
||||
@@ -40,11 +40,11 @@ public abstract class IntentionBasedInspection<TElement : KtElement>(
|
||||
protected val elementType: Class<TElement>
|
||||
) : AbstractKotlinInspection() {
|
||||
|
||||
constructor(intention: JetSelfTargetingRangeIntention<TElement>, additionalChecker: (TElement) -> Boolean = { true })
|
||||
constructor(intention: SelfTargetingRangeIntention<TElement>, additionalChecker: (TElement) -> Boolean = { true })
|
||||
: this(listOf(IntentionData(intention, additionalChecker)), null, intention.elementType)
|
||||
|
||||
public data class IntentionData<TElement : KtElement>(
|
||||
val intention: JetSelfTargetingRangeIntention<TElement>,
|
||||
val intention: SelfTargetingRangeIntention<TElement>,
|
||||
val additionalChecker: (TElement) -> Boolean = { true }
|
||||
)
|
||||
|
||||
@@ -89,7 +89,7 @@ public abstract class IntentionBasedInspection<TElement : KtElement>(
|
||||
|
||||
/* we implement IntentionAction to provide isAvailable which will be used to hide outdated items and make sure we never call 'invoke' for such item */
|
||||
private class IntentionBasedQuickFix<TElement : KtElement>(
|
||||
private val intention: JetSelfTargetingRangeIntention<TElement>,
|
||||
private val intention: SelfTargetingRangeIntention<TElement>,
|
||||
private val text: String,
|
||||
private val additionalChecker: (TElement) -> Boolean,
|
||||
targetElement: TElement
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
|
||||
public class OperatorToFunctionIntention : JetSelfTargetingIntention<KtExpression>(javaClass(), "Replace overloaded operator with function call") {
|
||||
public class OperatorToFunctionIntention : SelfTargetingIntention<KtExpression>(javaClass(), "Replace overloaded operator with function call") {
|
||||
companion object {
|
||||
private fun isApplicablePrefix(element: KtPrefixExpression, caretOffset: Int): Boolean {
|
||||
val opRef = element.getOperationReference()
|
||||
|
||||
+8
-8
@@ -32,9 +32,9 @@ import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.psiUtil.containsInside
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
|
||||
import java.util.HashMap
|
||||
import java.util.*
|
||||
|
||||
public abstract class JetSelfTargetingIntention<TElement : KtElement>(
|
||||
public abstract class SelfTargetingIntention<TElement : KtElement>(
|
||||
public val elementType: Class<TElement>,
|
||||
private var text: String,
|
||||
private val familyName: String = text
|
||||
@@ -107,9 +107,9 @@ public abstract class JetSelfTargetingIntention<TElement : KtElement>(
|
||||
override fun toString(): String = getText()
|
||||
|
||||
companion object {
|
||||
private val intentionBasedInspections = HashMap<Class<out JetSelfTargetingIntention<*>>, IntentionBasedInspection<*>?>()
|
||||
private val intentionBasedInspections = HashMap<Class<out SelfTargetingIntention<*>>, IntentionBasedInspection<*>?>()
|
||||
|
||||
fun <TElement : KtElement> findInspection(intentionClass: Class<out JetSelfTargetingIntention<TElement>>): IntentionBasedInspection<TElement>? {
|
||||
fun <TElement : KtElement> findInspection(intentionClass: Class<out SelfTargetingIntention<TElement>>): IntentionBasedInspection<TElement>? {
|
||||
if (intentionBasedInspections.containsKey(intentionClass)) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return intentionBasedInspections[intentionClass] as IntentionBasedInspection<TElement>?
|
||||
@@ -129,11 +129,11 @@ public abstract class JetSelfTargetingIntention<TElement : KtElement>(
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class JetSelfTargetingRangeIntention<TElement : KtElement>(
|
||||
public abstract class SelfTargetingRangeIntention<TElement : KtElement>(
|
||||
elementType: Class<TElement>,
|
||||
text: String,
|
||||
familyName: String = text
|
||||
) : JetSelfTargetingIntention<TElement>(elementType, text, familyName) {
|
||||
) : SelfTargetingIntention<TElement>(elementType, text, familyName) {
|
||||
|
||||
public abstract fun applicabilityRange(element: TElement): TextRange?
|
||||
|
||||
@@ -143,11 +143,11 @@ public abstract class JetSelfTargetingRangeIntention<TElement : KtElement>(
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class JetSelfTargetingOffsetIndependentIntention<TElement : KtElement>(
|
||||
public abstract class SelfTargetingOffsetIndependentIntention<TElement : KtElement>(
|
||||
elementType: Class<TElement>,
|
||||
text: String,
|
||||
familyName: String = text
|
||||
) : JetSelfTargetingRangeIntention<TElement>(elementType, text, familyName) {
|
||||
) : SelfTargetingRangeIntention<TElement>(elementType, text, familyName) {
|
||||
|
||||
public abstract fun isApplicableTo(element: TElement): Boolean
|
||||
|
||||
@@ -19,13 +19,13 @@ package org.jetbrains.kotlin.idea.kdoc
|
||||
import com.intellij.lang.annotation.AnnotationHolder
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import org.jetbrains.kotlin.idea.highlighter.JetHighlightingColors
|
||||
import org.jetbrains.kotlin.idea.highlighter.KotlinHighlightingColors
|
||||
import org.jetbrains.kotlin.kdoc.psi.impl.KDocLink
|
||||
|
||||
class KDocHighlightingVisitor(private val holder: AnnotationHolder): PsiElementVisitor() {
|
||||
override fun visitElement(element: PsiElement) {
|
||||
if (element is KDocLink) {
|
||||
holder.createInfoAnnotation(element, null).setTextAttributes(JetHighlightingColors.KDOC_LINK)
|
||||
holder.createInfoAnnotation(element, null).setTextAttributes(KotlinHighlightingColors.KDOC_LINK)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.frontend.di.createContainerForBodyResolve
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.CodeFragmentAnalyzer
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetProbablyNothingFunctionShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetProbablyNothingPropertyShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinProbablyNothingFunctionShortNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinProbablyNothingPropertyShortNameIndex
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType
|
||||
@@ -105,8 +105,8 @@ public class ResolveElementCache(
|
||||
|
||||
private fun probablyNothingCallableNames(): ProbablyNothingCallableNames {
|
||||
return object : ProbablyNothingCallableNames {
|
||||
override fun functionNames() = JetProbablyNothingFunctionShortNameIndex.getInstance().getAllKeys(project)
|
||||
override fun propertyNames() = JetProbablyNothingPropertyShortNameIndex.getInstance().getAllKeys(project)
|
||||
override fun functionNames() = KotlinProbablyNothingFunctionShortNameIndex.getInstance().getAllKeys(project)
|
||||
override fun propertyNames() = KotlinProbablyNothingPropertyShortNameIndex.getInstance().getAllKeys(project)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.psi.KtCodeFragment
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
|
||||
public abstract class JetIntentionActionsFactory {
|
||||
public abstract class KotlinIntentionActionsFactory {
|
||||
protected open fun isApplicableForCodeFragment(): Boolean = false
|
||||
|
||||
protected abstract fun doCreateActions(diagnostic: Diagnostic): List<IntentionAction>
|
||||
+5
-5
@@ -21,11 +21,11 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.idea.JetBundle
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import com.intellij.codeInspection.SuppressIntentionAction
|
||||
import org.jetbrains.kotlin.idea.util.JetPsiPrecedences
|
||||
import org.jetbrains.kotlin.idea.util.PsiPrecedences
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
|
||||
public class KotlinSuppressIntentionAction(
|
||||
@@ -34,8 +34,8 @@ public class KotlinSuppressIntentionAction(
|
||||
private val kind: AnnotationHostKind
|
||||
) : SuppressIntentionAction() {
|
||||
|
||||
override fun getFamilyName() = JetBundle.message("suppress.warnings.family")
|
||||
override fun getText() = JetBundle.message("suppress.warning.for", diagnosticFactory.getName(), kind.kind, kind.name)
|
||||
override fun getFamilyName() = KotlinBundle.message("suppress.warnings.family")
|
||||
override fun getText() = KotlinBundle.message("suppress.warning.for", diagnosticFactory.getName(), kind.kind, kind.name)
|
||||
|
||||
override fun isAvailable(project: Project, editor: Editor?, element: PsiElement) = element.isValid()
|
||||
|
||||
@@ -93,7 +93,7 @@ public class KotlinSuppressIntentionAction(
|
||||
val suppressAt = caretBox.expression
|
||||
assert(suppressAt !is KtDeclaration) { "Declarations should have been checked for above" }
|
||||
|
||||
val parentheses = JetPsiPrecedences.getPrecedence(suppressAt) > JetPsiPrecedences.PRECEDENCE_OF_PREFIX_EXPRESSION
|
||||
val parentheses = PsiPrecedences.getPrecedence(suppressAt) > PsiPrecedences.PRECEDENCE_OF_PREFIX_EXPRESSION
|
||||
val placeholderText = "PLACEHOLDER_ID"
|
||||
val inner = if (parentheses) "($placeholderText)" else placeholderText
|
||||
val annotatedExpression = KtPsiFactory(suppressAt).createExpression(suppressAnnotationText(id) + "\n" + inner)
|
||||
|
||||
@@ -25,14 +25,14 @@ import com.intellij.openapi.extensions.Extensions
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
|
||||
|
||||
public class QuickFixes {
|
||||
private val factories: Multimap<DiagnosticFactory<*>, JetIntentionActionsFactory> = HashMultimap.create<DiagnosticFactory<*>, JetIntentionActionsFactory>()
|
||||
private val factories: Multimap<DiagnosticFactory<*>, KotlinIntentionActionsFactory> = HashMultimap.create<DiagnosticFactory<*>, KotlinIntentionActionsFactory>()
|
||||
private val actions: Multimap<DiagnosticFactory<*>, IntentionAction> = HashMultimap.create<DiagnosticFactory<*>, IntentionAction>()
|
||||
|
||||
init {
|
||||
Extensions.getExtensions(QuickFixContributor.EP_NAME).forEach { it.registerQuickFixes(this) }
|
||||
}
|
||||
|
||||
public fun register(diagnosticFactory: DiagnosticFactory<*>, vararg factory: JetIntentionActionsFactory) {
|
||||
public fun register(diagnosticFactory: DiagnosticFactory<*>, vararg factory: KotlinIntentionActionsFactory) {
|
||||
factories.putAll(diagnosticFactory, factory.toList())
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class QuickFixes {
|
||||
actions.putAll(diagnosticFactory, action.toList())
|
||||
}
|
||||
|
||||
public fun getActionFactories(diagnosticFactory: DiagnosticFactory<*>): Collection<JetIntentionActionsFactory> {
|
||||
public fun getActionFactories(diagnosticFactory: DiagnosticFactory<*>): Collection<KotlinIntentionActionsFactory> {
|
||||
return factories.get(diagnosticFactory)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class QuickFixes {
|
||||
return actions.get(diagnosticFactory)
|
||||
}
|
||||
|
||||
public fun getDiagnostics(factory: JetIntentionActionsFactory): Collection<DiagnosticFactory<*>> {
|
||||
public fun getDiagnostics(factory: KotlinIntentionActionsFactory): Collection<DiagnosticFactory<*>> {
|
||||
return factories.keySet().filter { factory in factories.get(it) }
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ import com.intellij.codeInsight.highlighting.JavaReadWriteAccessDetector
|
||||
import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiReference
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightMethod
|
||||
import org.jetbrains.kotlin.asJava.KtLightMethod
|
||||
import org.jetbrains.kotlin.idea.references.ReferenceAccess
|
||||
import org.jetbrains.kotlin.idea.references.readWriteAccess
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
@@ -38,7 +38,7 @@ public class KotlinReadWriteAccessDetector : ReadWriteAccessDetector() {
|
||||
}
|
||||
|
||||
val refTarget = reference.resolve()
|
||||
if (refTarget is KotlinLightMethod) {
|
||||
if (refTarget is KtLightMethod) {
|
||||
val origin = refTarget.getOrigin()
|
||||
val declaration: KtNamedDeclaration = when (origin) {
|
||||
is KtPropertyAccessor -> origin.getNonStrictParentOfType<KtProperty>()
|
||||
|
||||
+8
-8
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
|
||||
import org.jetbrains.kotlin.idea.search.KOTLIN_NAMED_ARGUMENT_SEARCH_CONTEXT
|
||||
import org.jetbrains.kotlin.idea.search.allScope
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.*
|
||||
import org.jetbrains.kotlin.idea.stubindex.JetSourceFilterScope
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
@@ -110,7 +110,7 @@ public class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, Referenc
|
||||
var namedArgsScope = function.useScope.intersectWith(queryParameters.scopeDeterminedByUser)
|
||||
|
||||
if (namedArgsScope is GlobalSearchScope) {
|
||||
namedArgsScope = JetSourceFilterScope.kotlinSourcesAndLibraries(namedArgsScope, project)
|
||||
namedArgsScope = KotlinSourceFilterScope.kotlinSourcesAndLibraries(namedArgsScope, project)
|
||||
|
||||
val filesWithFunctionName = CacheManager.SERVICE.getInstance(project).getVirtualFilesWithWord(
|
||||
function.name!!, UsageSearchContext.IN_CODE, namedArgsScope, true)
|
||||
@@ -190,9 +190,9 @@ public class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, Referenc
|
||||
val originClass = element.getStrictParentOfType<KtClass>()
|
||||
val originLightClass = LightClassUtil.getPsiClass(originClass)
|
||||
if (originLightClass != null) {
|
||||
val lightDeclarations: List<KotlinLightElement<*, *>?> =
|
||||
originLightClass.methods.map { it as? KotlinLightMethod } +
|
||||
originLightClass.fields.map { it as? KotlinLightField }
|
||||
val lightDeclarations: List<KtLightElement<*, *>?> =
|
||||
originLightClass.methods.map { it as? KtLightMethod } +
|
||||
originLightClass.fields.map { it as? KtLightField }
|
||||
|
||||
for (declaration in element.declarations) {
|
||||
val lightDeclaration = lightDeclarations.find { it?.getOrigin() == declaration }
|
||||
@@ -216,7 +216,7 @@ public class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, Referenc
|
||||
val originClass = originObject.getStrictParentOfType<KtClass>()
|
||||
val originLightClass = LightClassUtil.getPsiClass(originClass)
|
||||
val allMethods = originLightClass?.allMethods
|
||||
return allMethods?.find { it is KotlinLightMethod && it.getOrigin() == function }
|
||||
return allMethods?.find { it is KtLightMethod && it.getOrigin() == function }
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, Referenc
|
||||
}
|
||||
}
|
||||
|
||||
is KotlinLightMethod -> {
|
||||
is KtLightMethod -> {
|
||||
val declaration = element.getOrigin()
|
||||
if (declaration is KtProperty || (declaration is KtParameter && declaration.hasValOrVar())) {
|
||||
searchNamedElement(queryParameters, declaration as PsiNamedElement)
|
||||
@@ -289,7 +289,7 @@ public class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, Referenc
|
||||
}
|
||||
}
|
||||
|
||||
is KotlinLightParameter -> {
|
||||
is KtLightParameter -> {
|
||||
val origin = element.getOrigin() ?: return
|
||||
runReadAction {
|
||||
val componentFunctionDescriptor = origin.dataClassComponentFunction()
|
||||
|
||||
@@ -126,9 +126,9 @@ private fun PsiElement.processDelegationCallKotlinConstructorUsages(scope: Searc
|
||||
}
|
||||
|
||||
private fun PsiElement.processDelegationCallJavaConstructorUsages(scope: SearchScope, process: (KtCallElement) -> Boolean): Boolean {
|
||||
if (this is KotlinLightElement<*, *>) return true
|
||||
if (this is KtLightElement<*, *>) return true
|
||||
// TODO: Temporary hack to avoid NPE while KotlinNoOriginLightMethod is around
|
||||
if (this is KotlinLightMethod && this.getOrigin() == null) return true
|
||||
if (this is KtLightMethod && this.getOrigin() == null) return true
|
||||
if (!(this is PsiMethod && isConstructor())) return true
|
||||
val klass = getContainingClass() ?: return true
|
||||
val descriptor = getJavaMethodDescriptor() as? ConstructorDescriptor ?: return true
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
|
||||
public class KotlinInheritedMembersNodeProvider: InheritedMembersNodeProvider<TreeElement>() {
|
||||
override fun provideNodes(node: TreeElement): Collection<TreeElement> {
|
||||
if (node !is JetStructureViewElement) return listOf()
|
||||
if (node !is KotlinStructureViewElement) return listOf()
|
||||
|
||||
val element = node.getElement()
|
||||
if (element !is KtClassOrObject) return listOf()
|
||||
@@ -53,7 +53,7 @@ public class KotlinInheritedMembersNodeProvider: InheritedMembersNodeProvider<Tr
|
||||
CallableMemberDescriptor.Kind.DELEGATION -> {
|
||||
val superTypeMember = DescriptorToSourceUtilsIde.getAnyDeclaration(project, memberDescriptor)
|
||||
if (superTypeMember is NavigatablePsiElement) {
|
||||
children.add(JetStructureViewElement(superTypeMember, memberDescriptor, true))
|
||||
children.add(KotlinStructureViewElement(superTypeMember, memberDescriptor, true))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.kotlin.idea.JetDescriptorIconProvider;
|
||||
import org.jetbrains.kotlin.idea.KotlinDescriptorIconProvider;
|
||||
import org.jetbrains.kotlin.psi.KtClassInitializer;
|
||||
import org.jetbrains.kotlin.psi.KtModifierListOwner;
|
||||
import org.jetbrains.kotlin.psi.KtPsiUtil;
|
||||
@@ -111,7 +111,7 @@ class KotlinStructureElementPresentation implements ColoredItemPresentation, Loc
|
||||
@Nullable
|
||||
private static Icon getElementIcon(@NotNull NavigatablePsiElement navigatablePsiElement, @Nullable DeclarationDescriptor descriptor) {
|
||||
if (descriptor != null) {
|
||||
return JetDescriptorIconProvider.getIcon(descriptor, navigatablePsiElement, Iconable.ICON_FLAG_VISIBILITY);
|
||||
return KotlinDescriptorIconProvider.getIcon(descriptor, navigatablePsiElement, Iconable.ICON_FLAG_VISIBILITY);
|
||||
}
|
||||
|
||||
return PsiIconUtil.getProvidersIcon(navigatablePsiElement, Iconable.ICON_FLAG_VISIBILITY);
|
||||
|
||||
+5
-5
@@ -39,13 +39,13 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class JetStructureViewElement implements StructureViewTreeElement, Queryable {
|
||||
public class KotlinStructureViewElement implements StructureViewTreeElement, Queryable {
|
||||
private final NavigatablePsiElement element;
|
||||
private final boolean isInherited;
|
||||
|
||||
private KotlinStructureElementPresentation presentation;
|
||||
|
||||
public JetStructureViewElement(@NotNull NavigatablePsiElement element, @NotNull DeclarationDescriptor descriptor, boolean isInherited) {
|
||||
public KotlinStructureViewElement(@NotNull NavigatablePsiElement element, @NotNull DeclarationDescriptor descriptor, boolean isInherited) {
|
||||
this.element = element;
|
||||
this.isInherited = isInherited;
|
||||
|
||||
@@ -55,12 +55,12 @@ public class JetStructureViewElement implements StructureViewTreeElement, Querya
|
||||
}
|
||||
}
|
||||
|
||||
public JetStructureViewElement(@NotNull NavigatablePsiElement element, boolean isInherited) {
|
||||
public KotlinStructureViewElement(@NotNull NavigatablePsiElement element, boolean isInherited) {
|
||||
this.element = element;
|
||||
this.isInherited = isInherited;
|
||||
}
|
||||
|
||||
public JetStructureViewElement(@NotNull KtFile fileElement) {
|
||||
public KotlinStructureViewElement(@NotNull KtFile fileElement) {
|
||||
element = fileElement;
|
||||
isInherited = false;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class JetStructureViewElement implements StructureViewTreeElement, Querya
|
||||
return ArrayUtil.toObjectArray(ContainerUtil.map(childrenDeclarations, new Function<KtDeclaration, TreeElement>() {
|
||||
@Override
|
||||
public TreeElement fun(KtDeclaration declaration) {
|
||||
return new JetStructureViewElement(declaration, false);
|
||||
return new KotlinStructureViewElement(declaration, false);
|
||||
}
|
||||
}), TreeElement.class);
|
||||
}
|
||||
+2
-2
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
|
||||
public class JetStructureViewFactory implements PsiStructureViewFactory {
|
||||
public class KotlinStructureViewFactory implements PsiStructureViewFactory {
|
||||
@Override
|
||||
public StructureViewBuilder getStructureViewBuilder(PsiFile psiFile) {
|
||||
if (psiFile instanceof KtFile) {
|
||||
@@ -36,7 +36,7 @@ public class JetStructureViewFactory implements PsiStructureViewFactory {
|
||||
@NotNull
|
||||
@Override
|
||||
public StructureViewModel createStructureViewModel(@Nullable Editor editor) {
|
||||
return new JetStructureViewModel(file);
|
||||
return new KotlinStructureViewModel(file);
|
||||
}
|
||||
};
|
||||
}
|
||||
+3
-3
@@ -26,14 +26,14 @@ import org.jetbrains.kotlin.psi.KtFile;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetStructureViewModel extends StructureViewModelBase {
|
||||
public class KotlinStructureViewModel extends StructureViewModelBase {
|
||||
private static final Collection<NodeProvider> NODE_PROVIDERS = Arrays.<NodeProvider>asList(
|
||||
new KotlinInheritedMembersNodeProvider());
|
||||
|
||||
private static final Sorter[] sorters = new Sorter[] {Sorter.ALPHA_SORTER};
|
||||
|
||||
public JetStructureViewModel(@NotNull KtFile jetFile) {
|
||||
super(jetFile, new JetStructureViewElement(jetFile));
|
||||
public KotlinStructureViewModel(@NotNull KtFile jetFile) {
|
||||
super(jetFile, new KotlinStructureViewElement(jetFile));
|
||||
withSuitableClasses(KtDeclaration.class);
|
||||
}
|
||||
|
||||
+6
-6
@@ -16,18 +16,18 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.structureView
|
||||
|
||||
import com.intellij.ide.structureView.StructureViewBuilder
|
||||
import com.intellij.ide.structureView.StructureViewBuilderProvider
|
||||
import com.intellij.openapi.fileTypes.FileType
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ide.structureView.StructureViewBuilder
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiManager
|
||||
import org.jetbrains.kotlin.idea.decompiler.JetClsFile
|
||||
import org.jetbrains.kotlin.idea.decompiler.KtClsFile
|
||||
|
||||
//TODO: workaround for bug in JavaClsStructureViewBuilderProvider, remove when IDEA api is updated
|
||||
public class JetClsStructureViewBuilderProvider : StructureViewBuilderProvider {
|
||||
public class KtClsStructureViewBuilderProvider : StructureViewBuilderProvider {
|
||||
override fun getStructureViewBuilder(fileType: FileType, file: VirtualFile, project: Project): StructureViewBuilder? {
|
||||
val psiFile = PsiManager.getInstance(project).findFile(file) as? JetClsFile ?: return null
|
||||
return JetStructureViewFactory().getStructureViewBuilder(psiFile)
|
||||
val psiFile = PsiManager.getInstance(project).findFile(file) as? KtClsFile ?: return null
|
||||
return KotlinStructureViewFactory().getStructureViewBuilder(psiFile)
|
||||
}
|
||||
}
|
||||
+24
-24
@@ -44,18 +44,18 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
public void indexFile(KotlinFileStub stub, IndexSink sink) {
|
||||
FqName packageFqName = stub.getPackageFqName();
|
||||
|
||||
sink.occurrence(JetExactPackagesIndex.getInstance().getKey(), packageFqName.asString());
|
||||
sink.occurrence(KotlinExactPackagesIndex.getInstance().getKey(), packageFqName.asString());
|
||||
|
||||
FqName facadeFqName = ((KotlinFileStubForIde) stub).getFacadeFqName();
|
||||
if (facadeFqName != null) {
|
||||
sink.occurrence(JetFileFacadeFqNameIndex.INSTANCE.getKey(), facadeFqName.asString());
|
||||
sink.occurrence(JetFileFacadeShortNameIndex.INSTANCE.getKey(), facadeFqName.shortName().asString());
|
||||
sink.occurrence(JetFileFacadeClassByPackageIndex.INSTANCE.getKey(), packageFqName.asString());
|
||||
sink.occurrence(KotlinFileFacadeFqNameIndex.INSTANCE.getKey(), facadeFqName.asString());
|
||||
sink.occurrence(KotlinFileFacadeShortNameIndex.INSTANCE.getKey(), facadeFqName.shortName().asString());
|
||||
sink.occurrence(KotlinFileFacadeClassByPackageIndex.INSTANCE.getKey(), packageFqName.asString());
|
||||
}
|
||||
|
||||
FqName partFqName = ((KotlinFileStubForIde) stub).getPartFqName();
|
||||
if (partFqName != null) {
|
||||
sink.occurrence(JetFilePartClassIndex.INSTANCE.getKey(), partFqName.asString());
|
||||
sink.occurrence(KotlinFilePartClassIndex.INSTANCE.getKey(), partFqName.asString());
|
||||
}
|
||||
|
||||
List<StringRef> partNames = ((KotlinFileStubForIde) stub).getFacadePartSimpleNames();
|
||||
@@ -66,7 +66,7 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
continue;
|
||||
}
|
||||
FqName multifileClassPartFqName = packageFqName.child(Name.identifier(partSimpleName));
|
||||
sink.occurrence(JetMultifileClassPartIndex.INSTANCE.getKey(), multifileClassPartFqName.asString());
|
||||
sink.occurrence(KotlinMultifileClassPartIndex.INSTANCE.getKey(), multifileClassPartFqName.asString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,20 +75,20 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
public void indexClass(KotlinClassStub stub, IndexSink sink) {
|
||||
String name = stub.getName();
|
||||
if (name != null) {
|
||||
sink.occurrence(JetClassShortNameIndex.getInstance().getKey(), name);
|
||||
sink.occurrence(KotlinClassShortNameIndex.getInstance().getKey(), name);
|
||||
}
|
||||
|
||||
FqName fqName = stub.getFqName();
|
||||
if (fqName != null) {
|
||||
sink.occurrence(JetFullClassNameIndex.getInstance().getKey(), fqName.asString());
|
||||
sink.occurrence(KotlinFullClassNameIndex.getInstance().getKey(), fqName.asString());
|
||||
|
||||
if (stub.isTopLevel()) {
|
||||
sink.occurrence(JetTopLevelClassByPackageIndex.getInstance().getKey(), fqName.parent().asString());
|
||||
sink.occurrence(KotlinTopLevelClassByPackageIndex.getInstance().getKey(), fqName.parent().asString());
|
||||
}
|
||||
}
|
||||
|
||||
if (stub.isInterface()) {
|
||||
sink.occurrence(JetClassShortNameIndex.getInstance().getKey(), JvmAbi.DEFAULT_IMPLS_CLASS_NAME);
|
||||
sink.occurrence(KotlinClassShortNameIndex.getInstance().getKey(), JvmAbi.DEFAULT_IMPLS_CLASS_NAME);
|
||||
}
|
||||
|
||||
indexSuperNames(stub, sink);
|
||||
@@ -98,15 +98,15 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
public void indexObject(KotlinObjectStub stub, IndexSink sink) {
|
||||
String name = stub.getName();
|
||||
if (name != null) {
|
||||
sink.occurrence(JetClassShortNameIndex.getInstance().getKey(), name);
|
||||
sink.occurrence(KotlinClassShortNameIndex.getInstance().getKey(), name);
|
||||
}
|
||||
|
||||
FqName fqName = stub.getFqName();
|
||||
if (fqName != null) {
|
||||
sink.occurrence(JetFullClassNameIndex.getInstance().getKey(), fqName.asString());
|
||||
sink.occurrence(KotlinFullClassNameIndex.getInstance().getKey(), fqName.asString());
|
||||
|
||||
if (stub.isTopLevel()) {
|
||||
sink.occurrence(JetTopLevelClassByPackageIndex.getInstance().getKey(), fqName.parent().asString());
|
||||
sink.occurrence(KotlinTopLevelClassByPackageIndex.getInstance().getKey(), fqName.parent().asString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
|
||||
private static void indexSuperNames(KotlinClassOrObjectStub<? extends KtClassOrObject> stub, IndexSink sink) {
|
||||
for (String superName : stub.getSuperNames()) {
|
||||
sink.occurrence(JetSuperClassIndex.getInstance().getKey(), superName);
|
||||
sink.occurrence(KotlinSuperClassIndex.getInstance().getKey(), superName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,10 +123,10 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
public void indexFunction(KotlinFunctionStub stub, IndexSink sink) {
|
||||
String name = stub.getName();
|
||||
if (name != null) {
|
||||
sink.occurrence(JetFunctionShortNameIndex.getInstance().getKey(), name);
|
||||
sink.occurrence(KotlinFunctionShortNameIndex.getInstance().getKey(), name);
|
||||
|
||||
if (TypeIndexUtilKt.isProbablyNothing(stub.getPsi().getTypeReference())) {
|
||||
sink.occurrence(JetProbablyNothingFunctionShortNameIndex.getInstance().getKey(), name);
|
||||
sink.occurrence(KotlinProbablyNothingFunctionShortNameIndex.getInstance().getKey(), name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +134,8 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
// can have special fq name in case of syntactically incorrect function with no name
|
||||
FqName fqName = stub.getFqName();
|
||||
if (fqName != null) {
|
||||
sink.occurrence(JetTopLevelFunctionFqnNameIndex.getInstance().getKey(), fqName.asString());
|
||||
sink.occurrence(JetTopLevelFunctionByPackageIndex.getInstance().getKey(), fqName.parent().asString());
|
||||
sink.occurrence(KotlinTopLevelFunctionFqnNameIndex.getInstance().getKey(), fqName.asString());
|
||||
sink.occurrence(KotlinTopLevelFunctionByPackageIndex.getInstance().getKey(), fqName.parent().asString());
|
||||
IndexUtilsKt.indexTopLevelExtension(stub, sink);
|
||||
}
|
||||
}
|
||||
@@ -145,10 +145,10 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
public void indexProperty(KotlinPropertyStub stub, IndexSink sink) {
|
||||
String name = stub.getName();
|
||||
if (name != null) {
|
||||
sink.occurrence(JetPropertyShortNameIndex.getInstance().getKey(), name);
|
||||
sink.occurrence(KotlinPropertyShortNameIndex.getInstance().getKey(), name);
|
||||
|
||||
if (TypeIndexUtilKt.isProbablyNothing(stub.getPsi().getTypeReference())) {
|
||||
sink.occurrence(JetProbablyNothingPropertyShortNameIndex.getInstance().getKey(), name);
|
||||
sink.occurrence(KotlinProbablyNothingPropertyShortNameIndex.getInstance().getKey(), name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,8 +156,8 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
FqName fqName = stub.getFqName();
|
||||
// can have special fq name in case of syntactically incorrect property with no name
|
||||
if (fqName != null) {
|
||||
sink.occurrence(JetTopLevelPropertyFqnNameIndex.getInstance().getKey(), fqName.asString());
|
||||
sink.occurrence(JetTopLevelPropertyByPackageIndex.getInstance().getKey(), fqName.parent().asString());
|
||||
sink.occurrence(KotlinTopLevelPropertyFqnNameIndex.getInstance().getKey(), fqName.asString());
|
||||
sink.occurrence(KotlinTopLevelPropertyByPackageIndex.getInstance().getKey(), fqName.parent().asString());
|
||||
IndexUtilsKt.indexTopLevelExtension(stub, sink);
|
||||
}
|
||||
}
|
||||
@@ -165,13 +165,13 @@ public class IdeStubIndexService extends StubIndexService {
|
||||
|
||||
@Override
|
||||
public void indexAnnotation(KotlinAnnotationEntryStub stub, IndexSink sink) {
|
||||
sink.occurrence(JetAnnotationsIndex.getInstance().getKey(), stub.getShortName());
|
||||
sink.occurrence(KotlinAnnotationsIndex.getInstance().getKey(), stub.getShortName());
|
||||
|
||||
KotlinFileStub fileStub = getContainingFileStub(stub);
|
||||
if (fileStub != null) {
|
||||
List<KotlinImportDirectiveStub> aliasImportStubs = fileStub.findImportsByAlias(stub.getShortName());
|
||||
for (KotlinImportDirectiveStub importStub : aliasImportStubs) {
|
||||
sink.occurrence(JetAnnotationsIndex.getInstance().getKey(), importStub.getImportedFqName().shortName().asString());
|
||||
sink.occurrence(KotlinAnnotationsIndex.getInstance().getKey(), importStub.getImportedFqName().shortName().asString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ fun indexTopLevelExtension<TDeclaration : KtCallableDeclaration>(stub: KotlinCal
|
||||
private fun KtTypeElement.index<TDeclaration : KtCallableDeclaration>(declaration: TDeclaration, sink: IndexSink) {
|
||||
fun occurrence(typeName: String) {
|
||||
val name = declaration.getName() ?: return
|
||||
sink.occurrence(JetTopLevelExtensionsByReceiverTypeIndex.INSTANCE.getKey(),
|
||||
JetTopLevelExtensionsByReceiverTypeIndex.buildKey(typeName, name))
|
||||
sink.occurrence(KotlinTopLevelExtensionsByReceiverTypeIndex.INSTANCE.getKey(),
|
||||
KotlinTopLevelExtensionsByReceiverTypeIndex.buildKey(typeName, name))
|
||||
}
|
||||
|
||||
when (this) {
|
||||
|
||||
+6
-6
@@ -25,16 +25,16 @@ import org.jetbrains.kotlin.psi.KtAnnotationEntry;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetAnnotationsIndex extends StringStubIndexExtension<KtAnnotationEntry> {
|
||||
private static final StubIndexKey<String, KtAnnotationEntry> KEY = KotlinIndexUtil.createIndexKey(JetAnnotationsIndex.class);
|
||||
public class KotlinAnnotationsIndex extends StringStubIndexExtension<KtAnnotationEntry> {
|
||||
private static final StubIndexKey<String, KtAnnotationEntry> KEY = KotlinIndexUtil.createIndexKey(KotlinAnnotationsIndex.class);
|
||||
|
||||
private static final JetAnnotationsIndex ourInstance = new JetAnnotationsIndex();
|
||||
private static final KotlinAnnotationsIndex ourInstance = new KotlinAnnotationsIndex();
|
||||
|
||||
public static JetAnnotationsIndex getInstance() {
|
||||
public static KotlinAnnotationsIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetAnnotationsIndex() {}
|
||||
private KotlinAnnotationsIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -45,7 +45,7 @@ public class JetAnnotationsIndex extends StringStubIndexExtension<KtAnnotationEn
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtAnnotationEntry> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
|
||||
@Override
|
||||
+6
-6
@@ -25,17 +25,17 @@ import org.jetbrains.kotlin.psi.KtClassOrObject;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetClassShortNameIndex extends StringStubIndexExtension<KtClassOrObject> {
|
||||
private static final StubIndexKey<String, KtClassOrObject> KEY = KotlinIndexUtil.createIndexKey(JetClassShortNameIndex.class);
|
||||
public class KotlinClassShortNameIndex extends StringStubIndexExtension<KtClassOrObject> {
|
||||
private static final StubIndexKey<String, KtClassOrObject> KEY = KotlinIndexUtil.createIndexKey(KotlinClassShortNameIndex.class);
|
||||
|
||||
private static final JetClassShortNameIndex ourInstance = new JetClassShortNameIndex();
|
||||
private static final KotlinClassShortNameIndex ourInstance = new KotlinClassShortNameIndex();
|
||||
|
||||
@NotNull
|
||||
public static JetClassShortNameIndex getInstance() {
|
||||
public static KotlinClassShortNameIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetClassShortNameIndex() {}
|
||||
private KotlinClassShortNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -46,6 +46,6 @@ public class JetClassShortNameIndex extends StringStubIndexExtension<KtClassOrOb
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtClassOrObject> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -25,17 +25,17 @@ import org.jetbrains.kotlin.psi.KtFile;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetExactPackagesIndex extends StringStubIndexExtension<KtFile> {
|
||||
private static final StubIndexKey<String, KtFile> KEY = KotlinIndexUtil.createIndexKey(JetExactPackagesIndex.class);
|
||||
public class KotlinExactPackagesIndex extends StringStubIndexExtension<KtFile> {
|
||||
private static final StubIndexKey<String, KtFile> KEY = KotlinIndexUtil.createIndexKey(KotlinExactPackagesIndex.class);
|
||||
|
||||
private static final JetExactPackagesIndex ourInstance = new JetExactPackagesIndex();
|
||||
private static final KotlinExactPackagesIndex ourInstance = new KotlinExactPackagesIndex();
|
||||
|
||||
@NotNull
|
||||
public static JetExactPackagesIndex getInstance() {
|
||||
public static KotlinExactPackagesIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetExactPackagesIndex() {}
|
||||
private KotlinExactPackagesIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -46,6 +46,6 @@ public class JetExactPackagesIndex extends StringStubIndexExtension<KtFile> {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtFile> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(fqName, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(fqName, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -22,16 +22,16 @@ import com.intellij.psi.stubs.StringStubIndexExtension
|
||||
import com.intellij.psi.stubs.StubIndexKey
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
public class JetFileFacadeClassByPackageIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
public class KotlinFileFacadeClassByPackageIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
override fun getKey(): StubIndexKey<String, KtFile> = KEY
|
||||
|
||||
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
|
||||
super.get(key, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
super.get(key, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
|
||||
companion object {
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(JetFileFacadeClassByPackageIndex::class.java)
|
||||
public val INSTANCE: JetFileFacadeClassByPackageIndex = JetFileFacadeClassByPackageIndex()
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(KotlinFileFacadeClassByPackageIndex::class.java)
|
||||
public val INSTANCE: KotlinFileFacadeClassByPackageIndex = KotlinFileFacadeClassByPackageIndex()
|
||||
@JvmStatic
|
||||
public fun getInstance(): JetFileFacadeClassByPackageIndex = INSTANCE
|
||||
public fun getInstance(): KotlinFileFacadeClassByPackageIndex = INSTANCE
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -22,16 +22,16 @@ import com.intellij.psi.stubs.StringStubIndexExtension
|
||||
import com.intellij.psi.stubs.StubIndexKey
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
public class JetFileFacadeShortNameIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
public class KotlinFileFacadeFqNameIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
override fun getKey(): StubIndexKey<String, KtFile> = KEY
|
||||
|
||||
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
|
||||
super.get(key, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
super.get(key, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
|
||||
companion object {
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(JetFileFacadeShortNameIndex::class.java)
|
||||
public val INSTANCE: JetFileFacadeShortNameIndex = JetFileFacadeShortNameIndex()
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(KotlinFileFacadeFqNameIndex::class.java)
|
||||
public val INSTANCE: KotlinFileFacadeFqNameIndex = KotlinFileFacadeFqNameIndex()
|
||||
@JvmStatic
|
||||
public fun getInstance(): JetFileFacadeShortNameIndex = INSTANCE
|
||||
public fun getInstance(): KotlinFileFacadeFqNameIndex = INSTANCE
|
||||
}
|
||||
}
|
||||
+5
-6
@@ -22,17 +22,16 @@ import com.intellij.psi.stubs.StringStubIndexExtension
|
||||
import com.intellij.psi.stubs.StubIndexKey
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
|
||||
public class JetFilePartClassIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
public class KotlinFileFacadeShortNameIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
override fun getKey(): StubIndexKey<String, KtFile> = KEY
|
||||
|
||||
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
|
||||
super.get(key, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
super.get(key, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
|
||||
companion object {
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(JetFilePartClassIndex::class.java)
|
||||
public val INSTANCE: JetFilePartClassIndex = JetFilePartClassIndex()
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(KotlinFileFacadeShortNameIndex::class.java)
|
||||
public val INSTANCE: KotlinFileFacadeShortNameIndex = KotlinFileFacadeShortNameIndex()
|
||||
@JvmStatic
|
||||
public fun getInstance(): JetFilePartClassIndex = INSTANCE
|
||||
public fun getInstance(): KotlinFileFacadeShortNameIndex = INSTANCE
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -22,16 +22,17 @@ import com.intellij.psi.stubs.StringStubIndexExtension
|
||||
import com.intellij.psi.stubs.StubIndexKey
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
public class JetFileFacadeFqNameIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
|
||||
public class KotlinFilePartClassIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
override fun getKey(): StubIndexKey<String, KtFile> = KEY
|
||||
|
||||
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
|
||||
super.get(key, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
super.get(key, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
|
||||
companion object {
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(JetFileFacadeFqNameIndex::class.java)
|
||||
public val INSTANCE: JetFileFacadeFqNameIndex = JetFileFacadeFqNameIndex()
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(KotlinFilePartClassIndex::class.java)
|
||||
public val INSTANCE: KotlinFilePartClassIndex = KotlinFilePartClassIndex()
|
||||
@JvmStatic
|
||||
public fun getInstance(): JetFileFacadeFqNameIndex = INSTANCE
|
||||
public fun getInstance(): KotlinFilePartClassIndex = INSTANCE
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -25,17 +25,17 @@ import org.jetbrains.kotlin.psi.KtClassOrObject;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetFullClassNameIndex extends StringStubIndexExtension<KtClassOrObject> {
|
||||
private static final StubIndexKey<String, KtClassOrObject> KEY = KotlinIndexUtil.createIndexKey(JetFullClassNameIndex.class);
|
||||
public class KotlinFullClassNameIndex extends StringStubIndexExtension<KtClassOrObject> {
|
||||
private static final StubIndexKey<String, KtClassOrObject> KEY = KotlinIndexUtil.createIndexKey(KotlinFullClassNameIndex.class);
|
||||
|
||||
private static final JetFullClassNameIndex ourInstance = new JetFullClassNameIndex();
|
||||
private static final KotlinFullClassNameIndex ourInstance = new KotlinFullClassNameIndex();
|
||||
|
||||
@NotNull
|
||||
public static JetFullClassNameIndex getInstance() {
|
||||
public static KotlinFullClassNameIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetFullClassNameIndex() {}
|
||||
private KotlinFullClassNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -46,6 +46,6 @@ public class JetFullClassNameIndex extends StringStubIndexExtension<KtClassOrObj
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtClassOrObject> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(fqName, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(fqName, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -25,16 +25,16 @@ import org.jetbrains.kotlin.psi.KtNamedFunction;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetFunctionShortNameIndex extends StringStubIndexExtension<KtNamedFunction> {
|
||||
private static final StubIndexKey<String, KtNamedFunction> KEY = KotlinIndexUtil.createIndexKey(JetFunctionShortNameIndex.class);
|
||||
public class KotlinFunctionShortNameIndex extends StringStubIndexExtension<KtNamedFunction> {
|
||||
private static final StubIndexKey<String, KtNamedFunction> KEY = KotlinIndexUtil.createIndexKey(KotlinFunctionShortNameIndex.class);
|
||||
|
||||
private static final JetFunctionShortNameIndex ourInstance = new JetFunctionShortNameIndex();
|
||||
private static final KotlinFunctionShortNameIndex ourInstance = new KotlinFunctionShortNameIndex();
|
||||
|
||||
public static JetFunctionShortNameIndex getInstance() {
|
||||
public static KotlinFunctionShortNameIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetFunctionShortNameIndex() {}
|
||||
private KotlinFunctionShortNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -45,6 +45,6 @@ public class JetFunctionShortNameIndex extends StringStubIndexExtension<KtNamedF
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtNamedFunction> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -23,15 +23,15 @@ import com.intellij.psi.stubs.StubIndexKey
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
|
||||
public class JetMultifileClassPartIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
public class KotlinMultifileClassPartIndex private constructor() : StringStubIndexExtension<KtFile>() {
|
||||
override fun getKey(): StubIndexKey<String, KtFile> = KEY
|
||||
|
||||
override fun get(key: String, project: Project, scope: GlobalSearchScope) =
|
||||
super.get(key, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
super.get(key, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
|
||||
companion object {
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(JetMultifileClassPartIndex::class.java)
|
||||
public val INSTANCE: JetMultifileClassPartIndex = JetMultifileClassPartIndex()
|
||||
public @JvmStatic fun getInstance(): JetMultifileClassPartIndex = INSTANCE
|
||||
private val KEY = KotlinIndexUtil.createIndexKey(KotlinMultifileClassPartIndex::class.java)
|
||||
public val INSTANCE: KotlinMultifileClassPartIndex = KotlinMultifileClassPartIndex()
|
||||
public @JvmStatic fun getInstance(): KotlinMultifileClassPartIndex = INSTANCE
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -25,16 +25,16 @@ import org.jetbrains.kotlin.psi.KtNamedFunction;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetProbablyNothingFunctionShortNameIndex extends StringStubIndexExtension<KtNamedFunction> {
|
||||
private static final StubIndexKey<String, KtNamedFunction> KEY = KotlinIndexUtil.createIndexKey(JetProbablyNothingFunctionShortNameIndex.class);
|
||||
public class KotlinProbablyNothingFunctionShortNameIndex extends StringStubIndexExtension<KtNamedFunction> {
|
||||
private static final StubIndexKey<String, KtNamedFunction> KEY = KotlinIndexUtil.createIndexKey(KotlinProbablyNothingFunctionShortNameIndex.class);
|
||||
|
||||
private static final JetProbablyNothingFunctionShortNameIndex ourInstance = new JetProbablyNothingFunctionShortNameIndex();
|
||||
private static final KotlinProbablyNothingFunctionShortNameIndex ourInstance = new KotlinProbablyNothingFunctionShortNameIndex();
|
||||
|
||||
public static JetProbablyNothingFunctionShortNameIndex getInstance() {
|
||||
public static KotlinProbablyNothingFunctionShortNameIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetProbablyNothingFunctionShortNameIndex() {}
|
||||
private KotlinProbablyNothingFunctionShortNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -45,6 +45,6 @@ public class JetProbablyNothingFunctionShortNameIndex extends StringStubIndexExt
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtNamedFunction> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -25,16 +25,16 @@ import org.jetbrains.kotlin.psi.KtProperty;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetProbablyNothingPropertyShortNameIndex extends StringStubIndexExtension<KtProperty> {
|
||||
private static final StubIndexKey<String, KtProperty> KEY = KotlinIndexUtil.createIndexKey(JetProbablyNothingPropertyShortNameIndex.class);
|
||||
public class KotlinProbablyNothingPropertyShortNameIndex extends StringStubIndexExtension<KtProperty> {
|
||||
private static final StubIndexKey<String, KtProperty> KEY = KotlinIndexUtil.createIndexKey(KotlinProbablyNothingPropertyShortNameIndex.class);
|
||||
|
||||
private static final JetProbablyNothingPropertyShortNameIndex ourInstance = new JetProbablyNothingPropertyShortNameIndex();
|
||||
private static final KotlinProbablyNothingPropertyShortNameIndex ourInstance = new KotlinProbablyNothingPropertyShortNameIndex();
|
||||
|
||||
public static JetProbablyNothingPropertyShortNameIndex getInstance() {
|
||||
public static KotlinProbablyNothingPropertyShortNameIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetProbablyNothingPropertyShortNameIndex() {}
|
||||
private KotlinProbablyNothingPropertyShortNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -45,6 +45,6 @@ public class JetProbablyNothingPropertyShortNameIndex extends StringStubIndexExt
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtProperty> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -25,16 +25,16 @@ import org.jetbrains.kotlin.psi.KtProperty;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetPropertyShortNameIndex extends StringStubIndexExtension<KtProperty> {
|
||||
private static final StubIndexKey<String, KtProperty> KEY = KotlinIndexUtil.createIndexKey(JetPropertyShortNameIndex.class);
|
||||
public class KotlinPropertyShortNameIndex extends StringStubIndexExtension<KtProperty> {
|
||||
private static final StubIndexKey<String, KtProperty> KEY = KotlinIndexUtil.createIndexKey(KotlinPropertyShortNameIndex.class);
|
||||
|
||||
private static final JetPropertyShortNameIndex ourInstance = new JetPropertyShortNameIndex();
|
||||
private static final KotlinPropertyShortNameIndex ourInstance = new KotlinPropertyShortNameIndex();
|
||||
|
||||
public static JetPropertyShortNameIndex getInstance() {
|
||||
public static KotlinPropertyShortNameIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetPropertyShortNameIndex() {}
|
||||
private KotlinPropertyShortNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -45,6 +45,6 @@ public class JetPropertyShortNameIndex extends StringStubIndexExtension<KtProper
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtProperty> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+10
-10
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.JsProjectDetector;
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil;
|
||||
|
||||
public class JetSourceFilterScope extends DelegatingGlobalSearchScope {
|
||||
public class KotlinSourceFilterScope extends DelegatingGlobalSearchScope {
|
||||
@NotNull
|
||||
public static GlobalSearchScope kotlinSourcesAndLibraries(@NotNull GlobalSearchScope delegate, @NotNull Project project) {
|
||||
return create(delegate, true, true, true, project);
|
||||
@@ -62,21 +62,21 @@ public class JetSourceFilterScope extends DelegatingGlobalSearchScope {
|
||||
) {
|
||||
if (delegate == GlobalSearchScope.EMPTY_SCOPE) return delegate;
|
||||
|
||||
if (delegate instanceof JetSourceFilterScope) {
|
||||
JetSourceFilterScope wrappedDelegate = (JetSourceFilterScope) delegate;
|
||||
if (delegate instanceof KotlinSourceFilterScope) {
|
||||
KotlinSourceFilterScope wrappedDelegate = (KotlinSourceFilterScope) delegate;
|
||||
|
||||
boolean doIncludeProjectSourceFiles = wrappedDelegate.includeProjectSourceFiles && includeProjectSourceFiles;
|
||||
boolean doIncludeLibrarySourceFiles = wrappedDelegate.includeLibrarySourceFiles && includeLibrarySourceFiles;
|
||||
boolean doIncludeClassFiles = wrappedDelegate.includeClassFiles && includeClassFiles;
|
||||
|
||||
return new JetSourceFilterScope(wrappedDelegate.myBaseScope,
|
||||
doIncludeProjectSourceFiles,
|
||||
doIncludeLibrarySourceFiles,
|
||||
doIncludeClassFiles,
|
||||
project);
|
||||
return new KotlinSourceFilterScope(wrappedDelegate.myBaseScope,
|
||||
doIncludeProjectSourceFiles,
|
||||
doIncludeLibrarySourceFiles,
|
||||
doIncludeClassFiles,
|
||||
project);
|
||||
}
|
||||
|
||||
return new JetSourceFilterScope(delegate, includeProjectSourceFiles, includeLibrarySourceFiles, includeClassFiles, project);
|
||||
return new KotlinSourceFilterScope(delegate, includeProjectSourceFiles, includeLibrarySourceFiles, includeClassFiles, project);
|
||||
}
|
||||
|
||||
private final ProjectFileIndex index;
|
||||
@@ -86,7 +86,7 @@ public class JetSourceFilterScope extends DelegatingGlobalSearchScope {
|
||||
private final boolean includeClassFiles;
|
||||
private final boolean isJsProject;
|
||||
|
||||
private JetSourceFilterScope(
|
||||
private KotlinSourceFilterScope(
|
||||
@NotNull GlobalSearchScope delegate,
|
||||
boolean includeProjectSourceFiles,
|
||||
boolean includeLibrarySourceFiles,
|
||||
+6
-6
@@ -25,17 +25,17 @@ import org.jetbrains.kotlin.psi.KtClassOrObject;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetSuperClassIndex extends StringStubIndexExtension<KtClassOrObject> {
|
||||
private static final StubIndexKey<String, KtClassOrObject> KEY = KotlinIndexUtil.createIndexKey(JetSuperClassIndex.class);
|
||||
public class KotlinSuperClassIndex extends StringStubIndexExtension<KtClassOrObject> {
|
||||
private static final StubIndexKey<String, KtClassOrObject> KEY = KotlinIndexUtil.createIndexKey(KotlinSuperClassIndex.class);
|
||||
|
||||
private static final JetSuperClassIndex ourInstance = new JetSuperClassIndex();
|
||||
private static final KotlinSuperClassIndex ourInstance = new KotlinSuperClassIndex();
|
||||
|
||||
@NotNull
|
||||
public static JetSuperClassIndex getInstance() {
|
||||
public static KotlinSuperClassIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetSuperClassIndex() {}
|
||||
private KotlinSuperClassIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -46,6 +46,6 @@ public class JetSuperClassIndex extends StringStubIndexExtension<KtClassOrObject
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtClassOrObject> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -25,16 +25,16 @@ import org.jetbrains.kotlin.psi.KtClassOrObject;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetTopLevelClassByPackageIndex extends StringStubIndexExtension<KtClassOrObject> {
|
||||
private static final StubIndexKey<String, KtClassOrObject> KEY = KotlinIndexUtil.createIndexKey(JetTopLevelClassByPackageIndex.class);
|
||||
public class KotlinTopLevelClassByPackageIndex extends StringStubIndexExtension<KtClassOrObject> {
|
||||
private static final StubIndexKey<String, KtClassOrObject> KEY = KotlinIndexUtil.createIndexKey(KotlinTopLevelClassByPackageIndex.class);
|
||||
|
||||
private static final JetTopLevelClassByPackageIndex ourInstance = new JetTopLevelClassByPackageIndex();
|
||||
private static final KotlinTopLevelClassByPackageIndex ourInstance = new KotlinTopLevelClassByPackageIndex();
|
||||
|
||||
public static JetTopLevelClassByPackageIndex getInstance() {
|
||||
public static KotlinTopLevelClassByPackageIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetTopLevelClassByPackageIndex() {}
|
||||
private KotlinTopLevelClassByPackageIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -45,6 +45,6 @@ public class JetTopLevelClassByPackageIndex extends StringStubIndexExtension<KtC
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtClassOrObject> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(fqName, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(fqName, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -19,21 +19,20 @@ package org.jetbrains.kotlin.idea.stubindex
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.stubs.StringStubIndexExtension
|
||||
import com.intellij.psi.stubs.StubIndexKey
|
||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
||||
|
||||
public class JetTopLevelExtensionsByReceiverTypeIndex private constructor() : StringStubIndexExtension<KtCallableDeclaration>() {
|
||||
public class KotlinTopLevelExtensionsByReceiverTypeIndex private constructor() : StringStubIndexExtension<KtCallableDeclaration>() {
|
||||
|
||||
override fun getKey() = KEY
|
||||
|
||||
override fun get(s: String, project: Project, scope: GlobalSearchScope)
|
||||
= super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
= super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project))
|
||||
|
||||
companion object {
|
||||
private val KEY = KotlinIndexUtil.createIndexKey<String, KtCallableDeclaration>(javaClass<JetTopLevelExtensionsByReceiverTypeIndex>())
|
||||
private val KEY = KotlinIndexUtil.createIndexKey<String, KtCallableDeclaration>(javaClass<KotlinTopLevelExtensionsByReceiverTypeIndex>())
|
||||
private val SEPARATOR = '\n'
|
||||
|
||||
public val INSTANCE: JetTopLevelExtensionsByReceiverTypeIndex = JetTopLevelExtensionsByReceiverTypeIndex()
|
||||
public val INSTANCE: KotlinTopLevelExtensionsByReceiverTypeIndex = KotlinTopLevelExtensionsByReceiverTypeIndex()
|
||||
|
||||
public fun buildKey(receiverTypeName: String, callableName: String): String = receiverTypeName + SEPARATOR + callableName
|
||||
|
||||
+6
-6
@@ -25,16 +25,16 @@ import org.jetbrains.kotlin.psi.KtNamedFunction;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetTopLevelFunctionByPackageIndex extends StringStubIndexExtension<KtNamedFunction> {
|
||||
private static final StubIndexKey<String, KtNamedFunction> KEY = KotlinIndexUtil.createIndexKey(JetTopLevelFunctionByPackageIndex.class);
|
||||
public class KotlinTopLevelFunctionByPackageIndex extends StringStubIndexExtension<KtNamedFunction> {
|
||||
private static final StubIndexKey<String, KtNamedFunction> KEY = KotlinIndexUtil.createIndexKey(KotlinTopLevelFunctionByPackageIndex.class);
|
||||
|
||||
private static final JetTopLevelFunctionByPackageIndex ourInstance = new JetTopLevelFunctionByPackageIndex();
|
||||
private static final KotlinTopLevelFunctionByPackageIndex ourInstance = new KotlinTopLevelFunctionByPackageIndex();
|
||||
|
||||
public static JetTopLevelFunctionByPackageIndex getInstance() {
|
||||
public static KotlinTopLevelFunctionByPackageIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetTopLevelFunctionByPackageIndex() {}
|
||||
private KotlinTopLevelFunctionByPackageIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -45,6 +45,6 @@ public class JetTopLevelFunctionByPackageIndex extends StringStubIndexExtension<
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtNamedFunction> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(fqName, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(fqName, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -28,17 +28,17 @@ import java.util.Collection;
|
||||
/**
|
||||
* Stores package top level function (both extension and non-extension) full qualified names.
|
||||
*/
|
||||
public class JetTopLevelFunctionFqnNameIndex extends StringStubIndexExtension<KtNamedFunction> {
|
||||
private static final StubIndexKey<String, KtNamedFunction> KEY = KotlinIndexUtil.createIndexKey(JetTopLevelFunctionFqnNameIndex.class);
|
||||
public class KotlinTopLevelFunctionFqnNameIndex extends StringStubIndexExtension<KtNamedFunction> {
|
||||
private static final StubIndexKey<String, KtNamedFunction> KEY = KotlinIndexUtil.createIndexKey(KotlinTopLevelFunctionFqnNameIndex.class);
|
||||
|
||||
private static final JetTopLevelFunctionFqnNameIndex INSTANCE = new JetTopLevelFunctionFqnNameIndex();
|
||||
private static final KotlinTopLevelFunctionFqnNameIndex INSTANCE = new KotlinTopLevelFunctionFqnNameIndex();
|
||||
|
||||
@NotNull
|
||||
public static JetTopLevelFunctionFqnNameIndex getInstance() {
|
||||
public static KotlinTopLevelFunctionFqnNameIndex getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private JetTopLevelFunctionFqnNameIndex() {}
|
||||
private KotlinTopLevelFunctionFqnNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -49,6 +49,6 @@ public class JetTopLevelFunctionFqnNameIndex extends StringStubIndexExtension<Kt
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtNamedFunction> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -25,16 +25,16 @@ import org.jetbrains.kotlin.psi.KtProperty;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetTopLevelPropertyByPackageIndex extends StringStubIndexExtension<KtProperty> {
|
||||
private static final StubIndexKey<String, KtProperty> KEY = KotlinIndexUtil.createIndexKey(JetTopLevelPropertyByPackageIndex.class);
|
||||
public class KotlinTopLevelPropertyByPackageIndex extends StringStubIndexExtension<KtProperty> {
|
||||
private static final StubIndexKey<String, KtProperty> KEY = KotlinIndexUtil.createIndexKey(KotlinTopLevelPropertyByPackageIndex.class);
|
||||
|
||||
private static final JetTopLevelPropertyByPackageIndex ourInstance = new JetTopLevelPropertyByPackageIndex();
|
||||
private static final KotlinTopLevelPropertyByPackageIndex ourInstance = new KotlinTopLevelPropertyByPackageIndex();
|
||||
|
||||
public static JetTopLevelPropertyByPackageIndex getInstance() {
|
||||
public static KotlinTopLevelPropertyByPackageIndex getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private JetTopLevelPropertyByPackageIndex() {}
|
||||
private KotlinTopLevelPropertyByPackageIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -45,6 +45,6 @@ public class JetTopLevelPropertyByPackageIndex extends StringStubIndexExtension<
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtProperty> get(@NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(fqName, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(fqName, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -25,17 +25,17 @@ import org.jetbrains.kotlin.psi.KtProperty;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JetTopLevelPropertyFqnNameIndex extends StringStubIndexExtension<KtProperty> {
|
||||
private static final StubIndexKey<String, KtProperty> KEY = KotlinIndexUtil.createIndexKey(JetTopLevelPropertyFqnNameIndex.class);
|
||||
public class KotlinTopLevelPropertyFqnNameIndex extends StringStubIndexExtension<KtProperty> {
|
||||
private static final StubIndexKey<String, KtProperty> KEY = KotlinIndexUtil.createIndexKey(KotlinTopLevelPropertyFqnNameIndex.class);
|
||||
|
||||
private static final JetTopLevelPropertyFqnNameIndex INSTANCE = new JetTopLevelPropertyFqnNameIndex();
|
||||
private static final KotlinTopLevelPropertyFqnNameIndex INSTANCE = new KotlinTopLevelPropertyFqnNameIndex();
|
||||
|
||||
@NotNull
|
||||
public static JetTopLevelPropertyFqnNameIndex getInstance() {
|
||||
public static KotlinTopLevelPropertyFqnNameIndex getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private JetTopLevelPropertyFqnNameIndex() {}
|
||||
private KotlinTopLevelPropertyFqnNameIndex() {}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -46,6 +46,6 @@ public class JetTopLevelPropertyFqnNameIndex extends StringStubIndexExtension<Kt
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<KtProperty> get(@NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
|
||||
return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
return super.get(s, project, KotlinSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user