Skip to content

Commit

Permalink
Use non-public lookup to avoid classloader issues
Browse files Browse the repository at this point in the history
On some JDKs it seems that the publicLookup may get confused about
which classloader to get methods from, leading to issues like
#268. This fixes the issue by using the full
private Lookup form.

Fixes #268
  • Loading branch information
headius committed Dec 4, 2024
1 parent 2287eaa commit b813106
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/jruby/rack/ext/Input.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class Input extends RubyObject {
// set up coderange-aware concat that works with the new catWithCodeRange as well as earlier JRuby without it.
// TODO: remove and replace with direct call once 9.3 is fully unsupported
MethodHandle catWithCR = null;
MethodHandles.Lookup lookup = MethodHandles.publicLookup();
MethodHandles.Lookup lookup = MethodHandles.lookup();
try {
catWithCR = lookup.findVirtual(RubyString.class, "catWithCodeRange", MethodType.methodType(int.class, ByteList.class, int.class));
} catch (NoSuchMethodException | IllegalAccessException e) {
Expand Down

0 comments on commit b813106

Please sign in to comment.