Super in module causes NPE
--------------------------

                 Key: JRUBY-2327
                 URL: http://jira.codehaus.org/browse/JRUBY-2327
             Project: JRuby
          Issue Type: Bug
            Reporter: Ola Bini
            Assignee: Thomas E Enebo


This code:

{noformat}
module Kernel
  def require(name)
    super(name)
  end
end

require 'something'
{noformat}

Will blow up with a lovely NPE:

{noformat}
Exception in thread "main" java.lang.NullPointerException
        at 
org.jruby.javasupport.util.RuntimeHelpers.invokeAs(RuntimeHelpers.java:322)
        at org.jruby.RubyObject.callSuper(RubyObject.java:464)
        at 
org.jruby.evaluator.ASTInterpreter.superNode(ASTInterpreter.java:1669)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:468)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:78)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:147)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:307)
        at ruby.Users.olabini.workspace.reproduce.foo1.__file__(foo1.rb:14)
        at ruby.Users.olabini.workspace.reproduce.foo1.load(foo1.rb)
        at org.jruby.Ruby.runScript(Ruby.java:511)
        at org.jruby.Ruby.runNormally(Ruby.java:431)
        at org.jruby.Ruby.runFromMain(Ruby.java:311)
        at org.jruby.Main.run(Main.java:141)
        at org.jruby.Main.run(Main.java:88)
        at org.jruby.Main.main(Main.java:79)
{noformat}

Of course, it's not valid code, but NPE's are ugly.

-- 
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


Reply via email to