lishunli / projectlombok

Automatically exported from code.google.com/p/projectlombok
0 stars 0 forks source link

@Delegate does not handle variable arguments in method signatures #549

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Declare a method with variable arguments in an interface
2. Annotate an delegate object
3. Attempt to invoke the variable-argument method
4. The compiler will complain about expecting an array when the array should 
accept variable arguments.

What is the expected output? What do you see instead?
The method should work as defined by the delegate.  The generated method does 
is not variable, but should be.

Hypothetical example:

public class Main {
  public interface Foo {
    void bar(Object... baz);
  }

  public static class Qux implements Foo {
    @Override
    public void bar(final Object... baz) {}
  }

  @Delegate(types=Foo.class)
  private final Foo foo = new Qux();

  public static void main(final String[] args) {
    new Main().bar("quo");
    // error: method bar in class Main cannot be applied to given types;
    // bar("quo");
    // required: Object[]
    // found: String
    // reason: actual and formal argument lists differ in length
  }
}

What version of the product are you using? On what operating system?
0.11.8, Rhel 5, 64-bit

Original issue reported on code.google.com by integ...@gmail.com on 23 Jul 2013 at 6:29

GoogleCodeExporter commented 9 years ago
Lombok 1.12.6 update:

This is only an issue when building with javac. Eclipse builds it ok.

Original comment by aleksei....@gmail.com on 10 Mar 2014 at 3:42