KotlinFileStubForIde: save full facadeFqName
Prefix is not necessarily same as packageFqName since JvmPackageName was introduced
This commit is contained in:
@@ -23,12 +23,12 @@ object KotlinStubVersions {
|
|||||||
// Though only kotlin declarations (no code in the bodies) are stubbed, please do increase this version
|
// Though only kotlin declarations (no code in the bodies) are stubbed, please do increase this version
|
||||||
// if you are not 100% sure it can be avoided.
|
// if you are not 100% sure it can be avoided.
|
||||||
// Increasing this version will lead to reindexing of all kotlin source files on the first IDE startup with the new version.
|
// Increasing this version will lead to reindexing of all kotlin source files on the first IDE startup with the new version.
|
||||||
const val SOURCE_STUB_VERSION = 125
|
const val SOURCE_STUB_VERSION = 126
|
||||||
|
|
||||||
// Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed
|
// Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed
|
||||||
// or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder).
|
// or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder).
|
||||||
// Increasing this version will lead to reindexing of all binary files that are potentially kotlin binaries (including all class files).
|
// Increasing this version will lead to reindexing of all binary files that are potentially kotlin binaries (including all class files).
|
||||||
private const val BINARY_STUB_VERSION = 63
|
private const val BINARY_STUB_VERSION = 64
|
||||||
|
|
||||||
// Classfile stub version should be increased if changes are made to classfile stub building subsystem (org.jetbrains.kotlin.idea.decompiler.classFile)
|
// Classfile stub version should be increased if changes are made to classfile stub building subsystem (org.jetbrains.kotlin.idea.decompiler.classFile)
|
||||||
// Increasing this version will lead to reindexing of all classfiles.
|
// Increasing this version will lead to reindexing of all classfiles.
|
||||||
|
|||||||
@@ -261,9 +261,9 @@ public class IdeStubIndexService extends StubIndexService {
|
|||||||
boolean isScript = file.isScriptByTree();
|
boolean isScript = file.isScriptByTree();
|
||||||
if (file.hasTopLevelCallables()) {
|
if (file.hasTopLevelCallables()) {
|
||||||
JvmFileClassInfo fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(file);
|
JvmFileClassInfo fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(file);
|
||||||
StringRef facadeSimpleName = StringRef.fromString(fileClassInfo.getFacadeClassFqName().shortName().asString());
|
StringRef facadeFqNameRef = StringRef.fromString(fileClassInfo.getFacadeClassFqName().asString());
|
||||||
StringRef partSimpleName = StringRef.fromString(fileClassInfo.getFileClassFqName().shortName().asString());
|
StringRef partSimpleName = StringRef.fromString(fileClassInfo.getFileClassFqName().shortName().asString());
|
||||||
return new KotlinFileStubForIde(file, packageFqName, isScript, facadeSimpleName, partSimpleName, null);
|
return new KotlinFileStubForIde(file, packageFqName, isScript, facadeFqNameRef, partSimpleName, null);
|
||||||
}
|
}
|
||||||
return new KotlinFileStubForIde(file, packageFqName, isScript, null, null, null);
|
return new KotlinFileStubForIde(file, packageFqName, isScript, null, null, null);
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,8 @@ public class IdeStubIndexService extends StubIndexService {
|
|||||||
KotlinFileStubForIde fileStub = (KotlinFileStubForIde) stub;
|
KotlinFileStubForIde fileStub = (KotlinFileStubForIde) stub;
|
||||||
dataStream.writeName(fileStub.getPackageFqName().asString());
|
dataStream.writeName(fileStub.getPackageFqName().asString());
|
||||||
dataStream.writeBoolean(fileStub.isScript());
|
dataStream.writeBoolean(fileStub.isScript());
|
||||||
dataStream.writeName(StringRef.toString(fileStub.getFacadeSimpleName()));
|
FqName facadeFqName = fileStub.getFacadeFqName();
|
||||||
|
dataStream.writeName(facadeFqName != null ? facadeFqName.asString() : null);
|
||||||
dataStream.writeName(StringRef.toString(fileStub.getPartSimpleName()));
|
dataStream.writeName(StringRef.toString(fileStub.getPartSimpleName()));
|
||||||
List<StringRef> facadePartNames = fileStub.getFacadePartSimpleNames();
|
List<StringRef> facadePartNames = fileStub.getFacadePartSimpleNames();
|
||||||
if (facadePartNames == null) {
|
if (facadePartNames == null) {
|
||||||
@@ -294,7 +295,7 @@ public class IdeStubIndexService extends StubIndexService {
|
|||||||
public KotlinFileStub deserializeFileStub(@NotNull StubInputStream dataStream) throws IOException {
|
public KotlinFileStub deserializeFileStub(@NotNull StubInputStream dataStream) throws IOException {
|
||||||
StringRef packageFqNameAsString = dataStream.readName();
|
StringRef packageFqNameAsString = dataStream.readName();
|
||||||
boolean isScript = dataStream.readBoolean();
|
boolean isScript = dataStream.readBoolean();
|
||||||
StringRef facadeSimpleName = dataStream.readName();
|
StringRef facadeStringRef = dataStream.readName();
|
||||||
StringRef partSimpleName = dataStream.readName();
|
StringRef partSimpleName = dataStream.readName();
|
||||||
int numPartNames = dataStream.readInt();
|
int numPartNames = dataStream.readInt();
|
||||||
List<StringRef> facadePartNames = new ArrayList<StringRef>();
|
List<StringRef> facadePartNames = new ArrayList<StringRef>();
|
||||||
@@ -302,6 +303,6 @@ public class IdeStubIndexService extends StubIndexService {
|
|||||||
StringRef partNameRef = dataStream.readName();
|
StringRef partNameRef = dataStream.readName();
|
||||||
facadePartNames.add(partNameRef);
|
facadePartNames.add(partNameRef);
|
||||||
}
|
}
|
||||||
return new KotlinFileStubForIde(null, packageFqNameAsString, isScript, facadeSimpleName, partSimpleName, facadePartNames);
|
return new KotlinFileStubForIde(null, packageFqNameAsString, isScript, facadeStringRef, partSimpleName, facadePartNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,18 +28,17 @@ class KotlinFileStubForIde(
|
|||||||
jetFile: KtFile?,
|
jetFile: KtFile?,
|
||||||
packageName: StringRef,
|
packageName: StringRef,
|
||||||
isScript: Boolean,
|
isScript: Boolean,
|
||||||
val facadeSimpleName: StringRef?,
|
private val facadeFqNameRef: StringRef?,
|
||||||
val partSimpleName: StringRef?,
|
val partSimpleName: StringRef?,
|
||||||
val facadePartSimpleNames: List<StringRef?>?
|
val facadePartSimpleNames: List<StringRef?>?
|
||||||
) : KotlinFileStubImpl(jetFile, packageName, isScript), KotlinFileStub, PsiClassHolderFileStub<KtFile> {
|
) : KotlinFileStubImpl(jetFile, packageName, isScript), KotlinFileStub, PsiClassHolderFileStub<KtFile> {
|
||||||
|
|
||||||
private fun StringRef.relativeToPackage() = getPackageFqName().child(Name.identifier(this.string))
|
private fun StringRef.relativeToPackage() = getPackageFqName().child(Name.identifier(this.string))
|
||||||
|
|
||||||
val facadeFqName: FqName?
|
|
||||||
get() = facadeSimpleName?.relativeToPackage()
|
|
||||||
|
|
||||||
val partFqName: FqName?
|
val partFqName: FqName?
|
||||||
get() = partSimpleName?.relativeToPackage()
|
get() = partSimpleName?.relativeToPackage()
|
||||||
|
val facadeFqName: FqName?
|
||||||
|
get() = facadeFqNameRef?.let { FqName(it.string) }
|
||||||
|
|
||||||
constructor(jetFile: KtFile?, packageName: String, isScript: Boolean)
|
constructor(jetFile: KtFile?, packageName: String, isScript: Boolean)
|
||||||
: this(jetFile, StringRef.fromString(packageName)!!, isScript, null, null, null)
|
: this(jetFile, StringRef.fromString(packageName)!!, isScript, null, null, null)
|
||||||
@@ -48,7 +47,7 @@ class KotlinFileStubForIde(
|
|||||||
fun forFile(packageFqName: FqName, isScript: Boolean): KotlinFileStubImpl =
|
fun forFile(packageFqName: FqName, isScript: Boolean): KotlinFileStubImpl =
|
||||||
KotlinFileStubForIde(jetFile = null,
|
KotlinFileStubForIde(jetFile = null,
|
||||||
packageName = StringRef.fromString(packageFqName.asString())!!,
|
packageName = StringRef.fromString(packageFqName.asString())!!,
|
||||||
facadeSimpleName = null,
|
facadeFqNameRef = null,
|
||||||
partSimpleName = null,
|
partSimpleName = null,
|
||||||
facadePartSimpleNames = null,
|
facadePartSimpleNames = null,
|
||||||
isScript = isScript)
|
isScript = isScript)
|
||||||
@@ -56,7 +55,7 @@ class KotlinFileStubForIde(
|
|||||||
fun forFileFacadeStub(facadeFqName: FqName): KotlinFileStubImpl =
|
fun forFileFacadeStub(facadeFqName: FqName): KotlinFileStubImpl =
|
||||||
KotlinFileStubForIde(jetFile = null,
|
KotlinFileStubForIde(jetFile = null,
|
||||||
packageName = facadeFqName.parent().stringRef(),
|
packageName = facadeFqName.parent().stringRef(),
|
||||||
facadeSimpleName = facadeFqName.shortName().stringRef(),
|
facadeFqNameRef = facadeFqName.stringRef(),
|
||||||
partSimpleName = facadeFqName.shortName().stringRef(),
|
partSimpleName = facadeFqName.shortName().stringRef(),
|
||||||
facadePartSimpleNames = null,
|
facadePartSimpleNames = null,
|
||||||
isScript = false)
|
isScript = false)
|
||||||
@@ -64,7 +63,7 @@ class KotlinFileStubForIde(
|
|||||||
fun forMultifileClassStub(facadeFqName: FqName, partNames: List<String>?): KotlinFileStubImpl =
|
fun forMultifileClassStub(facadeFqName: FqName, partNames: List<String>?): KotlinFileStubImpl =
|
||||||
KotlinFileStubForIde(jetFile = null,
|
KotlinFileStubForIde(jetFile = null,
|
||||||
packageName = facadeFqName.parent().stringRef(),
|
packageName = facadeFqName.parent().stringRef(),
|
||||||
facadeSimpleName = facadeFqName.shortName().stringRef(),
|
facadeFqNameRef = facadeFqName.stringRef(),
|
||||||
partSimpleName = null,
|
partSimpleName = null,
|
||||||
facadePartSimpleNames = partNames?.map { StringRef.fromString(it) },
|
facadePartSimpleNames = partNames?.map { StringRef.fromString(it) },
|
||||||
isScript = false)
|
isScript = false)
|
||||||
|
|||||||
Reference in New Issue
Block a user