Skip to content

Commit

Permalink
Merge pull request ruby#1806 from enebo/jruby_loader_fixes
Browse files Browse the repository at this point in the history
Fix template generation of Loader.java for JRuby
  • Loading branch information
kddnewton authored Nov 10, 2023
2 parents 7bf28ea + 09d561e commit b083822
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions templates/java/org/prism/Loader.java.erb
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,18 @@ public class Loader {

private final ByteBuffer buffer;
private final Nodes.Source source;
private String encodingName;
protected String encodingName;
<%- if string_type == "String" -%>
private Charset encodingCharset;
<%- end -%>
private ConstantPool constantPool;
private Loader(byte[] serialized, Nodes.Source source) {
protected Loader(byte[] serialized, Nodes.Source source) {
this.buffer = ByteBuffer.wrap(serialized).order(ByteOrder.nativeOrder());
this.source = source;
}
private ParseResult load() {
protected ParseResult load() {
expect((byte) 'P', "incorrect prism header");
expect((byte) 'R', "incorrect prism header");
expect((byte) 'I', "incorrect prism header");
Expand All @@ -106,7 +108,9 @@ public class Loader {
byte[] encodingNameBytes = new byte[encodingLength];
buffer.get(encodingNameBytes);
this.encodingName = new String(encodingNameBytes, StandardCharsets.US_ASCII);
<%- if string_type == "String" -%>
this.encodingCharset = getEncodingCharset(this.encodingName);
<%- end -%>

source.setStartLine(loadVarInt());

Expand Down

0 comments on commit b083822

Please sign in to comment.