zaadjis created JRUBY-6348:
------------------------------

             Summary: require doesn't load .class when original .rb eval-ed
                 Key: JRUBY-6348
                 URL: https://jira.codehaus.org/browse/JRUBY-6348
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules, Rails WAR Deployment
    Affects Versions: JRuby 1.6.5
         Environment: jruby 1.6.5.1 (ruby-1.8.7-p330) (2011-12-27 1bf37c2) 
(OpenJDK 64-Bit Server VM 1.6.0_23) [linux-amd64-java]
            Reporter: zaadjis


*Steps to reproduce:*

{code:none}
cd /tmp
rvm use jruby-1.6.5.1

echo 'puts "hello world" > foo.rb'
jrubyc foo.rb # creates foo.class
echo 'require __FILE__.sub(/\.rb$/, ".class")' > foo.rb

echo 'eval(File.read(f = File.expand_path("../foo.rb", __FILE__)), binding, f)' 
> bug.rb
jruby -J-Djruby.debug.loadService=true -d bug.rb

{code}

*Result:*

{code:none}
LoadService: trying builtinLib: enumerator.class
..snip..
LoadService: found builtinLib: enumerator.jar
LoadService: trying builtinLib: /tmp/foo.class.class
LoadService: trying builtinLib: /tmp/foo.class.rb
LoadService: trying resourceAsIs: /tmp/foo.class.class
LoadService: trying resourceAsIs: /tmp/foo.class.rb
LoadService: trying builtinLib: /tmp/foo.class.jar
LoadService: trying builtinLib: /tmp/foo.class.so
LoadService: trying builtinLib: /tmp/foo.class.bundle
LoadService: trying builtinLib: /tmp/foo.class.dll
LoadService: trying resourceAsIs: /tmp/foo.class.jar
LoadService: trying resourceAsIs: /tmp/foo.class.so
LoadService: trying resourceAsIs: /tmp/foo.class.bundle
LoadService: trying resourceAsIs: /tmp/foo.class.dll
LoadService: trying fileInClasspath: .//tmp/foo.class.class
LoadService: trying fileInClasspath: .//tmp/foo.class.rb
LoadService: trying fileInClasspath: .//tmp/foo.class.jar
LoadService: trying fileInClasspath: .//tmp/foo.class.so
LoadService: trying fileInClasspath: .//tmp/foo.class.bundle
LoadService: trying fileInClasspath: .//tmp/foo.class.dll
java.lang.ClassNotFoundException: tmp.Foo.classService
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at org.jruby.util.JRubyClassLoader.findClass(JRubyClassLoader.java:86)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.jruby.javasupport.JavaSupport.loadJavaClass(JavaSupport.java:136)
        at 
org.jruby.runtime.load.LoadService$ExtensionSearcher.trySearch(LoadService.java:619)
        at 
org.jruby.runtime.load.LoadService.findFileForLoad(LoadService.java:285)
        at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:332)
        at org.jruby.runtime.load.LoadService.require(LoadService.java:381)
        at 
org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:306)
        at org.jruby.RubyKernel.requireCommon(RubyKernel.java:1055)
        at org.jruby.RubyKernel.require(RubyKernel.java:1038)
        at 
org.jruby.RubyKernel$s$1$0$require.call(RubyKernel$s$1$0$require.gen:65535)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:319)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)
        at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
        at org.jruby.ast.RootNode.interpret(RootNode.java:129)
        at 
org.jruby.evaluator.ASTInterpreter.INTERPRET_EVAL(ASTInterpreter.java:96)
        at 
org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:161)
        at org.jruby.RubyKernel.evalCommon(RubyKernel.java:1135)
        at org.jruby.RubyKernel.eval(RubyKernel.java:1088)
        at org.jruby.RubyKernel$s$0$3$eval.call(RubyKernel$s$0$3$eval.gen:65535)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:227)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:223)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:352)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:237)
        at bug.__file__(bug.rb:1)
        at bug.load(bug.rb)
        at org.jruby.Ruby.runScript(Ruby.java:695)
        at org.jruby.Ruby.runScript(Ruby.java:688)
        at org.jruby.Ruby.runNormally(Ruby.java:595)
        at org.jruby.Ruby.runFromMain(Ruby.java:444)
        at org.jruby.Main.doRunFromMain(Main.java:321)
        at org.jruby.Main.internalRun(Main.java:241)
        at org.jruby.Main.run(Main.java:207)
        at org.jruby.Main.run(Main.java:191)
        at org.jruby.Main.main(Main.java:171)
LoadError: no such file to load -- /tmp/foo.class
  require at org/jruby/RubyKernel.java:1038
          at /tmp/foo.rb:1
     eval at org/jruby/RubyKernel.java:1088
   (root) at bug.rb:1
{code}

*Expected result:*

LoadError exception should not be raised, {{foo.class}} should be 
loaded/required.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.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


Reply via email to