New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-intuitive overloaded varargs matching #3279

Closed
kares opened this Issue Aug 24, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@kares
Member

kares commented Aug 24, 2015

assuming 2 methods (Object... args) and (String a, Object... args)

a call('str') won't match (String a, Object... args) but simply uses the generic one

@kares

This comment has been minimized.

Show comment
Hide comment
@kares

kares Aug 24, 2015

Member

... not sure if it's a good idea to fix these on JRuby 1.7.x (assuming not due compatibility) ?

Member

kares commented Aug 24, 2015

... not sure if it's a good idea to fix these on JRuby 1.7.x (assuming not due compatibility) ?

@kares kares closed this Aug 24, 2015

@kares kares reopened this Aug 24, 2015

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Sep 4, 2015

Member

I'd guess that call('str'.to_java) invokes the right one, but I agree we could do a better job when we know we're turning an argument into a java.lang.String or other basic type.

Member

headius commented Sep 4, 2015

I'd guess that call('str'.to_java) invokes the right one, but I agree we could do a better job when we know we're turning an argument into a java.lang.String or other basic type.

@kares kares self-assigned this Sep 14, 2015

@kares

This comment has been minimized.

Show comment
Hide comment
@kares

kares Sep 15, 2015

Member

it's not an issue with type matching (call('str'.to_java) does not invoke the right one) but of a varargs processing as it's only considered a suitable match for arities where the var-arg parameter receives an arg...

Member

kares commented Sep 15, 2015

it's not an issue with type matching (call('str'.to_java) does not invoke the right one) but of a varargs processing as it's only considered a suitable match for arities where the var-arg parameter receives an arg...

@kares kares added this to the JRuby 9.0.2.0 milestone Sep 15, 2015

kares added a commit to kares/jruby that referenced this issue Sep 15, 2015

[ji] var-args Java method is a valid match even if the last parameter…
… receives no arg

`method(String, Object...)` will now be considered with a `method('foo')` call

fixes #3279

@kares kares closed this in e85df14 Sep 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment