Example #1
0
 @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);
 }