@@ -178,6 +178,7 @@ public String getRequestedTypeName(){
178
178
public static final String RUNTIME_INVISIBLE_ANNOTATIONS_ATTR = "RuntimeInvisibleAnnotations" ;
179
179
public static final String RUNTIME_VISIBLE_ANNOTATIONS_ATTR = "RuntimeVisibleAnnotations" ;
180
180
public static final String RUNTIME_VISIBLE_TYPE_ANNOTATIONS_ATTR = "RuntimeVisibleTypeAnnotations" ;
181
+ public static final String RUNTIME_INVISIBLE_TYPE_ANNOTATIONS_ATTR = "RuntimeInvisibleTypeAnnotations" ;
181
182
182
183
//--- standard field attributes
183
184
public static final String CONST_VALUE_ATTR = "ConstantValue" ;
@@ -216,11 +217,19 @@ public String getRequestedTypeName(){
216
217
public static final String INNER_CLASSES_ATTR = "InnerClasses" ;
217
218
public static final String ENCLOSING_METHOD_ATTR = "EnclosingMethod" ;
218
219
public static final String BOOTSTRAP_METHOD_ATTR = "BootstrapMethods" ;
219
-
220
+ public static final String RECORD_ATTR = "Record" ;
221
+
220
222
protected final static String [] stdClassAttrs = {
221
223
SOURCE_FILE_ATTR , DEPRECATED_ATTR , INNER_CLASSES_ATTR , DEPRECATED_ATTR , SIGNATURE_ATTR ,
222
224
RUNTIME_INVISIBLE_ANNOTATIONS_ATTR , RUNTIME_VISIBLE_ANNOTATIONS_ATTR , RUNTIME_VISIBLE_TYPE_ANNOTATIONS_ATTR ,
223
- ENCLOSING_METHOD_ATTR , BOOTSTRAP_METHOD_ATTR };
225
+ ENCLOSING_METHOD_ATTR , BOOTSTRAP_METHOD_ATTR , RECORD_ATTR };
226
+
227
+ //--- standard Record attributes
228
+ public static final String [] stdRecordComponentAttrs = {
229
+ SIGNATURE_ATTR ,
230
+ RUNTIME_INVISIBLE_ANNOTATIONS_ATTR , RUNTIME_VISIBLE_ANNOTATIONS_ATTR ,
231
+ RUNTIME_INVISIBLE_TYPE_ANNOTATIONS_ATTR , RUNTIME_VISIBLE_TYPE_ANNOTATIONS_ATTR
232
+ };
224
233
225
234
226
235
protected String internStdAttrName (int cpIdx , String name , String [] stdNames ){
@@ -1530,6 +1539,75 @@ public void parseBootstrapMethodAttr (ClassFileReader reader, Object tag){
1530
1539
1531
1540
setBootstrapMethodsDone ( reader , tag );
1532
1541
}
1542
+
1543
+ //-- record parsing
1544
+ /*
1545
+ Record_attribute {
1546
+ u2 attribute_name_index;
1547
+ u4 attribute_length;
1548
+ u2 components_count;
1549
+ {
1550
+ u2 name_index;
1551
+ u2 descriptor_index;
1552
+ u2 attributes_count;
1553
+ attribute_info attributes[attributes_count];
1554
+ } components[components_count];
1555
+ }
1556
+ */
1557
+ private void setRecordComponentCount (ClassFileReader reader , Object tag , int count ) {
1558
+ int p = pos ;
1559
+ reader .setRecordComponentCount (this , tag , count );
1560
+ pos = p ;
1561
+ }
1562
+
1563
+ private void setRecordComponent (ClassFileReader reader , Object tag , int index , String name , String descriptor , int attributesCount ) {
1564
+ int p = pos ;
1565
+ reader .setRecordComponent (this , tag , index , name , descriptor , attributesCount );
1566
+ pos = p ;
1567
+ }
1568
+
1569
+ private void setRecordComponentAttribute (ClassFileReader reader , Object tag , int componentIndex , int attrIndex , String attrName , int attrLength ) {
1570
+ int p = pos + attrLength ;
1571
+ reader .setRecordComponentAttribute (this , tag , componentIndex , attrIndex , attrName , attrLength );
1572
+ pos = p ;
1573
+ }
1574
+
1575
+ private void setRecordComponentsDone (ClassFileReader reader , Object tag ) {
1576
+ int p = pos ;
1577
+ reader .setRecordComponentsDone (this , tag );
1578
+ pos = p ;
1579
+ }
1580
+
1581
+ public void parseRecordAttribute (ClassFileReader reader , Object tag ) {
1582
+ int componentsCount = readU2 ();
1583
+ setRecordComponentCount (reader , tag , componentsCount );
1584
+
1585
+ for (int i = 0 ; i < componentsCount ; i ++) {
1586
+ int nameIndex = readU2 ();
1587
+ String name = utf8At (nameIndex );
1588
+
1589
+ int descriptorIndex = readU2 ();
1590
+ String descriptor = utf8At (descriptorIndex );
1591
+
1592
+ int attributesCount = readU2 ();
1593
+
1594
+ // Create and set the record component
1595
+ setRecordComponent (reader , tag , i , name , descriptor , attributesCount );
1596
+
1597
+ // Parse the component attributes
1598
+ for (int j = 0 ; j < attributesCount ; j ++) {
1599
+ int attrNameIndex = readU2 ();
1600
+ String attrName = utf8At (attrNameIndex );
1601
+
1602
+ attrName = internStdAttrName (attrNameIndex , attrName , stdRecordComponentAttrs );
1603
+
1604
+ int attrLength = readI4 ();
1605
+ setRecordComponentAttribute (reader , tag , i , j , attrName , attrLength );
1606
+ }
1607
+ }
1608
+
1609
+ setRecordComponentsDone (reader , tag );
1610
+ }
1533
1611
1534
1612
String nameAt (int nameTypeInfoIdx ) {
1535
1613
return utf8At (u2 (cpPos [nameTypeInfoIdx ] + 1 ));
0 commit comments