Is there a limit to the complexity of the type that Lombok val should be inferred?

I have a data access object written using jOOQ and it returns a rather complex signature like:

Map<Record, Result<Record14<String, Integer, String, String, String, String, String, String, Integer, String, Boolean, Boolean, Integer, Boolean>>> result = create.... 

I tried replacing it with a val

 val result = create.... 

This works when I run / compile from Eclipse ... When I try to compile in 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 someone tell me why it will work in Gradle for simpler types, but not for more complex types? I have other places in the same project that look something like this:

 val records = dao.getDatastoreById(id); // Returns a type of List<Datastore> 

and they work perfectly, even if they are compiled using Gradle ... Am I missing something?

FYI: Lombok version = 1.14.8, Gradle version 2.2.1

I tried lombok == 1.14.6, Gradle version 2.2.0

I also tried using both Java 8 and Java 7, both OpenJDK and Oracle JDK

+6
source share
1 answer

The answer is the conflict between jOOQ DSL and lombok. In jQQ DSL, there is a "val" method that will cause a conflict when importing statically:

 import static org.jooq.impl.DSL.val; 

If you use this val method through static imports, it will violate the val val lombok implementation. Removing this static import and using "DSL.val ()" instead solved the problem for me.

Additional information is available at: https://code.google.com/p/projectlombok/issues/detail?id=762

+1
source

Source: https://habr.com/ru/post/979724/


All Articles