@Override public void visitMaxs(final int maxStack, final int maxLocals) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); visitMaxCalled = true; for (Label l : referencedLabels) { if (labelInsnIndices.get(l) == null) { throw new IllegalStateException("Undefined label used"); } } for (int i = 0; i < handlers.size(); i += 2) { Integer startInsnIndex = labelInsnIndices.get(handlers.get(i)); Integer endInsnIndex = labelInsnIndices.get(handlers.get(i + 1)); if (startInsnIndex == null || endInsnIndex == null) { throw new IllegalStateException("Undefined try catch block labels"); } if (endInsnIndex.intValue() <= startInsnIndex.intValue()) { throw new IllegalStateException("Emty try catch block handler range"); } } checkUnsignedShort(maxStack, "Invalid max stack"); checkUnsignedShort(maxLocals, "Invalid max locals"); super.visitMaxs(maxStack, maxLocals); }
@Override public void visitMaxs(final int maxStack, final int maxLocals) { checkStartCode(); checkEndCode(); endCode = true; for (Label l : usedLabels) { if (labels.get(l) == null) { throw new IllegalStateException("Undefined label used"); } } for (int i = 0; i < handlers.size();) { Integer start = labels.get(handlers.get(i++)); Integer end = labels.get(handlers.get(i++)); if (start == null || end == null) { throw new IllegalStateException( "Undefined try catch block labels"); } if (end.intValue() <= start.intValue()) { throw new IllegalStateException( "Emty try catch block handler range"); } } checkUnsignedShort(maxStack, "Invalid max stack"); checkUnsignedShort(maxLocals, "Invalid max locals"); super.visitMaxs(maxStack, maxLocals); }
@Override public void visitMaxs(final int maxStack, final int maxLocals) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); visitMaxCalled = true; for (Label l : referencedLabels) { if (labelInsnIndices.get(l) == null) { throw new IllegalStateException("Undefined label used"); } } for (int i = 0; i < handlers.size(); i += 2) { Integer startInsnIndex = labelInsnIndices.get(handlers.get(i)); Integer endInsnIndex = labelInsnIndices.get(handlers.get(i + 1)); if (startInsnIndex == null || endInsnIndex == null) { throw new IllegalStateException("Undefined try catch block labels"); } if (endInsnIndex.intValue() <= startInsnIndex.intValue()) { throw new IllegalStateException("Emty try catch block handler range"); } } checkUnsignedShort(maxStack, "Invalid max stack"); checkUnsignedShort(maxLocals, "Invalid max locals"); super.visitMaxs(maxStack, maxLocals); }
@Override public void visitVarInsn(final int opcode, final int var) { checkStartCode(); checkEndCode(); checkOpcode(opcode, 2); checkUnsignedShort(var, "Invalid 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 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 visitLocalVariable(final String name, final String desc, final String signature, final Label start, final Label end, final int index) { checkStartCode(); checkEndCode(); checkUnqualifiedName(version, name, "name"); checkDesc(desc, false); checkLabel(start, true, "start label"); checkLabel(end, true, "end label"); checkUnsignedShort(index, "Invalid variable index"); int s = labels.get(start).intValue(); int e = labels.get(end).intValue(); if (e < s) { throw new IllegalArgumentException( "Invalid start and end labels (end must be greater than start)"); } super.visitLocalVariable(name, desc, signature, start, end, index); }
checkLabel(start[i], true, "start label"); checkLabel(end[i], true, "end label"); checkUnsignedShort(index[i], "Invalid variable index"); int s = labels.get(start[i]).intValue(); int e = labels.get(end[i]).intValue();
@Override public void visitLocalVariable( final String name, final String descriptor, final String signature, final Label start, final Label end, final int index) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkUnqualifiedName(version, name, "name"); checkDescriptor(version, descriptor, false); checkLabel(start, true, START_LABEL); checkLabel(end, true, END_LABEL); checkUnsignedShort(index, INVALID_LOCAL_VARIABLE_INDEX); int startInsnIndex = labelInsnIndices.get(start).intValue(); int endInsnIndex = labelInsnIndices.get(end).intValue(); if (endInsnIndex < startInsnIndex) { throw new IllegalArgumentException( "Invalid start and end labels (end must be greater than start)"); } super.visitLocalVariable(name, descriptor, signature, start, end, index); }
@Override public void visitLocalVariable( final String name, final String descriptor, final String signature, final Label start, final Label end, final int index) { checkVisitCodeCalled(); checkVisitMaxsNotCalled(); checkUnqualifiedName(version, name, "name"); checkDescriptor(version, descriptor, false); checkLabel(start, true, START_LABEL); checkLabel(end, true, END_LABEL); checkUnsignedShort(index, INVALID_LOCAL_VARIABLE_INDEX); int startInsnIndex = labelInsnIndices.get(start).intValue(); int endInsnIndex = labelInsnIndices.get(end).intValue(); if (endInsnIndex < startInsnIndex) { throw new IllegalArgumentException( "Invalid start and end labels (end must be greater than start)"); } super.visitLocalVariable(name, descriptor, signature, start, end, index); }
@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 void visitIincInsn(final int var, final int increment) { checkStartCode(); checkEndCode(); checkUnsignedShort(var, "Invalid variable index"); checkSignedShort(increment, "Invalid increment"); super.visitIincInsn(var, increment); ++insnCount; }
@Override public void visitLineNumber(final int line, final Label start) { checkStartCode(); checkEndCode(); checkUnsignedShort(line, "Invalid line number"); checkLabel(start, true, "start label"); super.visitLineNumber(line, start); }
@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; }
checkLabel(start[i], true, START_LABEL); checkLabel(end[i], true, END_LABEL); checkUnsignedShort(index[i], INVALID_LOCAL_VARIABLE_INDEX); int startInsnIndex = labelInsnIndices.get(start[i]).intValue(); int endInsnIndex = labelInsnIndices.get(end[i]).intValue();
checkLabel(start[i], true, START_LABEL); checkLabel(end[i], true, END_LABEL); checkUnsignedShort(index[i], INVALID_LOCAL_VARIABLE_INDEX); int startInsnIndex = labelInsnIndices.get(start[i]).intValue(); int endInsnIndex = labelInsnIndices.get(end[i]).intValue();