예제 #1
0
  @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);
  }
예제 #2
0
 @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);
   }
 }