@@ -99,6 +99,7 @@ public class ClassReader {
99
99
* necessarily start at offset 0. Use {@link #getItem} and {@link #header} to get correct
100
100
* ClassFile element offsets within this byte array.
101
101
*/
102
+ // DontCheck(MemberName): can't be renamed (for backward binary compatibility).
102
103
public final byte [] b ;
103
104
104
105
/**
@@ -488,7 +489,7 @@ public void accept(
488
489
accessFlags |= Opcodes .ACC_SYNTHETIC ;
489
490
} else if (Constants .SOURCE_DEBUG_EXTENSION .equals (attributeName )) {
490
491
sourceDebugExtension =
491
- readUTF (currentAttributeOffset , attributeLength , new char [attributeLength ]);
492
+ readUtf (currentAttributeOffset , attributeLength , new char [attributeLength ]);
492
493
} else if (Constants .RUNTIME_INVISIBLE_ANNOTATIONS .equals (attributeName )) {
493
494
runtimeInvisibleAnnotationsOffset = currentAttributeOffset ;
494
495
} else if (Constants .RUNTIME_INVISIBLE_TYPE_ANNOTATIONS .equals (attributeName )) {
@@ -530,7 +531,8 @@ public void accept(
530
531
531
532
// Visit the Module, ModulePackages and ModuleMainClass attributes.
532
533
if (moduleOffset != 0 ) {
533
- readModule (classVisitor , context , moduleOffset , modulePackagesOffset , moduleMainClass );
534
+ readModuleAttributes (
535
+ classVisitor , context , moduleOffset , modulePackagesOffset , moduleMainClass );
534
536
}
535
537
536
538
// Visit the NestHost attribute.
@@ -685,7 +687,7 @@ public void accept(
685
687
// ----------------------------------------------------------------------------------------------
686
688
687
689
/**
688
- * Reads the module attribute and visit it .
690
+ * Reads the Module, ModulePackages and ModuleMainClass attributes and visit them .
689
691
*
690
692
* @param classVisitor the current class visitor
691
693
* @param context information about the class being parsed.
@@ -695,7 +697,7 @@ public void accept(
695
697
* attribute_info's attribute_name_index and attribute_length fields), or 0.
696
698
* @param moduleMainClass the string corresponding to the ModuleMainClass attribute, or null.
697
699
*/
698
- private void readModule (
700
+ private void readModuleAttributes (
699
701
final ClassVisitor classVisitor ,
700
702
final Context context ,
701
703
final int moduleOffset ,
@@ -1111,7 +1113,7 @@ private int readMethod(
1111
1113
context .currentMethodAccessFlags ,
1112
1114
context .currentMethodName ,
1113
1115
context .currentMethodDescriptor ,
1114
- signatureIndex == 0 ? null : readUTF (signatureIndex , charBuffer ),
1116
+ signatureIndex == 0 ? null : readUtf (signatureIndex , charBuffer ),
1115
1117
exceptions );
1116
1118
if (methodVisitor == null ) {
1117
1119
return currentOffset ;
@@ -1601,18 +1603,15 @@ private void readCode(
1601
1603
1602
1604
// Read the 'exception_table_length' and 'exception_table' field to create a label for each
1603
1605
// referenced instruction, and to make methodVisitor visit the corresponding try catch blocks.
1604
- {
1605
- int exceptionTableLength = readUnsignedShort (currentOffset );
1606
- currentOffset += 2 ;
1607
- while (exceptionTableLength -- > 0 ) {
1608
- Label start = createLabel (readUnsignedShort (currentOffset ), labels );
1609
- Label end = createLabel (readUnsignedShort (currentOffset + 2 ), labels );
1610
- Label handler = createLabel (readUnsignedShort (currentOffset + 4 ), labels );
1611
- String catchType =
1612
- readUTF8 (cpInfoOffsets [readUnsignedShort (currentOffset + 6 )], charBuffer );
1613
- currentOffset += 8 ;
1614
- methodVisitor .visitTryCatchBlock (start , end , handler , catchType );
1615
- }
1606
+ int exceptionTableLength = readUnsignedShort (currentOffset );
1607
+ currentOffset += 2 ;
1608
+ while (exceptionTableLength -- > 0 ) {
1609
+ Label start = createLabel (readUnsignedShort (currentOffset ), labels );
1610
+ Label end = createLabel (readUnsignedShort (currentOffset + 2 ), labels );
1611
+ Label handler = createLabel (readUnsignedShort (currentOffset + 4 ), labels );
1612
+ String catchType = readUTF8 (cpInfoOffsets [readUnsignedShort (currentOffset + 6 )], charBuffer );
1613
+ currentOffset += 8 ;
1614
+ methodVisitor .visitTryCatchBlock (start , end , handler , catchType );
1616
1615
}
1617
1616
1618
1617
// Read the Code attributes to create a label for each referenced instruction (the variables
@@ -2142,11 +2141,11 @@ private void readCode(
2142
2141
currentOffset += 4 - (currentBytecodeOffset & 3 );
2143
2142
// Read the instruction.
2144
2143
Label defaultLabel = labels [currentBytecodeOffset + readInt (currentOffset )];
2145
- int nPairs = readInt (currentOffset + 4 );
2144
+ int numPairs = readInt (currentOffset + 4 );
2146
2145
currentOffset += 8 ;
2147
- int [] keys = new int [nPairs ];
2148
- Label [] values = new Label [nPairs ];
2149
- for (int i = 0 ; i < nPairs ; ++i ) {
2146
+ int [] keys = new int [numPairs ];
2147
+ Label [] values = new Label [numPairs ];
2148
+ for (int i = 0 ; i < numPairs ; ++i ) {
2150
2149
keys [i ] = readInt (currentOffset );
2151
2150
values [i ] = labels [currentBytecodeOffset + readInt (currentOffset + 4 )];
2152
2151
currentOffset += 8 ;
@@ -2958,12 +2957,12 @@ private int readElementValue(
2958
2957
private void computeImplicitFrame (final Context context ) {
2959
2958
String methodDescriptor = context .currentMethodDescriptor ;
2960
2959
Object [] locals = context .currentFrameLocalTypes ;
2961
- int nLocal = 0 ;
2960
+ int numLocal = 0 ;
2962
2961
if ((context .currentMethodAccessFlags & Opcodes .ACC_STATIC ) == 0 ) {
2963
2962
if ("<init>" .equals (context .currentMethodName )) {
2964
- locals [nLocal ++] = Opcodes .UNINITIALIZED_THIS ;
2963
+ locals [numLocal ++] = Opcodes .UNINITIALIZED_THIS ;
2965
2964
} else {
2966
- locals [nLocal ++] = readClass (header + 2 , context .charBuffer );
2965
+ locals [numLocal ++] = readClass (header + 2 , context .charBuffer );
2967
2966
}
2968
2967
}
2969
2968
// Parse the method descriptor, one argument type descriptor at each iteration. Start by
@@ -2977,16 +2976,16 @@ private void computeImplicitFrame(final Context context) {
2977
2976
case 'B' :
2978
2977
case 'S' :
2979
2978
case 'I' :
2980
- locals [nLocal ++] = Opcodes .INTEGER ;
2979
+ locals [numLocal ++] = Opcodes .INTEGER ;
2981
2980
break ;
2982
2981
case 'F' :
2983
- locals [nLocal ++] = Opcodes .FLOAT ;
2982
+ locals [numLocal ++] = Opcodes .FLOAT ;
2984
2983
break ;
2985
2984
case 'J' :
2986
- locals [nLocal ++] = Opcodes .LONG ;
2985
+ locals [numLocal ++] = Opcodes .LONG ;
2987
2986
break ;
2988
2987
case 'D' :
2989
- locals [nLocal ++] = Opcodes .DOUBLE ;
2988
+ locals [numLocal ++] = Opcodes .DOUBLE ;
2990
2989
break ;
2991
2990
case '[' :
2992
2991
while (methodDescriptor .charAt (currentMethodDescritorOffset ) == '[' ) {
@@ -2998,20 +2997,20 @@ private void computeImplicitFrame(final Context context) {
2998
2997
++currentMethodDescritorOffset ;
2999
2998
}
3000
2999
}
3001
- locals [nLocal ++] =
3000
+ locals [numLocal ++] =
3002
3001
methodDescriptor .substring (
3003
3002
currentArgumentDescriptorStartOffset , ++currentMethodDescritorOffset );
3004
3003
break ;
3005
3004
case 'L' :
3006
3005
while (methodDescriptor .charAt (currentMethodDescritorOffset ) != ';' ) {
3007
3006
++currentMethodDescritorOffset ;
3008
3007
}
3009
- locals [nLocal ++] =
3008
+ locals [numLocal ++] =
3010
3009
methodDescriptor .substring (
3011
3010
currentArgumentDescriptorStartOffset + 1 , currentMethodDescritorOffset ++);
3012
3011
break ;
3013
3012
default :
3014
- context .currentFrameLocalCount = nLocal ;
3013
+ context .currentFrameLocalCount = numLocal ;
3015
3014
return ;
3016
3015
}
3017
3016
}
@@ -3178,7 +3177,11 @@ private int readVerificationTypeInfo(
3178
3177
// Methods to parse attributes
3179
3178
// ----------------------------------------------------------------------------------------------
3180
3179
3181
- /** @return the offset in {@link #b} of the first ClassFile's 'attributes' array field entry. */
3180
+ /**
3181
+ * Returns the offset in {@link #b} of the first ClassFile's 'attributes' array field entry.
3182
+ *
3183
+ * @return the offset in {@link #b} of the first ClassFile's 'attributes' array field entry.
3184
+ */
3182
3185
final int getFirstAttributeOffset () {
3183
3186
// Skip the access_flags, this_class, super_class, and interfaces_count fields (using 2 bytes
3184
3187
// each), as well as the interfaces array field (2 bytes per interface).
@@ -3399,12 +3402,13 @@ public long readLong(final int offset) {
3399
3402
* large. It is not automatically resized.
3400
3403
* @return the String corresponding to the specified CONSTANT_Utf8 entry.
3401
3404
*/
3405
+ // DontCheck(AbbreviationAsWordInName): can't be renamed (for backward binary compatibility).
3402
3406
public String readUTF8 (final int offset , final char [] charBuffer ) {
3403
3407
int constantPoolEntryIndex = readUnsignedShort (offset );
3404
3408
if (offset == 0 || constantPoolEntryIndex == 0 ) {
3405
3409
return null ;
3406
3410
}
3407
- return readUTF (constantPoolEntryIndex , charBuffer );
3411
+ return readUtf (constantPoolEntryIndex , charBuffer );
3408
3412
}
3409
3413
3410
3414
/**
@@ -3416,14 +3420,14 @@ public String readUTF8(final int offset, final char[] charBuffer) {
3416
3420
* large. It is not automatically resized.
3417
3421
* @return the String corresponding to the specified CONSTANT_Utf8 entry.
3418
3422
*/
3419
- final String readUTF (final int constantPoolEntryIndex , final char [] charBuffer ) {
3423
+ final String readUtf (final int constantPoolEntryIndex , final char [] charBuffer ) {
3420
3424
String value = constantUtf8Values [constantPoolEntryIndex ];
3421
3425
if (value != null ) {
3422
3426
return value ;
3423
3427
}
3424
3428
int cpInfoOffset = cpInfoOffsets [constantPoolEntryIndex ];
3425
3429
return constantUtf8Values [constantPoolEntryIndex ] =
3426
- readUTF (cpInfoOffset + 2 , readUnsignedShort (cpInfoOffset ), charBuffer );
3430
+ readUtf (cpInfoOffset + 2 , readUnsignedShort (cpInfoOffset ), charBuffer );
3427
3431
}
3428
3432
3429
3433
/**
@@ -3435,7 +3439,7 @@ final String readUTF(final int constantPoolEntryIndex, final char[] charBuffer)
3435
3439
* large. It is not automatically resized.
3436
3440
* @return the String corresponding to the specified UTF8 string.
3437
3441
*/
3438
- private String readUTF (final int utfOffset , final int utfLength , final char [] charBuffer ) {
3442
+ private String readUtf (final int utfOffset , final int utfLength , final char [] charBuffer ) {
3439
3443
int currentOffset = utfOffset ;
3440
3444
int endOffset = currentOffset + utfLength ;
3441
3445
int strLength = 0 ;
0 commit comments