Open lombokissues opened 9 years ago
:bust_in_silhouette: deven.phillips :clock8: Dec 19, 2014 at 11:43 UTC
I have a Data Access Object written using jOOQ and it returns a rather complex type signature:
Map<Record, Result<Record14<String, Integer, String, String, String, String, String, String, Integer, String, Boolean, Boolean, Integer, Boolean>>> result = create.... I tried to replace with with Lombok's "val"
val result = create.... This works when I run/compile from Eclipse... When I try to compile within Gradle, I get:
UpdatesDAO.java:307: error: incompatible types
.fetchGroups(key);
^
required: val
found: Map<Record,Result<Record14<String,Integer,String,String,String,String,String,String,Integer,String,Boolean,Boolean,Integer,Boolean>>>
Can anyone tell me why it would work in Gradle for simpler types, but not for more complex types? I have other places in this same project which look something like:
val records = dao.getDatastoreById(id); // Returns a type of List<Datastore>
and they work just fine, even when compiled with Gradle... Am I missing something?
FYI: Lombok version = 1.14.8, Gradle version 2.2.1, Ubuntu 14.10
I have tried lombok==1.14.6, Gradle version 2.2.0
I have also tried with both Java 8 and Java 7, both OpenJDK and Oracle JDK
:bust_in_silhouette: reinierz :clock8: Jan 29, 2015 at 12:34 UTC
Add enough complexity and 'val' sometimes fails in javac. I thought we recently fixed this, but those fixed were in 1.14.8.
Without a self-contained source file that reproduces this problem I don't think we can feasibly pick this up right now.
:bust_in_silhouette: deven.phillips :clock8: Jan 29, 2015 at 14:38 UTC
I will try to put together an example project today and post a link here.
:bust_in_silhouette: deven.phillips :clock8: Jan 29, 2015 at 15:20 UTC
OK, I think I have found the root of the problem and it seems to be very simple now that I look at it...
jOOQ has a "DSL" class with a bunch of static methods. The idiomatic way to use these methods is to statically import them.. The problem is that there is a method in there called "val". When that method is statically imported, the lombok "val" stops working. Example code can be found at:
https://github.com/InfoSec812/LombokFailureExample
To compile and run simply execute:
./gradlew run
In the repository root directory.
The version on github currently works, but if you statically import the members of the "DSL" class and change the references of "DSL.val()" to just "val()", it will fail to compile.
:bust_in_silhouette: reinierz :clock8: Jan 31, 2015 at 03:59 UTC
How did you statically import val? With 'import static blahblah.val;' or with 'import static blahblah;'?
:bust_in_silhouette: deven.phillips :clock8: Jan 31, 2015 at 12:33 UTC
With:
import static org.jooq.impl.DSL.*;
And 'val' is a static method on the DSL class.
Deven Phillips from my mobile
:bust_in_silhouette: reinierz :clock8: Feb 08, 2015 at 20:57 UTC
I assume this will fail with javac too, which means the first step is to reproduce this, but it sounds like something we can fix. Accepted.
:bust_in_silhouette: deven.phillips :clock8: Feb 08, 2015 at 21:16 UTC
The GitHub project linked above will reproduce the error reliably.
End of migration
Migrated from Google Code (issue 762)