From 2675dc0ee4158076eb2a2fb6ca0189c4f66b7706 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sun, 8 Mar 2026 19:58:04 +0100 Subject: [PATCH 1/3] Use ByteBuffer#get(int index, byte[] dst) in Loader.java * This is an absolute bulk get which does not modify the position, and therefore saves from getting, setting and restoring the position. --- templates/java/org/ruby_lang/prism/Loader.java.erb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/templates/java/org/ruby_lang/prism/Loader.java.erb b/templates/java/org/ruby_lang/prism/Loader.java.erb index b48dd4c1cb..3c2a0cfd09 100644 --- a/templates/java/org/ruby_lang/prism/Loader.java.erb +++ b/templates/java/org/ruby_lang/prism/Loader.java.erb @@ -59,10 +59,7 @@ public class Loader { int length = buffer.getInt(offset + 4); byte[] bytes = new byte[length]; - int position = buffer.position(); - buffer.position(start); - buffer.get(bytes, 0, length); - buffer.position(position); + buffer.get(start, bytes); constant = loader.bytesToName(bytes); cache[index] = constant; From 697c3f1fe75766d9acf5ce8749cf5a8dfac0efe7 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sun, 8 Mar 2026 20:13:12 +0100 Subject: [PATCH 2/3] Use javac --release to properly check compatibility with older version --- Rakefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 6e79e08b7f..01c4c62755 100644 --- a/Rakefile +++ b/Rakefile @@ -45,8 +45,7 @@ elsif RUBY_ENGINE == "jruby" ext.name = "prism" ext.ext_dir = "java" ext.lib_dir = "tmp" - ext.source_version = "1.8" - ext.target_version = "1.8" + ext.release = "8" ext.gem_spec = Gem::Specification.load("prism.gemspec") end end From 964702319ddd827c433ea714081bfff8cf3c1391 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sun, 8 Mar 2026 20:13:50 +0100 Subject: [PATCH 3/3] Compile Java files with compatibility 21+ * This is the minimum version that JRuby 10 requires. * It's also the minimum version that TruffleRuby 33 requires. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 01c4c62755..80b00bd913 100644 --- a/Rakefile +++ b/Rakefile @@ -45,7 +45,7 @@ elsif RUBY_ENGINE == "jruby" ext.name = "prism" ext.ext_dir = "java" ext.lib_dir = "tmp" - ext.release = "8" + ext.release = "21" ext.gem_spec = Gem::Specification.load("prism.gemspec") end end