@Override @NotNull public ClassId getClassId(int index) { LinkedList<String> packageFqName = new LinkedList<String>(); LinkedList<String> relativeClassName = new LinkedList<String>(); boolean local = false; while (index != -1) { QualifiedName proto = qualifiedNames.getQualifiedName(index); String shortName = strings.getString(proto.getShortName()); switch (proto.getKind()) { case CLASS: relativeClassName.addFirst(shortName); break; case PACKAGE: packageFqName.addFirst(shortName); break; case LOCAL: relativeClassName.addFirst(shortName); local = true; break; } index = proto.getParentQualifiedName(); } return new ClassId( FqName.fromSegments(packageFqName), FqName.fromSegments(relativeClassName), local); }
@NotNull public static NameResolverImpl read(@NotNull InputStream in) { try { ProtoBuf.StringTable simpleNames = ProtoBuf.StringTable.parseDelimitedFrom(in); ProtoBuf.QualifiedNameTable qualifiedNames = ProtoBuf.QualifiedNameTable.parseDelimitedFrom(in); return new NameResolverImpl(simpleNames, qualifiedNames); } catch (IOException e) { throw ExceptionUtilsKt.rethrow(e); } }
@Override @NotNull public Name getName(int index) { return Name.guess(strings.getString(index)); }
@Override @NotNull public String getString(int index) { return strings.getString(index); }