@Override
  public void visitInnerClass(
      final String name, final String outerName, final String innerName, final int access) {
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) return;
    if (!isCorrectName(innerName) || outerName == null) return;

    if ((getClassName(outerName) + "." + innerName).equals(myResult.getQualifiedName())) {
      // our result is inner class
      if (myParent instanceof PsiFileStub) {
        throw new OutOfOrderInnerClassException();
      }
    }

    if (!getClassName(outerName).equals(myResult.getQualifiedName())) return;

    final T innerSource = myInnersStrategy.findInnerClass(innerName, mySource);
    if (innerSource == null) return;

    final ClassReader reader = myInnersStrategy.readerForInnerClass(innerSource);
    if (reader == null) return;

    final StubBuildingVisitor<T> classVisitor =
        new StubBuildingVisitor<T>(innerSource, myInnersStrategy, myResult, access, innerName);
    reader.accept(classVisitor, ClassReader.SKIP_FRAMES);
  }
示例#2
0
 private static String getPackageName(@NotNull PsiClassStub<?> result) {
   String fqn = result.getQualifiedName();
   String shortName = result.getName();
   return fqn == null || Comparing.equal(shortName, fqn)
       ? ""
       : fqn.substring(0, fqn.lastIndexOf('.'));
 }
  @Override
  public void visitInnerClass(
      final String name, final String outerName, final String innerName, final int access) {
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) return;
    if (!isCorrectName(innerName) || outerName == null) return;

    if ((getClassName(outerName) + "." + innerName).equals(myResult.getQualifiedName())) {
      // our result is inner class
      if (myParent instanceof PsiFileStub) {
        throw new OutOfOrderInnerClassException();
      }
    }
    if (!namesEqual(outerName, myResult.getQualifiedName())) {
      return;
    }

    T innerClass = myInnersStrategy.findInnerClass(innerName, mySource);
    if (innerClass != null) {
      StubBuildingVisitor<T> visitor =
          new StubBuildingVisitor<T>(innerClass, myInnersStrategy, myResult, access, innerName);
      myInnersStrategy.accept(innerClass, visitor);
    }
  }