Parameterized static methods with @Builder fail to compile in javac (8u25) if builderMethodName is set. Works fine in Eclipse. #828

Closed
lombokissues opened this Issue Jul 14, 2015 · 6 comments

Projects

None yet

1 participant

@lombokissues
Collaborator

Migrated from Google Code (issue 793)

@lombokissues
Collaborator

👤 jeff.maxwell   🕗 Feb 27, 2015 at 14:18 UTC

Parametrized methods with @ Buiilder fail to compile in javac if builderMethodName is set. Eclipse is fine.

/**
* Without builder method name.
*
* Compiles and runs in eclipse and javac
*
* @ param <COMPARABLE> the generic type
* @ param comparableSet the comparable set
* @ return the list
*/
@ Builder(builderClassName = "FirstListOfSortedSetsBuilder")
static <COMPARABLE extends Comparable<?>> List<SortedSet<COMPARABLE>> withoutBuilderMethodName(
SortedSet<COMPARABLE> sortedSet) {
return ImmutableList.of(sortedSet);
}

/**
 * With builder method name.
 * Compiles and runs in eclipse.
 *
 * DOES NOT COMPILE IN JAVAC:
 * error: incompatible types: List&lt;SortedSet&lt;COMPARABLE﹟1&gt;&gt; cannot be converted to  List&lt;SortedSet&lt;COMPARABLE﹟2&gt;&gt;
 *
 * @ param &lt;COMPARABLE&gt; the generic type
 * @ param comparableSet the comparable set
 * @ return the list
 */
@ Builder(builderClassName = &quot;SecondListOfSortedSetsBuilder&quot;, builderMethodName = &quot;newListOfSortedSetsBuilder&quot;)
static &lt;COMPARABLE extends Comparable&lt;?&gt;&gt; List&lt;SortedSet&lt;COMPARABLE&gt;&gt; withBuilderMethodName(
        SortedSet&lt;COMPARABLE&gt; sortedSet) {
    return ImmutableList.of(sortedSet);
}

Java 8u25
Lombok 1.16.2

@lombokissues
Collaborator

👤 jeff.maxwell   🕗 Feb 27, 2015 at 15:18 UTC

Correction it fails regardless of the builderMethodName

@lombokissues
Collaborator

👤 jeff.maxwell   🕗 Feb 27, 2015 at 15:46 UTC

It also fails on ctors.

@lombokissues
Collaborator

👤 reinierz   🕗 May 15, 2015 at 10:14 UTC

Well spotted, and thanks a lot for your in-depth test case on the forums.

The bug has been fixed and will be in the next release.

@lombokissues
Collaborator

👤 jeff.maxwell   🕗 May 15, 2015 at 12:42 UTC

No problem. Sorry for my horrible spelling!

@lombokissues
Collaborator

End of migration

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