[英]jOOQ with java 15: both interface org.jooq.Record in org.jooq and class java.lang.Record in java.lang match
I've just tried upgrading my project to Java 15, and now I get the following error:我刚刚尝试将我的项目升级到 Java 15,现在出现以下错误:
both interface org.jooq.Record in org.jooq and class java.lang.Record in java.lang match
Does anybody have some experience resolving this issue?有没有人有解决这个问题的经验?
In addition to what Aniket already said :除了Aniket 已经说过的:
Record
按需导入不再适用于Record
The recommendation is to add an explicit import to your import-on-demand statement:建议在您的按需导入语句中添加显式导入:
import org.jooq.*;
import org.jooq.Record;
Or to stop using import-on-demand entirely.或者完全停止使用按需导入。 Eg in Eclipse, you can use the "Organize Imports" feature to expand all your import-on-demand statements to explicit imports, depending on the types you're actually using.例如,在 Eclipse 中,您可以使用“组织导入”功能将所有按需导入语句扩展为显式导入,具体取决于您实际使用的类型。
Another way to prevent this problem if it happens with local variables is to use var
:如果局部变量发生此问题,另一种防止此问题的方法是使用var
:
var record = ctx.fetchOne(TABLE, TABLE.ID.eq(1));
Now you don't have to import the type.现在您不必导入类型。 This doesn't work with member types, method parameter and return types, of course.当然,这不适用于成员类型、方法参数和返回类型。
We'll try to better document this: https://github.com/jOOQ/jOOQ/issues/10646我们将尝试更好地记录这一点: https : //github.com/jOOQ/jOOQ/issues/10646
Java 14 introduced records . Java 14 引入了记录。 java.lang.Record
is a superclass of record
which is conflicting with org.jooq.Record
since every type in java.lang
is auto imported. java.lang.Record
是record
的超类,它与org.jooq.Record
冲突,因为java.lang
每个类型都是自动导入的。 There are two solutions:有两种解决方案:
Record
and remove the import.使用完全限定名称而不是Record
并删除导入。 Eg: org.jooq.Record
instead of Record
.例如: org.jooq.Record
而不是Record
。 (Don't forget to remove the import
statement). (不要忘记删除import
语句)。org.jooq.Record
to something specific.将org.jooq.Record
重新org.jooq.Record
为特定的内容。 (Which I believe is not possible in your case as it's a third-party library.) (我认为在您的情况下这是不可能的,因为它是第三方库。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.