mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
more efficient use of indices in stub hierarchy
This commit is contained in:
+3
-1
@@ -29,6 +29,7 @@ public class JavaUnitDescriptor implements DataExternalizer<IndexTree.Unit> {
|
||||
|
||||
@Override
|
||||
public void save(@NotNull DataOutput out, IndexTree.Unit value) throws IOException {
|
||||
out.writeUTF(value.myPackageId);
|
||||
out.writeByte(value.myUnitType);
|
||||
if (value.myUnitType != IndexTree.BYTECODE) {
|
||||
DataInputOutputUtil.writeINT(out, value.imports.length);
|
||||
@@ -75,6 +76,7 @@ public class JavaUnitDescriptor implements DataExternalizer<IndexTree.Unit> {
|
||||
|
||||
@Override
|
||||
public IndexTree.Unit read(@NotNull DataInput in) throws IOException {
|
||||
String pid = in.readUTF();
|
||||
byte type = in.readByte();
|
||||
IndexTree.Import[] imports = IndexTree.Import.EMPTY_ARRAY;
|
||||
if (type != IndexTree.BYTECODE) {
|
||||
@@ -87,7 +89,7 @@ public class JavaUnitDescriptor implements DataExternalizer<IndexTree.Unit> {
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
classes[i] = readClassDecl(in);
|
||||
}
|
||||
return new IndexTree.Unit(type, imports, classes);
|
||||
return new IndexTree.Unit(pid, type, imports, classes);
|
||||
}
|
||||
|
||||
private IndexTree.ClassDecl readClassDecl(DataInput in) throws IOException {
|
||||
|
||||
+1
-4
@@ -16,15 +16,12 @@
|
||||
package com.intellij.psi.stubsHierarchy;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.impl.java.stubs.hierarchy.IndexTree;
|
||||
import com.intellij.util.indexing.FileContent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
@@ -37,7 +34,7 @@ public abstract class StubHierarchyIndexer {
|
||||
* @return a list of pairs <packageName, compilation unit> for a specified file content
|
||||
*/
|
||||
@Nullable
|
||||
public abstract List<Pair<String, IndexTree.Unit>> indexFile(@NotNull FileContent content);
|
||||
public abstract IndexTree.Unit indexFile(@NotNull FileContent content);
|
||||
|
||||
public abstract boolean handlesFile(@NotNull VirtualFile file);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user