Skip to content

GROOVY-8252: AIOOBE in combination of ncurry and rcurry#612

Closed
paulk-asert wants to merge 1 commit intoapache:masterfrom
paulk-asert:groovy8252
Closed

GROOVY-8252: AIOOBE in combination of ncurry and rcurry#612
paulk-asert wants to merge 1 commit intoapache:masterfrom
paulk-asert:groovy8252

Conversation

@paulk-asert
Copy link
Copy Markdown
Contributor

@paulk-asert paulk-asert commented Oct 2, 2017

Because of the way method selection works with overloaded methods, the position of params when applying rcurry is calculated lazily. E.g. for a method closure for the foo method, if there are two foo variants foo(String, String) and foo(String, String, String), then right currying a single string parameter and supplying a single string argument will result in the foo(String, String) method being called but supplying two string arguments will call the 3 param variant to be called.

It doesn't make sense to do this for ncurry since a specific index is being supplied. I have clarified the documentation and implementation to capture those aspects of the current design and introduced some checking to avoid the AIOOBE when using ncurry when those assumptions are violated and instead throw an IllegalArgumentException.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant