我正在尝试在Scala 3代码库中使用jOOQ作为依赖项:
libraryDependencies ++= Seq("org.jooq" % "jooq" % "3.16.6")
然而,当我尝试从这个库中导入时——比如import org.jooq.DSLContext
——我得到一个编译错误。
最简单的复制方法是使用菊石:
cs launch ammonite --scala 3.1.3
Loading...
Welcome to the Ammonite Repl 2.5.4-11-4f5bf2aa (Scala 3.1.3 Java 11.0.15)
@ import $ivy.`org.jooq:jooq:3.16.6`, org.jooq.DSLContext
Bad symbolic reference. A signature
refers to ApiStatus/T in package org.jetbrains.annotations which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling the signature.
Caught: java.lang.AssertionError: assertion failed: failure to resolve inner class:
externalName = org.jetbrains.annotations.ApiStatus$Experimental,
outerName = org.jetbrains.annotations.ApiStatus,
innerName = Experimental
owner.fullName = org.jetbrains.annotations.ApiStatus
while parsing /Users/horta/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/jooq/jooq/3.16.6/jooq-3.16.6.jar(org/jooq/Named.class) while parsing annotations in /Users/horta/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/jooq/jooq/3.16.6/jooq-3.16.6.jar(org/jooq/Named.class)
Caught: java.lang.RuntimeException: bad constant pool index: 0 at pos: 740 while parsing annotations in /Users/horta/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/jooq/jooq/3.16.6/jooq-3.16.6.jar(org/jooq/Named.class)
...
这不是完整的错误,它在一堆不同的类上给出了相同类型的错误,总是与这个注释org.jetbrains.annotations.ApiStatus.Experimental
相关。
我使用Java 11和18 (openjdk),使用SBT和菊石,以及所有版本的Scala 3复制了这个。使用Scala 2.13时。*一切正常,我们在生产中使用它。
你知道这是怎么回事吗?有没有潜在的线索或者变通办法?
在3.2.0-RC1
版本的Scala 3中修复。
参见r/scala中的reddit帖子。