Unable to call varargs constructor with 0 arguments.
----------------------------------------------------
Key: JRUBY-5980
URL: https://jira.codehaus.org/browse/JRUBY-5980
Project: JRuby
Issue Type: Bug
Components: Java Integration
Affects Versions: JRuby 1.6.3
Reporter: Darrick Wiebe
I need to instantiate a class that only has a varargs constructor. It works
only if I pass at least one argument but I also need to be able to instantiate
it with no arguments.
{code:ruby}
com.tinkerpop.pipes.transform.OutPipe.new 'a', 'b'
#=> #<Java::ComTinkerpopPipesTransform::OutPipe:0x33d6798>
com.tinkerpop.pipes.transform.OutPipe.new 'a'
#=> #<Java::ComTinkerpopPipesTransform::OutPipe:0x777dc5cf>
com.tinkerpop.pipes.transform.OutPipe.new
# ArgumentError: wrong number of arguments (0 for 1)
# from (irb):6:in `evaluate'
# from org/jruby/RubyKernel.java:1088:in `eval'
# from /Users/dw/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:158:in
`eval_input'
# from /Users/dw/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:271:in
`signal_status'
# from /Users/dw/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:155:in
`eval_input'
# from org/jruby/RubyKernel.java:1419:in `loop'
# from org/jruby/RubyKernel.java:1191:in `catch'
# from /Users/dw/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:154:in
`eval_input'
# from /Users/dw/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:71:in `start'
# from org/jruby/RubyKernel.java:1191:in `catch'
# from /Users/dw/.rvm/rubies/jruby-1.6.3/lib/ruby/1.8/irb.rb:70:in `start'
# from /Users/dw/.rvm/rubies/jruby-1.6.3/bin/jirb:17:in `(root)'
{code}
For the definition of the class that I am calling, please see:
[https://github.com/tinkerpop/pipes/blob/master/src/main/java/com/tinkerpop/pipes/transform/OutPipe.java]
I have tested this in JRuby 1.6.3 in both --1.9 and --1.8 modes.
I suspect that this may be specific to String... varargs constructors but have
not tested thoroughly.
If you have a workaround that I can use, I'd appreciate it.
Cheers!
Darrick
--
This message is automatically generated by JIRA.
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