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

@Delegate doesn't work well with varargs #932

Open
afillatre opened this Issue Sep 28, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@afillatre

afillatre commented Sep 28, 2015

Lombok 1.16.6

When @DeleGate is used to delegate methods with Varargs params, the parameter is changed into an array:

public void myMethod(String param1, Object... otherParams) {
    // Code
}

is changed into

public void myMethod(String param1, Object[] otherParams) {
    this.delegate.myMethod(param1, otherParams)
}

This results in the following code not compiling:

myObject.myMethod("Test", "myParam");

Error message will be something like

Error:(XX) java: no suitable method found for myMethod(java.lang.String,java.lang.String)
    method MyObject.myMethod(java.lang.String,java.lang.Object[]) is not applicable
        (argument mismatch; java.lang.String cannot be converted to java.lang.Object[]))
@rspilker

This comment has been minimized.

Show comment
Hide comment
@rspilker

rspilker Dec 18, 2015

Collaborator

Will be in 1.16.8

Collaborator

rspilker commented Dec 18, 2015

Will be in 1.16.8

@rspilker rspilker changed the title from @Delegate doesn't work well with varargs to `@Delegate` doesn't work well with varargs Feb 3, 2016

@rspilker rspilker changed the title from `@Delegate` doesn't work well with varargs to @Delegate doesn't work well with varargs Feb 3, 2016

@kossmoboleat

This comment has been minimized.

Show comment
Hide comment
@kossmoboleat

kossmoboleat Sep 2, 2018

I could reproduce that this works fine with 1.16.22, a delegate method with varargs parameter is generated. @rzwitserloot: this issue can be closed.

kossmoboleat commented Sep 2, 2018

I could reproduce that this works fine with 1.16.22, a delegate method with varargs parameter is generated. @rzwitserloot: this issue can be closed.

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