Closed vasilmkd closed 1 year ago
A more complete repro would be helpful to me. At least a link to the java source? Maybe a simple enum suffices? or maybe not? Let me remember how to write an enum in Java, etc.
It is necessary for this enum to be published in a library
Perhaps it would be sufficient to use CompileOrder.JavaThenScala
instead of CompileOrder.Mixed
?
@som-snytt https://github.com/scala/scala/pull/10105 seems like an obvious place to look? any other ideas of what PR might be involved?
Sorry, here's the source of the enum https://github.com/JetBrains/intellij-community/blob/master/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerMessageCategory.java.
@SethTisue yes with sinking heart that was also my first thought.
@vasilmkd thanks, I couldn't find it right away on github, and this is after my second coffee.
I see it's an "interesting" enum. So much to explore today, I hardly miss being at Scala Days. 😿
I confirm, this is compiled using JDK 17, I haven't tried changing the JDK yet.
CompilerMessageCategory
is not a "simple" Java enum, it defines an abstract method and then each enum case implements it.
A "simple" Java enum is for example com.intellij.compiler.ModuleSourceSet
. Testing the same code by matching on that enum compiles just fine. I have pushed a new commit to the reproduction repo with this enum.
I tried using JDK 11 and JDK 8, same result, the warning/error is reproducible as in JDK 17.
@SethTisue You're right! Copying the enum source code to a Java file, then using compileOrder := CompileOrder.JavaThenScala
does manage to reproduce the exhaustivity warning. I'm pushing a commit to the reproduction repo with that change, the library dependency is no longer necessary.
Reproduction steps
https://github.com/vasilmkd/scala-java-enum-regression
Scala version: 2.13.11
Problem (
-Werror
flag is on)Further context
.java
file and compiled usingsbt
. It is necessary for this enum to be published in a library. (Might be a problem with classfile decompilation?)