示例#1
0
  @Nullable
  public static PsiJavaFileStub buildFileStub(@NotNull VirtualFile file, @NotNull byte[] bytes)
      throws ClsFormatException {
    if (ClassFileViewProvider.isInnerClass(file)) {
      return null;
    }

    try {
      PsiJavaFileStubImpl stub = new PsiJavaFileStubImpl("do.not.know.yet", true);
      String className = file.getNameWithoutExtension();
      StubBuildingVisitor<VirtualFile> visitor =
          new StubBuildingVisitor<VirtualFile>(file, STRATEGY, stub, 0, className);
      try {
        new ClassReader(bytes).accept(visitor, ClassReader.SKIP_FRAMES);
      } catch (OutOfOrderInnerClassException e) {
        return null;
      }

      PsiClassStub<?> result = visitor.getResult();
      if (result == null) return null;

      stub.setPackageName(getPackageName(result));
      return stub;
    } catch (Exception e) {
      throw new ClsFormatException(file.getPath() + ": " + e.getMessage(), e);
    }
  }
 @Override
 public void visit(
     int version,
     int access,
     String name,
     String signature,
     String superName,
     String[] interfaces) {
   super.visit(version, access, "gr_trait_helper", null, null, null);
 }