#1389 new
ronin-37773 (at lighthouseapp)

jruby --1.9 const_defined? wrong # of arguments(2 for 1)

Reported by ronin-37773 (at lighthouseapp) | August 18th, 2010 @ 10:44 AM

I think this might be a jruby issue, but im not sure, so i post this here (and over at jruby soon):

jruby -e "require 'rubygems'; require 'dm-core';class X; include DataMapper::Resource;property :id, Serial;end"

=> No errors

jruby --1.9 -e "require 'rubygems'; require 'dm-core';class X; include DataMapper::Resource;property :id, Serial;end"

=> ArgumentError

/opt/jruby-1.5.0/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/core_ext/module.rb:33:in 'const_defined?': wrong # of arguments(2 for 1) (ArgumentError)
    from /opt/jruby-1.5.0/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/core_ext/module.rb:33:in 'nested_const_lookup'
    from /opt/jruby-1.5.0/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/core_ext/module.rb:31:in 'all?'
    from /opt/jruby-1.5.0/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/core_ext/module.rb:31:in 'nested_const_lookup'
    from /opt/jruby-1.5.0/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/core_ext/module.rb:29:in 'reverse_each'
    from /opt/jruby-1.5.0/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/core_ext/module.rb:29:in 'nested_const_lookup'
    from /opt/jruby-1.5.0/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/core_ext/module.rb:9:in 'find_const'
    from /opt/jruby-1.5.0/lib/ruby/gems/1.8/gems/dm-core-1.0.0/lib/dm-core/model/property.rb:68:in 'property'
    from -e:1

The problem seems to be, that it is assumed that when RUBY_VERSION >= '1.9.0' then const_defined? can take two parameters. But in jruby --1.9 this seems not to be the case.

Origin (dm-core/core-ext/module.rb):

  return const if parts.all? do |part|
    const = if RUBY_VERSION >= '1.9.0'
      const.const_defined?(part, false) ? const.const_get(part, false) : nil
    else
      const.const_defined?(part) ? const.const_get(part) : nil
    end
  end

JRuby/Gem - Versions:

  • jruby: jruby 1.5.0 (ruby 1.8.7 patchlevel 249) (2010-05-12 6769999) (OpenJDK 64-Bit Server VM 1.6.0_18) [amd64-java]
  • dm-core: v1.0.0 - installed via: jruby --1.9 -S gem install dm-core

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages