@@ -348,72 +348,72 @@ public static void insertUnboxNumberInsns(
348
348
public static void insertAnyNecessaryTypeConversionBytecodes (MethodVisitor mv , char targetDescriptor , String stackDescriptor ) {
349
349
if (CodeFlow .isPrimitive (stackDescriptor )) {
350
350
char stackTop = stackDescriptor .charAt (0 );
351
- if (stackTop == 'I' || stackTop == 'B' || stackTop == 'S' || stackTop == 'C' ) {
352
- if (targetDescriptor == 'D' ) {
351
+ if (stackTop == 'I' || stackTop == 'B' || stackTop == 'S' || stackTop == 'C' ) {
352
+ if (targetDescriptor == 'D' ) {
353
353
mv .visitInsn (I2D );
354
354
}
355
- else if (targetDescriptor == 'F' ) {
355
+ else if (targetDescriptor == 'F' ) {
356
356
mv .visitInsn (I2F );
357
357
}
358
- else if (targetDescriptor == 'J' ) {
358
+ else if (targetDescriptor == 'J' ) {
359
359
mv .visitInsn (I2L );
360
360
}
361
- else if (targetDescriptor == 'I' ) {
361
+ else if (targetDescriptor == 'I' ) {
362
362
// nop
363
363
}
364
364
else {
365
- throw new IllegalStateException ("cannot get from " + stackTop + " to " + targetDescriptor );
365
+ throw new IllegalStateException ("Cannot get from " + stackTop + " to " + targetDescriptor );
366
366
}
367
367
}
368
- else if (stackTop == 'J' ) {
369
- if (targetDescriptor == 'D' ) {
368
+ else if (stackTop == 'J' ) {
369
+ if (targetDescriptor == 'D' ) {
370
370
mv .visitInsn (L2D );
371
371
}
372
- else if (targetDescriptor == 'F' ) {
372
+ else if (targetDescriptor == 'F' ) {
373
373
mv .visitInsn (L2F );
374
374
}
375
- else if (targetDescriptor == 'J' ) {
375
+ else if (targetDescriptor == 'J' ) {
376
376
// nop
377
377
}
378
- else if (targetDescriptor == 'I' ) {
378
+ else if (targetDescriptor == 'I' ) {
379
379
mv .visitInsn (L2I );
380
380
}
381
381
else {
382
- throw new IllegalStateException ("cannot get from " + stackTop + " to " + targetDescriptor );
382
+ throw new IllegalStateException ("Cannot get from " + stackTop + " to " + targetDescriptor );
383
383
}
384
384
}
385
- else if (stackTop == 'F' ) {
386
- if (targetDescriptor == 'D' ) {
385
+ else if (stackTop == 'F' ) {
386
+ if (targetDescriptor == 'D' ) {
387
387
mv .visitInsn (F2D );
388
388
}
389
- else if (targetDescriptor == 'F' ) {
389
+ else if (targetDescriptor == 'F' ) {
390
390
// nop
391
391
}
392
- else if (targetDescriptor == 'J' ) {
392
+ else if (targetDescriptor == 'J' ) {
393
393
mv .visitInsn (F2L );
394
394
}
395
- else if (targetDescriptor == 'I' ) {
395
+ else if (targetDescriptor == 'I' ) {
396
396
mv .visitInsn (F2I );
397
397
}
398
398
else {
399
- throw new IllegalStateException ("cannot get from " + stackTop + " to " + targetDescriptor );
399
+ throw new IllegalStateException ("Cannot get from " + stackTop + " to " + targetDescriptor );
400
400
}
401
401
}
402
- else if (stackTop == 'D' ) {
403
- if (targetDescriptor == 'D' ) {
402
+ else if (stackTop == 'D' ) {
403
+ if (targetDescriptor == 'D' ) {
404
404
// nop
405
405
}
406
- else if (targetDescriptor == 'F' ) {
406
+ else if (targetDescriptor == 'F' ) {
407
407
mv .visitInsn (D2F );
408
408
}
409
- else if (targetDescriptor == 'J' ) {
409
+ else if (targetDescriptor == 'J' ) {
410
410
mv .visitInsn (D2L );
411
411
}
412
- else if (targetDescriptor == 'I' ) {
412
+ else if (targetDescriptor == 'I' ) {
413
413
mv .visitInsn (D2I );
414
414
}
415
415
else {
416
- throw new IllegalStateException ("cannot get from " + stackDescriptor + " to " + targetDescriptor );
416
+ throw new IllegalStateException ("Cannot get from " + stackDescriptor + " to " + targetDescriptor );
417
417
}
418
418
}
419
419
}
@@ -530,7 +530,7 @@ public static String toDescriptorFromObject(@Nullable Object value) {
530
530
}
531
531
532
532
/**
533
- * Returns if the descriptor is for a boolean primitive or boolean reference type.
533
+ * Determine whether the descriptor is for a boolean primitive or boolean reference type.
534
534
* @param descriptor type descriptor
535
535
* @return {@code true} if the descriptor is boolean compatible
536
536
*/
@@ -539,7 +539,7 @@ public static boolean isBooleanCompatible(@Nullable String descriptor) {
539
539
}
540
540
541
541
/**
542
- * Returns if the descriptor is for a primitive type.
542
+ * Determine whether the descriptor is for a primitive type.
543
543
* @param descriptor type descriptor
544
544
* @return {@code true} if a primitive type
545
545
*/
@@ -548,7 +548,7 @@ public static boolean isPrimitive(@Nullable String descriptor) {
548
548
}
549
549
550
550
/**
551
- * Returns if the descriptor is for a primitive array (e.g. "[[I").
551
+ * Determine whether the descriptor is for a primitive array (e.g. "[[I").
552
552
* @param descriptor the descriptor for a possible primitive array
553
553
* @return {@code true} if the descriptor a primitive array
554
554
*/
@@ -569,8 +569,8 @@ public static boolean isPrimitiveArray(@Nullable String descriptor) {
569
569
}
570
570
571
571
/**
572
- * Determine if boxing/unboxing can get from one type to the other. Assumes at least
573
- * one of the types is in boxed form (i.e. single char descriptor).
572
+ * Determine whether boxing/unboxing can get from one type to the other.
573
+ * Assumes at least one of the types is in boxed form (i.e. single char descriptor).
574
574
* @return {@code true} if it is possible to get (via boxing) from one descriptor to the other
575
575
*/
576
576
public static boolean areBoxingCompatible (String desc1 , String desc2 ) {
@@ -781,9 +781,8 @@ public static void insertBoxIfNecessary(MethodVisitor mv, char ch) {
781
781
}
782
782
783
783
/**
784
- * Deduce the descriptor for a type. Descriptors are like JVM type names but missing
785
- * the trailing ';' so for Object the descriptor is "Ljava/lang/Object" for int it is
786
- * "I".
784
+ * Deduce the descriptor for a type. Descriptors are like JVM type names but missing the
785
+ * trailing ';' so for Object the descriptor is "Ljava/lang/Object" for int it is "I".
787
786
* @param type the type (may be primitive) for which to determine the descriptor
788
787
* @return the descriptor
789
788
*/
@@ -957,7 +956,7 @@ public static int arrayCodeFor(String arraytype) {
957
956
case 'S' : return T_SHORT ;
958
957
case 'Z' : return T_BOOLEAN ;
959
958
default :
960
- throw new IllegalArgumentException ("Unexpected arraytype " + arraytype .charAt (0 ));
959
+ throw new IllegalArgumentException ("Unexpected arraytype " + arraytype .charAt (0 ));
961
960
}
962
961
}
963
962
@@ -971,7 +970,7 @@ public static boolean isReferenceTypeArray(String arraytype) {
971
970
if (ch == '[' ) {
972
971
continue ;
973
972
}
974
- return ch == 'L' ;
973
+ return ( ch == 'L' ) ;
975
974
}
976
975
return false ;
977
976
}
@@ -991,10 +990,10 @@ public static void insertNewArrayCode(MethodVisitor mv, int size, String arrayty
991
990
}
992
991
else {
993
992
if (arraytype .charAt (0 ) == '[' ) {
994
- // Handling the nested array case here. If vararg
995
- // is [[I then we want [I and not [I;
993
+ // Handling the nested array case here.
994
+ // If vararg is [[I then we want [I and not [I;
996
995
if (CodeFlow .isReferenceTypeArray (arraytype )) {
997
- mv .visitTypeInsn (ANEWARRAY , arraytype + ";" );
996
+ mv .visitTypeInsn (ANEWARRAY , arraytype + ";" );
998
997
}
999
998
else {
1000
999
mv .visitTypeInsn (ANEWARRAY , arraytype );
@@ -1026,7 +1025,7 @@ public static void insertNumericUnboxOrPrimitiveTypeCoercion(
1026
1025
}
1027
1026
}
1028
1027
1029
- public static final String toBoxedDescriptor (String primitiveDescriptor ) {
1028
+ public static String toBoxedDescriptor (String primitiveDescriptor ) {
1030
1029
switch (primitiveDescriptor .charAt (0 )) {
1031
1030
case 'I' : return "Ljava/lang/Integer" ;
1032
1031
case 'J' : return "Ljava/lang/Long" ;
@@ -1037,7 +1036,7 @@ public static final String toBoxedDescriptor(String primitiveDescriptor) {
1037
1036
case 'S' : return "Ljava/lang/Short" ;
1038
1037
case 'Z' : return "Ljava/lang/Boolean" ;
1039
1038
default :
1040
- throw new IllegalArgumentException ("Unexpected non primitive descriptor " + primitiveDescriptor );
1039
+ throw new IllegalArgumentException ("Unexpected non primitive descriptor " + primitiveDescriptor );
1041
1040
}
1042
1041
}
1043
1042
0 commit comments