Issue
After upgrading to the commercial 3.16.8 version of jOOQ (org.jooq.pro-java-8) my maven compile stage start to fail. Same result is noticeable when upgrading to java-11.
What I found out is that the new version does not work with the following structure.
Select sql = ....;
List<CustomTypeClass> result = sql.fetch(this::recordToCustomTypeClass);
where recordToCustomTypeClass is a function that takes Record and transform it to a CustomTypeClass.
Does anyone knows why this is no longer applicable?
The error with java 8 is general java error, with java 11 we have more direct message.
JAVA 8:
java: An exception has occurred in the compiler (1.8.0_251). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you. java: java.lang.AssertionError4
JAVA 11: functional interface not applicable
Solution
You seem to be using raw types with the jOOQ API (i.e. Select
rather than Select<?>
, or some explicit type bound). This is rarely a good idea both with jOOQ or with Java in general. In the case of jOOQ, the API explicitly excludes maintaining raw type backwards compatibility, which would be exceptionally hard to achieve, see e.g.:
- https://www.jooq.org/doc/latest/manual/getting-started/semantic-versioning/ (look for "raw type")
- https://github.com/jOOQ/jOOQ/issues/11879
You should be able to fix this issue by avoiding raw types.
Answered By - Lukas Eder
Answer Checked By - Robin (JavaFixing Admin)