Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.4
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: Core Classes/Modules, RubySpec
-
Labels:None
-
Number of attachments :
Description
The rubydoc for Kernel#load explicitly states about the wrap parameter:
"If the optional wrap parameter is true, the loaded script will be executed under an anonymous module, protecting the calling program's global namespace."
But JRuby doesn't provide such protection at the moment.
This caused one rubyspec failure:
1) Kernel#load allows wrapping the code in the file in an anonymous module FAILED Expected "constant" to equal nil /opt/work/rubyspec.git/core/kernel/load_spec.rb:233 /opt/work/rubyspec.git/core/kernel/load_spec.rb:31 /opt/work/rubyspec.git/core/kernel/load_spec.rb:55:in `load' /opt/work/mspec.git/bin/mspec-run:8 Finished in 0.461000 seconds
Attached also a standalone example that exhibits the problem. Run load_test.rb and you'll see:
Z:\work\samples>ruby load_test.rb
"main – 31095610"
"MAIN: main – 31128780"
nil
nil
Z:\work\samples>jruby load_test.rb
"main – 18788761"
"MAIN: main – 9102426"
"constant"
"constant"
Activity
Charles Oliver Nutter
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Charles Oliver Nutter [ headius ] | |
| Fix Version/s | JRuby 1.7 [ 17049 ] | |
| Resolution | Fixed [ 1 ] |