@@ -85,6 +85,13 @@ public class BcBands extends BandSet {
8585 private int renumberedOffset ;
8686 private final IntList bcLabelRelativeOffsets = new IntList ();
8787
88+ /**
89+ * Constructs a new instance.
90+ *
91+ * @param cpBands the constant pool bands
92+ * @param segment the segment
93+ * @param effort the packing effort
94+ */
8895 public BcBands (final CpBands cpBands , final Segment segment , final int effort ) {
8996 super (effort , segment .getSegmentHeader ());
9097 this .cpBands = cpBands ;
@@ -222,6 +229,9 @@ private void updateRenumbering() {
222229 bciRenumbering .add (renumberedOffset );
223230 }
224231
232+ /**
233+ * Visits the end of a method's bytecode.
234+ */
225235 public void visitEnd () {
226236 for (int i = 0 ; i < bciRenumbering .size (); i ++) {
227237 if (bciRenumbering .get (i ) == -1 ) {
@@ -254,6 +264,14 @@ public void visitEnd() {
254264 }
255265 }
256266
267+ /**
268+ * Visits a field instruction.
269+ *
270+ * @param opcode the opcode.
271+ * @param owner the field owner class.
272+ * @param name the field name.
273+ * @param desc the field descriptor.
274+ */
257275 public void visitFieldInsn (int opcode , final String owner , final String name , final String desc ) {
258276 byteCodeOffset += 3 ;
259277 updateRenumbering ();
@@ -285,6 +303,12 @@ public void visitFieldInsn(int opcode, final String owner, final String name, fi
285303 bcCodes .add (opcode );
286304 }
287305
306+ /**
307+ * Visits an IINC instruction.
308+ *
309+ * @param var the local variable index.
310+ * @param increment the increment amount.
311+ */
288312 public void visitIincInsn (final int var , final int increment ) {
289313 if (var > 255 || increment > 255 ) {
290314 byteCodeOffset += 6 ;
@@ -301,6 +325,11 @@ public void visitIincInsn(final int var, final int increment) {
301325 updateRenumbering ();
302326 }
303327
328+ /**
329+ * Visits a simple instruction (no operands).
330+ *
331+ * @param opcode the opcode.
332+ */
304333 public void visitInsn (final int opcode ) {
305334 if (opcode >= 202 ) {
306335 throw new IllegalArgumentException ("Non-standard bytecode instructions not supported" );
@@ -310,6 +339,12 @@ public void visitInsn(final int opcode) {
310339 updateRenumbering ();
311340 }
312341
342+ /**
343+ * Visits an instruction with a single int operand.
344+ *
345+ * @param opcode the opcode.
346+ * @param operand the operand.
347+ */
313348 public void visitIntInsn (final int opcode , final int operand ) {
314349 switch (opcode ) {
315350 case 17 : // sipush
@@ -326,6 +361,12 @@ public void visitIntInsn(final int opcode, final int operand) {
326361 updateRenumbering ();
327362 }
328363
364+ /**
365+ * Visits a jump instruction.
366+ *
367+ * @param opcode the opcode.
368+ * @param label the target label.
369+ */
329370 public void visitJumpInsn (final int opcode , final Label label ) {
330371 bcCodes .add (opcode );
331372 bcLabel .add (label );
@@ -334,10 +375,20 @@ public void visitJumpInsn(final int opcode, final Label label) {
334375 updateRenumbering ();
335376 }
336377
378+ /**
379+ * Visits a label.
380+ *
381+ * @param label the label.
382+ */
337383 public void visitLabel (final Label label ) {
338384 labelsToOffsets .put (label , Integer .valueOf (byteCodeOffset ));
339385 }
340386
387+ /**
388+ * Visits an LDC instruction.
389+ *
390+ * @param cst the constant to load.
391+ */
341392 public void visitLdcInsn (final Object cst ) {
342393 final CPConstant <?> constant = cpBands .getConstant (cst );
343394 if (segment .lastConstantHadWideIndex () || constant instanceof CPLong || constant instanceof CPDouble ) {
@@ -382,6 +433,13 @@ public void visitLdcInsn(final Object cst) {
382433 updateRenumbering ();
383434 }
384435
436+ /**
437+ * Visits a LOOKUPSWITCH instruction.
438+ *
439+ * @param dflt the default label.
440+ * @param keys the case keys.
441+ * @param labels the case labels.
442+ */
385443 public void visitLookupSwitchInsn (final Label dflt , final int [] keys , final Label [] labels ) {
386444 bcCodes .add (LOOKUPSWITCH );
387445 bcLabel .add (dflt );
@@ -397,6 +455,14 @@ public void visitLookupSwitchInsn(final Label dflt, final int[] keys, final Labe
397455 updateRenumbering ();
398456 }
399457
458+ /**
459+ * Visits a method invocation instruction.
460+ *
461+ * @param opcode the opcode.
462+ * @param owner the method owner class.
463+ * @param name the method name.
464+ * @param desc the method descriptor.
465+ */
400466 public void visitMethodInsn (int opcode , final String owner , final String name , final String desc ) {
401467 byteCodeOffset += 3 ;
402468 switch (opcode ) {
@@ -455,6 +521,12 @@ public void visitMethodInsn(int opcode, final String owner, final String name, f
455521 updateRenumbering ();
456522 }
457523
524+ /**
525+ * Visits a MULTIANEWARRAY instruction.
526+ *
527+ * @param desc the array type descriptor.
528+ * @param dimensions the number of dimensions.
529+ */
458530 public void visitMultiANewArrayInsn (final String desc , final int dimensions ) {
459531 byteCodeOffset += 4 ;
460532 updateRenumbering ();
@@ -463,6 +535,14 @@ public void visitMultiANewArrayInsn(final String desc, final int dimensions) {
463535 bcByte .add (dimensions & 0xFF );
464536 }
465537
538+ /**
539+ * Visits a TABLESWITCH instruction.
540+ *
541+ * @param min the minimum key value.
542+ * @param max the maximum key value.
543+ * @param dflt the default label.
544+ * @param labels the case labels.
545+ */
466546 public void visitTableSwitchInsn (final int min , final int max , final Label dflt , final Label ... labels ) {
467547 bcCodes .add (TABLESWITCH );
468548 bcLabel .add (dflt );
@@ -479,6 +559,12 @@ public void visitTableSwitchInsn(final int min, final int max, final Label dflt,
479559 updateRenumbering ();
480560 }
481561
562+ /**
563+ * Visits a type instruction.
564+ *
565+ * @param opcode the opcode (NEW, ANEWARRAY, CHECKCAST, or INSTANCEOF).
566+ * @param type the type descriptor.
567+ */
482568 public void visitTypeInsn (final int opcode , final String type ) {
483569 // NEW, ANEWARRAY, CHECKCAST or INSTANCEOF
484570 byteCodeOffset += 3 ;
@@ -490,6 +576,12 @@ public void visitTypeInsn(final int opcode, final String type) {
490576 }
491577 }
492578
579+ /**
580+ * Visits a local variable instruction.
581+ *
582+ * @param opcode the opcode.
583+ * @param var the local variable index.
584+ */
493585 public void visitVarInsn (final int opcode , final int var ) {
494586 // ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET
495587 if (var > 255 ) {
0 commit comments