8080675: Enhance the classfile library to support construction of classfiles from scratch
Reviewed-by: jjg
This commit is contained in:
parent
eb76b21f6d
commit
19a0c8b1f5
@ -131,6 +131,11 @@ public class Annotation {
|
||||
const_value_index = cr.readUnsignedShort();
|
||||
}
|
||||
|
||||
public Primitive_element_value(int const_value_index, int tag) {
|
||||
super(tag);
|
||||
this.const_value_index = const_value_index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int length() {
|
||||
return 2;
|
||||
@ -151,6 +156,12 @@ public class Annotation {
|
||||
const_name_index = cr.readUnsignedShort();
|
||||
}
|
||||
|
||||
public Enum_element_value(int type_name_index, int const_name_index, int tag) {
|
||||
super(tag);
|
||||
this.type_name_index = type_name_index;
|
||||
this.const_name_index = const_name_index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int length() {
|
||||
return 4;
|
||||
@ -170,6 +181,11 @@ public class Annotation {
|
||||
class_info_index = cr.readUnsignedShort();
|
||||
}
|
||||
|
||||
public Class_element_value(int class_info_index, int tag) {
|
||||
super(tag);
|
||||
this.class_info_index = class_info_index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int length() {
|
||||
return 2;
|
||||
@ -189,6 +205,11 @@ public class Annotation {
|
||||
annotation_value = new Annotation(cr);
|
||||
}
|
||||
|
||||
public Annotation_element_value(Annotation annotation_value, int tag) {
|
||||
super(tag);
|
||||
this.annotation_value = annotation_value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int length() {
|
||||
return annotation_value.length();
|
||||
@ -211,6 +232,12 @@ public class Annotation {
|
||||
values[i] = element_value.read(cr);
|
||||
}
|
||||
|
||||
public Array_element_value(element_value[] values, int tag) {
|
||||
super(tag);
|
||||
this.num_values = values.length;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int length() {
|
||||
int n = 2;
|
||||
@ -234,6 +261,11 @@ public class Annotation {
|
||||
value = element_value.read(cr);
|
||||
}
|
||||
|
||||
public element_value_pair(int element_name_index, element_value value) {
|
||||
this.element_name_index = element_name_index;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return 2 + value.length();
|
||||
}
|
||||
|
@ -69,6 +69,11 @@ public class Attributes implements Iterable<Attribute> {
|
||||
}
|
||||
}
|
||||
|
||||
public Attributes(Map<String, Attribute> attributes) {
|
||||
this.attrs = attributes.values().toArray(new Attribute[attributes.size()]);
|
||||
map = attributes;
|
||||
}
|
||||
|
||||
public Iterator<Attribute> iterator() {
|
||||
return Arrays.asList(attrs).iterator();
|
||||
}
|
||||
|
@ -72,6 +72,13 @@ public class InnerClasses_attribute extends Attribute {
|
||||
inner_class_access_flags = new AccessFlags(cr.readUnsignedShort());
|
||||
}
|
||||
|
||||
public Info(int inner_class_info_index, int outer_class_info_index, int inner_name_index, AccessFlags inner_class_access_flags) {
|
||||
this.inner_class_info_index = inner_class_info_index;
|
||||
this.outer_class_info_index = outer_class_info_index;
|
||||
this.inner_name_index = inner_name_index;
|
||||
this.inner_class_access_flags = inner_class_access_flags;
|
||||
}
|
||||
|
||||
public CONSTANT_Class_info getInnerClassInfo(ConstantPool constant_pool) throws ConstantPoolException {
|
||||
if (inner_class_info_index == 0)
|
||||
return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user