-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"error overriding method" error when compiling JOOQ generated model #16844
Comments
Is the problem reproducible without involving an external dependency? |
I tried to reproduce it by building similar hierarchy and overrides in Scala, unsuccessfully. Seems to be Java-related. |
The compiler does need to treat Java-defined things specially in some respects, so it's a possible a minimal reproducer would need to include a Java source file as well as a Scala one. |
Perhaps this is a |
Nope.
|
Scala 2.13.10 gives a very similar looking error on the same code
I don't think you've made a case that there is a Scala bug here. (Perhaps there is? It remains to be seen.) Do you definitely believe there is a Scala bug here, and you believe you can substantiate that? Or did you just get an error message you don't really understand and you came to the bug tracker hoping for help...? |
self-contained (except for the external dependency) reproducer using scala-cli: //> using scala "2.13.10"
//> using lib "org.jooq:jooq-scala_2.13:3.17.8"
import org.jooq.Record6
import org.jooq.impl.UpdatableRecordImpl
class ChatRecord extends UpdatableRecordImpl[ChatRecord](null)
with Record6[Long, Long, Long, Boolean, Long, Long] {} |
Well, real JOOQ generated code compiles well on 2.x (including 2.13). Looking at the message, there is a problem in how scalac typechecks compiled Java bytecode. I believe java bytecode is correct since JOOQ is a popular project having 5.3k stars on github. Since they do not support scala3 directly yet jOOQ/jOOQ#12180 AND generated code needs some fixes before getting stuck on that error I think I'd give up on integrating JOOQ in scala3 project for now. Attached is sbt project which compiles on 2.3.10 but fails on 3.2.2 |
Okay. I'm closing this ticket, then, since we don't have solid evidence here that there is a bug in Scala 3. (We do have some circumstantial evidence that there could be...) Perhaps someone else trying to make JOOQ work with Scala 3 will find this ticket and have additional insight or volunteer to find a self-contained reproducer and/or attempt to characterize the specific nature of the possible bug. |
@SethTisue I just ran into this issue. Here is a reproduction with no external dependencies: https://github.com/tpunder/scala3_jooq_bug_overriding It works fine with Scala 2.12 and 2.13 but fails with Scala 3. The only Scala source file is: package com.example
import org.jooq.Record
import org.jooq.impl.TableRecordImpl
// Works in Scala 2.12 and Scala 2.13 but is broken in Scala 3
class ExampleRecordScala extends TableRecordImpl[ExampleRecordScala] with Record {
} The equivalent Java version works fine: package com.example;
import org.jooq.Record;
import org.jooq.impl.TableRecordImpl;
// This works fine
class ExampleRecordJava extends TableRecordImpl<ExampleRecordJava> implements Record {
} |
Can this bug be re-opened? Or should I create a new bug? |
I've slightly simplified the Scala example in https://github.com/tpunder/scala3_jooq_bug_overriding to remove the package com.example
import org.jooq.impl.AbstractRoutine
// Works in Scala 2.12 and 2.13 but is broken in Scala 3
class MyRoutineScala extends AbstractRoutine[String] {
} Also, here is the -explain output for Scala 3:
|
Compiler version
3.2.0+
before 3.2.0 - fails with "bad constant pool", fixed in 3.2.0
Minimized code
Scastie link: https://scastie.scala-lang.org/3ioAIaRaQJ282KS69KugxA
Output
Expectation
Successful compilation
The text was updated successfully, but these errors were encountered: