@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); }
private void assertNoIntrinsicsMethodIsCalled(String className) { ClassFileFactory classes = generateClassesInFile(); ClassReader reader = new ClassReader(classes.asBytes(className + ".class")); reader.accept( new ClassVisitor(Opcodes.ASM4) { @Override public MethodVisitor visitMethod( int access, final String callerName, final String callerDesc, String signature, String[] exceptions) { return new MethodVisitor(Opcodes.ASM4) { @Override public void visitMethodInsn(int opcode, String owner, String name, String desc) { assertFalse( "jet/Intrinsics method is called: " + name + desc + " Caller: " + callerName + callerDesc, "jet/Intrinsics".equals(owner)); } }; } }, 0); }
public Pair<ClassRepr, Set<UsageRepr.Usage>> analyze(final int fileName, final ClassReader cr) { final ClassCrawler visitor = new ClassCrawler(fileName); cr.accept(visitor, 0); return visitor.getResult(); }
public static int getClassFileVersion(ClassReader reader) { final Ref<Integer> result = new Ref<Integer>(0); reader.accept( new ClassVisitor(Opcodes.ASM4) { public void visit( int version, int access, String name, String signature, String superName, String[] interfaces) { result.set(version); } }, 0); return result.get(); }