Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 1.1.5
-
Component/s: Java Integration
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
If you have 2 files with the same name both in directories on your load path and one is a .rb file and the other is a .class file, the .class file will be loaded first.
In the example attached I have a file load_test.rb that adds the two sub-directories to the load path
$LOAD_PATH << File.expand_path(File.dirname(_FILE_) + "/dir1")
$LOAD_PATH << File.expand_path(File.dirname(_FILE_) + "/dir2")
dir1 contains a file, target.rb with the code: puts "target.rb in dir1"
dir2 contains a file, target.class which is the output of running a file target.rb through jrubyc. The original target.rb file in dir2 was: puts "target.rb in dir2"
The third line of the load_tes.rb file is then
require 'target'
And the output is: target.rb in dir2
I should have mentioned that if you remove target.class from dir2 and put target.rb in its place, you get the correct output: target.rb in dir1 so this only affects .rb to .class ordering. Also, if you compile both target files, you will also get the correct dir1 output.