# http://jira.codehaus.org/browse/JRUBY-2457 Not Resolved?

**URL:** <https://www.ruby-forum.com/t/http-jira-codehaus-org-browse-jruby-2457-not-resolved/222244>\
**Category:** JRuby\
**Created:** [August 19, 2012, 12:53am UTC](https://www.ruby-forum.com/t/http-jira-codehaus-org-browse-jruby-2457-not-resolved/222244 "2012-08-19T00:53:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 19, 2012, 12:53am UTC](https://www.ruby-forum.com/t/http-jira-codehaus-org-browse-jruby-2457-not-resolved/222244/1 "2012-08-19T00:53:45Z")

</div>

All -

A few years ago I reported an issue, which eventually became bug #2457  
(Instantiation of Ruby subclass of Java class does incorrect constructor  
argument check, [http://jira.codehaus.org/browse/JRUBY-2457](http://jira.codehaus.org/browse/JRUBY-2457)).

It was marked resolved, but I’m still having the same problem. I’m using  
JRuby 1.6.7.2, but I don’t think it’s version-specific.

I’ve posted a gist illustrating it:

> <https://gist.github.com/keithrbennett/3390231>

Charlie, I think your comment of 8/25/08 indicates that it isn’t  
possible to have different constructor arities, doesn’t it?

Thanks,  
Keith

---

<div class="post-metadata">

**Author:** ![islepilot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ac8455/32.png) [@islepilot](https://www.ruby-forum.com/u/islepilot)\
**Post date:** [August 27, 2012, 2:00pm UTC](https://www.ruby-forum.com/t/http-jira-codehaus-org-browse-jruby-2457-not-resolved/222244/2 "2012-08-27T14:00:43Z")

</div>

All -

I was wrong about this – this is not an error, and the gist I provided  
was not relevant, as it illustrated the implementation of an interface  
and not a subclass. Sorry about that.

I did actually have a problem subclassing a Java class with no  
arguments, but it was due to my misunderstanding. What confused me was  
that I thought it was always true that a function call with no arguments  
never needs parentheses; that is, that “foo” and “foo()” were  
interchangeable. This is not true with super, since without the parens  
it will assume that it’s passing the same arguments that were passed to  
it (I think…is this correct?). It didn’t occur to me until much  
later (um, today) to try super(). So super is a special case.

The example below illustrates it.

* * *

require ‘java’

java\_import ‘javax.swing.JLabel’

class RubyLabel \< JLabel  
def initialize(a,b,c,d,e,f)

# super # doesn’t work; passes all arguments

# super() # does work; passes no arguments

# super(‘text’) # does work; one of superclass JLabel’s ctor’s takes

a string arg

# # omitting super behaves as if it were called without

parens  
end  
end

## RubyLabel.new(1,2,3,4,5,6)

- Keith

---

<div class="post-metadata">

**Author:** ![islepilot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ac8455/32.png) [@islepilot](https://www.ruby-forum.com/u/islepilot)\
**Post date:** [August 27, 2012, 2:04pm UTC](https://www.ruby-forum.com/t/http-jira-codehaus-org-browse-jruby-2457-not-resolved/222244/3 "2012-08-27T14:04:32Z")

</div>

Yeah I think super without args (known as zsuper) is a horrific  
feature of Ruby because every single programmer who first encounters  
zsuper gets confused by the magicness of it. Once you hit it once you  
never forget it though 🙂

-Tom

On Thu, Aug 23, 2012 at 10:15 PM, Keith B.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> not true with super, since without the parens it will assume that it’s
> 
> All -  
> [Illustrates problem instantiating Ruby subclass of Java class w/different constructor arities. · GitHub](https://gist.github.com/3390231)
> 
> Charlie, I think your comment of 8/25/08 indicates that it isn’t possible to  
> have different constructor arities, doesn’t it?
> 
> Thanks,  
> Keith

–  
blog: [http://blog.enebo.com](http://blog.enebo.com) twitter: tom\_enebo  
mail: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
