Skip to content

Doing require_relative too often leads to TypeError #4482

@janlelis

Description

@janlelis

Environment

  • ruby -v jruby 9.1.8.0-SNAPSHOT (2.3.1) 2017-02-06 3f97c7a Java HotSpot(TM) 64-Bit Server VM 25.111-b14 on 1.8.0_111-b14 +indy +jit [linux-x86_64]
  • uname -a Linux ok 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Setup

Empty file: a.rb

Contents of b.rb, in the same directory:

400.times{
  require_relative 'a'
}

Expected Behavior

  • Should print nothing

Actual Behavior

  • Throws following error:
TypeError: no implicit conversion of nil into String
          realpath at org/jruby/RubyFile.java:862
  require_relative at uri:classloader:/jruby/kernel/kernel.rb:11
  require_relative at uri:classloader:/jruby/kernel/kernel.rb:-1
     block in b.rb at b.rb:2
             times at org/jruby/RubyFixnum.java:299
            <main> at b.rb:1

Works find for a smaller iteration count, for example, 4.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions