简体   繁体   English

jOOQ with java 15:org.jooq 中的接口 org.jooq.Record 和 java.lang 中的类 java.lang.Record 匹配

[英]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 已经说过的

Import-on-demand no longer works for 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 中,您可以使用“组织导入”功能将所有按需导入语句扩展为显式导入,具体取决于您实际使用的类型。

Using type inference使用类型推断

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.Recordrecord的超类,它与org.jooq.Record冲突,因为java.lang每个类型都是自动导入的。 There are two solutions:有两种解决方案:

  1. Use a fully qualified name instead of 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语句)。
  2. Redeclare the 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.

相关问题 java.lang.ClassNotFoundException: org.jooq.util.JavaGenerator - java.lang.ClassNotFoundException: org.jooq.util.JavaGenerator Cannot insert json value with jooq-vertx-classic-reactive: org.jooq.JSON can not be coerced to the expected class java.lang.Object - Cannot insert json value with jooq-vertx-classic-reactive: org.jooq.JSON can not be coerced to the expected class java.lang.Object linux上的JOOQ代码生成失败,java.lang.ClassNotFoundException:org.postgresql.Driver - JOOQ codegen failure on linux, java.lang.ClassNotFoundException: org.postgresql.Driver java.lang.ClassNotFoundException: org.postgresql.Driver 来自 jooq 代码生成任务 - java.lang.ClassNotFoundException: org.postgresql.Driver from jooq code generating task 使用JOOQ的java.lang.NoSuchMethodError - java.lang.NoSuchMethodError using JOOQ Jooq(java)-方言DEFAULT不支持类型类org.jooq.impl.UnqualifiedName - Jooq (java) - Type class org.jooq.impl.UnqualifiedName is not supported in dialect DEFAULT 如何将 JSON (org.jooq.JSON) 转换为 Java Object (POJO) - How to convert JSON (org.jooq.JSON) to Java Object (POJO) 尝试更新到“org.jooq:jooq-codegen-maven:3.15.1”时构建失败 - Build failure while trying to update to “org.jooq:jooq-codegen-maven:3.15.1” 尝试使用POJO记录更新表时出现Java jOOQ问题 - Java jOOQ issue when trying to update a table using a POJO Record org.jooq.exception.SQLDialectNotSupportedException:方言DEFAULT不支持类型类java.net.Inet6Address - org.jooq.exception.SQLDialectNotSupportedException: Type class java.net.Inet6Address is not supported in dialect DEFAULT
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM