Skip to content

Commit

Permalink
Merge pull request #5690 from bjhargrave/issues/5689
Browse files Browse the repository at this point in the history
classfile: Properly handle unnamed MethodParameter
  • Loading branch information
bjhargrave committed Jun 9, 2023
2 parents 5c2955e + 3997b2e commit d31e205
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ public String toString() {
static MethodParameter read(DataInput in, ConstantPool constant_pool) throws IOException {
int name_index = in.readUnsignedShort();
int access_flags = in.readUnsignedShort();
return new MethodParameter(constant_pool.utf8(name_index), access_flags);
String name = (name_index == 0) ? null : constant_pool.utf8(name_index);
return new MethodParameter(name, access_flags);
}

void write(DataOutput out, ConstantPool constant_pool) throws IOException {
int name_index = constant_pool.utf8Info(name);
int name_index = (name == null) ? 0 : constant_pool.utf8Info(name);
out.writeShort(name_index);
out.writeShort(access_flags);
}
Expand Down

0 comments on commit d31e205

Please sign in to comment.