jruby/jruby — pull request #2025 by mkristian (2014-10-07 08:23:11+00:00)
Title: do not change jruby commandline context classloader

putting the jruby-classloader as context classloader means that all attached "jars" can be found via
the Thread.currentThread.contextClassLoader. running jruby from other environments like servlets just
leave the context classloader as is. so this was a commandline only feature.

finally it keeps the classloader semantic uniform wether executed from commandline or inside a j2ee container
or osgi framework or embedded jruby in a java application.

maybe there is reason for this but this reason is not there with running any tests and any code depending on this feature of the commandline execution will cease to work when running in an environment where there runtime.getJRubyClassLoader is not the thread.contextClassLoader.

one more thing: image some jruby code loads some java which again uses the embedded JRuby via ScriptingContainer then you will chain instance of JRubyClassLoaders via the parent classloader, which is just asked for classloader problems. you all might have used ruby-maven which does exactly such JRuby -> Java -> JRuby thingy.

@enebo @ratnikov maybe one of you have a solid usecase why jruby commandline does such classloader tricks - please tell me !