@Delegate doesn't work well with varargs #932

Open
afillatre opened this Issue Sep 28, 2015 · 1 comment

Projects

None yet

2 participants

@afillatre

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
Collaborator

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment