At 8:38 PM -0600 2/16/09, Charles Oliver Nutter wrote:
I'm working on http://jira.codehaus.org/browse/JRUBY-3214 and I
think we need to ratchet down what load and require do when loading
.class files. They've started to get overloaded for loading an
individual Java class, which was never the intended purpose. This
generally circumvents normal Java classloading and classpath and
usually causes things to break, since you can easily load in a
single class but fail to load its dependencies.
So I propose the following:
load and require shall only be used for loading .jar files (as an
analog to extensions), .rb files, or .class files that represent
compiled .rb files.
The problem in the bug is that it tries first to do a normal class
load, which sees the current directory's "baz" class and loads it
before the "baz.class" in ../foo. When normal Java classloading is
taken out of the equation, it works correctly.
This also will affect classloading somewhat; since a given
classloader can only load a given package + class once, and with
Ruby load paths there could potentially be multiple compiled .rb
files with the same Java package and class, each precompiled .rb
file will be loaded in its own child classloader and executed.
Are you proposing any changes to how require operates when loading a
jar that implements BasicLibraryService.basicLoad?
This service is normally used to add Ruby modules and classes. This
technique is used in the java/jruby versions of RubyGems like hpricot
and redcloth.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email