Search in sources :

Example 1 with StringRef

use of com.intellij.util.io.StringRef in project kotlin by JetBrains.

the class IdeStubIndexService method deserializeFileStub.

@NotNull
@Override
public KotlinFileStub deserializeFileStub(@NotNull StubInputStream dataStream) throws IOException {
    StringRef packageFqNameAsString = dataStream.readName();
    boolean isScript = dataStream.readBoolean();
    StringRef facadeSimpleName = dataStream.readName();
    StringRef partSimpleName = dataStream.readName();
    int numPartNames = dataStream.readInt();
    List<StringRef> facadePartNames = new ArrayList<StringRef>();
    for (int i = 0; i < numPartNames; ++i) {
        StringRef partNameRef = dataStream.readName();
        facadePartNames.add(partNameRef);
    }
    return new KotlinFileStubForIde(null, packageFqNameAsString, isScript, facadeSimpleName, partSimpleName, facadePartNames);
}
Also used : ArrayList(java.util.ArrayList) StringRef(com.intellij.util.io.StringRef) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with StringRef

use of com.intellij.util.io.StringRef in project kotlin by JetBrains.

the class IdeStubIndexService method createFileStub.

@NotNull
@Override
public KotlinFileStub createFileStub(@NotNull KtFile file) {
    StringRef packageFqName = StringRef.fromString(file.getPackageFqNameByTree().asString());
    boolean isScript = file.isScriptByTree();
    if (PackagePartClassUtils.fileHasTopLevelCallables(file)) {
        JvmFileClassInfo fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(file);
        StringRef facadeSimpleName = StringRef.fromString(fileClassInfo.getFacadeClassFqName().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, null, null, null);
}
Also used : JvmFileClassInfo(org.jetbrains.kotlin.fileClasses.JvmFileClassInfo) StringRef(com.intellij.util.io.StringRef) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with StringRef

use of com.intellij.util.io.StringRef in project kotlin by JetBrains.

the class IdeStubIndexService method serializeFileStub.

@Override
public void serializeFileStub(@NotNull KotlinFileStub stub, @NotNull StubOutputStream dataStream) throws IOException {
    KotlinFileStubForIde fileStub = (KotlinFileStubForIde) stub;
    dataStream.writeName(fileStub.getPackageFqName().asString());
    dataStream.writeBoolean(fileStub.isScript());
    dataStream.writeName(StringRef.toString(fileStub.getFacadeSimpleName()));
    dataStream.writeName(StringRef.toString(fileStub.getPartSimpleName()));
    List<StringRef> facadePartNames = fileStub.getFacadePartSimpleNames();
    if (facadePartNames == null) {
        dataStream.writeInt(0);
    } else {
        dataStream.writeInt(facadePartNames.size());
        for (StringRef partName : facadePartNames) {
            dataStream.writeName(StringRef.toString(partName));
        }
    }
}
Also used : StringRef(com.intellij.util.io.StringRef)

Example 4 with StringRef

use of com.intellij.util.io.StringRef in project intellij-community by JetBrains.

the class PropertyStubStorage method deserialize.

public static PropertyStubStorage deserialize(StubInputStream stream) throws IOException {
    PropertyStubStorage me = new PropertyStubStorage();
    me.myGetter = readOne(stream);
    me.mySetter = readOne(stream);
    me.myDeleter = readOne(stream);
    //
    StringRef ref = stream.readName();
    me.myDoc = ref != null ? ref.getString() : null;
    return me;
}
Also used : StringRef(com.intellij.util.io.StringRef)

Example 5 with StringRef

use of com.intellij.util.io.StringRef in project intellij-community by JetBrains.

the class PyFunctionElementType method deserialize.

@NotNull
public PyFunctionStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
    String name = StringRef.toString(dataStream.readName());
    String docString = dataStream.readUTFFast();
    StringRef deprecationMessage = dataStream.readName();
    final boolean isAsync = dataStream.readBoolean();
    final StringRef typeComment = dataStream.readName();
    return new PyFunctionStubImpl(name, StringUtil.nullize(docString), deprecationMessage == null ? null : deprecationMessage.getString(), isAsync, typeComment == null ? null : typeComment.getString(), parentStub, getStubElementType());
}
Also used : StringRef(com.intellij.util.io.StringRef) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

StringRef (com.intellij.util.io.StringRef)34 NotNull (org.jetbrains.annotations.NotNull)24 FqName (org.jetbrains.kotlin.name.FqName)6 TypeInfo (com.intellij.psi.impl.cache.TypeInfo)3 QualifiedName (com.intellij.psi.util.QualifiedName)2 IOException (java.io.IOException)2 Nullable (org.jetbrains.annotations.Nullable)2 KotlinImportDirectiveStubImpl (org.jetbrains.kotlin.psi.stubs.impl.KotlinImportDirectiveStubImpl)2 KotlinParameterStubImpl (org.jetbrains.kotlin.psi.stubs.impl.KotlinParameterStubImpl)2 PsiClassStubImpl (com.intellij.psi.impl.java.stubs.impl.PsiClassStubImpl)1 PsiFieldStubImpl (com.intellij.psi.impl.java.stubs.impl.PsiFieldStubImpl)1 PsiImportStatementStubImpl (com.intellij.psi.impl.java.stubs.impl.PsiImportStatementStubImpl)1 PsiJavaFileStubImpl (com.intellij.psi.impl.java.stubs.impl.PsiJavaFileStubImpl)1 PsiMethodStubImpl (com.intellij.psi.impl.java.stubs.impl.PsiMethodStubImpl)1 PsiParameterStubImpl (com.intellij.psi.impl.java.stubs.impl.PsiParameterStubImpl)1 PyFileStubImpl (com.jetbrains.python.psi.impl.stubs.PyFileStubImpl)1 THashSet (gnu.trove.THashSet)1 ArrayList (java.util.ArrayList)1 BitSet (java.util.BitSet)1 JvmFileClassInfo (org.jetbrains.kotlin.fileClasses.JvmFileClassInfo)1