@Override public void visitLabel(final Label label) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkLabel(label, false, "label"); if (labelInsnIndices.get(label) != null) { throw new IllegalArgumentException("Already visited label"); } labelInsnIndices.put(label, insnCount); super.visitLabel(label); }
@Override public void visitLabel(final Label label) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkLabel(label, false, "label"); if (labelInsnIndices.get(label) != null) { throw new IllegalArgumentException("Already visited label"); } labelInsnIndices.put(label, insnCount); super.visitLabel(label); }
@Override public void visitInsn(final int opcode) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_INSN); super.visitInsn(opcode); ++insnCount; }
@Override public void visitInsn(final int opcode) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_INSN); super.visitInsn(opcode); ++insnCount; }
@Override public void visitTypeInsn(final int opcode, final String type) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_TYPE_INSN); checkInternalName(version, type, "type"); if (opcode == Opcodes.NEW && type.charAt(0) == '[') { throw new IllegalArgumentException("NEW cannot be used to create arrays: " + type); } super.visitTypeInsn(opcode, type); ++insnCount; }
@Override public void visitTypeInsn(final int opcode, final String type) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_TYPE_INSN); checkInternalName(version, type, "type"); if (opcode == Opcodes.NEW && type.charAt(0) == '[') { throw new IllegalArgumentException("NEW cannot be used to create arrays: " + type); } super.visitTypeInsn(opcode, type); ++insnCount; }
@Override public void visitLdcInsn(final Object value) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkLdcConstant(value); super.visitLdcInsn(value); ++insnCount; }
@Override public void visitLdcInsn(final Object value) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkLdcConstant(value); super.visitLdcInsn(value); ++insnCount; }
@Override public void visitVarInsn(final int opcode, final int var) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_VAR_INSN); checkUnsignedShort(var, INVALID_LOCAL_VARIABLE_INDEX); super.visitVarInsn(opcode, var); ++insnCount; }
@Override public void visitVarInsn(final int opcode, final int var) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_VAR_INSN); checkUnsignedShort(var, INVALID_LOCAL_VARIABLE_INDEX); super.visitVarInsn(opcode, var); ++insnCount; }
@Override public void visitJumpInsn(final int opcode, final Label label) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_JUMP_INSN); checkLabel(label, false, "label"); super.visitJumpInsn(opcode, label); referencedLabels.add(label); ++insnCount; }
@Override public void visitJumpInsn(final int opcode, final Label label) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_JUMP_INSN); checkLabel(label, false, "label"); super.visitJumpInsn(opcode, label); referencedLabels.add(label); ++insnCount; }
@Override public void visitFieldInsn( final int opcode, final String owner, final String name, final String descriptor) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_FIELD_INSN); checkInternalName(version, owner, "owner"); checkUnqualifiedName(version, name, "name"); checkDescriptor(version, descriptor, false); super.visitFieldInsn(opcode, owner, name, descriptor); ++insnCount; }
@Override public void visitIincInsn(final int var, final int increment) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkUnsignedShort(var, INVALID_LOCAL_VARIABLE_INDEX); checkSignedShort(increment, "Invalid increment"); super.visitIincInsn(var, increment); ++insnCount; }
@Override public void visitFieldInsn( final int opcode, final String owner, final String name, final String descriptor) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkOpcodeMethod(opcode, Method.VISIT_FIELD_INSN); checkInternalName(version, owner, "owner"); checkUnqualifiedName(version, name, "name"); checkDescriptor(version, descriptor, false); super.visitFieldInsn(opcode, owner, name, descriptor); ++insnCount; }
@Override public void visitLineNumber(final int line, final Label start) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkUnsignedShort(line, "Invalid line number"); checkLabel(start, true, START_LABEL); super.visitLineNumber(line, start); }
@Override public void visitIincInsn(final int var, final int increment) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkUnsignedShort(var, INVALID_LOCAL_VARIABLE_INDEX); checkSignedShort(increment, "Invalid increment"); super.visitIincInsn(var, increment); ++insnCount; }
@Override public void visitLineNumber(final int line, final Label start) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkUnsignedShort(line, "Invalid line number"); checkLabel(start, true, START_LABEL); super.visitLineNumber(line, start); }
@Override public AnnotationVisitor visitTryCatchAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); int sort = new TypeReference(typeRef).getSort(); if (sort != TypeReference.EXCEPTION_PARAMETER) { throw new IllegalArgumentException(INVALID_TYPE_REFERENCE + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRef(typeRef); CheckMethodAdapter.checkDescriptor(version, descriptor, false); return new CheckAnnotationAdapter( super.visitTryCatchAnnotation(typeRef, typePath, descriptor, visible)); }
@Override public AnnotationVisitor visitTryCatchAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); int sort = new TypeReference(typeRef).getSort(); if (sort != TypeReference.EXCEPTION_PARAMETER) { throw new IllegalArgumentException(INVALID_TYPE_REFERENCE + Integer.toHexString(sort)); } CheckClassAdapter.checkTypeRef(typeRef); CheckMethodAdapter.checkDescriptor(version, descriptor, false); return new CheckAnnotationAdapter( super.visitTryCatchAnnotation(typeRef, typePath, descriptor, visible)); }