You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ju...@apache.org on 2026/04/18 13:39:29 UTC

(hbase) branch branch-2 updated: HBASE-30070 Replace deprecated JRuby LoadService#findFileForLoad with $LOAD_PATH.resolve_feature_path (#8052)

This is an automated email from the ASF dual-hosted git repository.

junegunn pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new c4f1e64bbe9 HBASE-30070 Replace deprecated JRuby LoadService#findFileForLoad with $LOAD_PATH.resolve_feature_path (#8052)
c4f1e64bbe9 is described below

commit c4f1e64bbe934a3bd9f20408382b450acb46d60f
Author: Jinhyuk Kim <ji...@gmail.com>
AuthorDate: Sat Apr 18 22:35:44 2026 +0900

    HBASE-30070 Replace deprecated JRuby LoadService#findFileForLoad with $LOAD_PATH.resolve_feature_path (#8052)
    
    Signed-off-by: Junegunn Choi <ju...@apache.org>
---
 hbase-shell/src/main/ruby/irb/hirb.rb | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/hbase-shell/src/main/ruby/irb/hirb.rb b/hbase-shell/src/main/ruby/irb/hirb.rb
index 34638f228a9..a8af81fe9ec 100644
--- a/hbase-shell/src/main/ruby/irb/hirb.rb
+++ b/hbase-shell/src/main/ruby/irb/hirb.rb
@@ -209,22 +209,19 @@ module IRB
     ##
     # Determine the loadable path for a given filename by searching through $LOAD_PATH
     #
-    # This serves a similar purpose to IRB::IrbLoader#search_file_from_ruby_path, but uses JRuby's
-    # loader, which allows us to find special paths like "uri:classloader" inside of a Jar.
+    # Uses $LOAD_PATH.resolve_feature_path, which resolves files on disk as well as
+    # entries inside jars on the classpath. Returns nil on miss.
     #
     # @param [String] filename
     # @return [String] path
     def self.path_for_load(filename)
       return File.absolute_path(filename) if File.exist? filename
 
-      # Get JRuby's LoadService from the global (singleton) instance of the runtime
-      # (org.jruby.Ruby), which allows us to use JRuby's tools for searching the load path.
-      runtime = org.jruby.Ruby.getGlobalRuntime
-      loader = runtime.getLoadService
-      search_state = loader.findFileForLoad filename
-      raise LoadError, "no such file to load -- #{filename}" if search_state.library.nil?
+      resolved = $LOAD_PATH.resolve_feature_path(filename)
+      raise LoadError, "no such file to load -- #{filename}" if resolved.nil?
 
-      search_state.loadName
+      _type, path = resolved
+      path
     end
 
     ##