jruby loads src/builtin/generator.rb ahead of any other file named generator
-----------------------------------------------------------------------------
Key: JRUBY-4218
URL: http://jira.codehaus.org/browse/JRUBY-4218
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.5
Environment: jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2009-11-05
6586) (Java HotSpot(TM) Client VM 1.6.0_14) [i386-java]
On Kubuntu 8.04.
Reporter: James Britt
Example; 2 files, in the same directory.
#------- generator.rb -----------
warn "#{__FILE__} is loaded"
class MyGen
def foo
__FILE__
end
end
#--------------------------------------
#--------------- test.rb -------------------
here = File.expand_path(File.dirname(__FILE__))
$:.unshift here
require 'generator.rb'
begin
p MyGen.new.foo
rescue
warn $!
end
#--------------------------------------
Line 2 in test.rb forces the current directory to the head of the load path, so
local files should be found and loaded first.
Execute test.rb using MRI (for example)
$ ruby test.rb
/home/james/tmp/jruby-require-bug/generator.rb is loaded
"/home/james/tmp/jruby-require-bug/generator.rb"
$
Try with jruby:
$ ruby jtest.rb
uninitialized constant MyGen
JRuby is loading sr/builtin/generator.rb despite the values in $:
(You can check this by adding a puts statement to that file to indicate when it
gets loaded.)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email