Closed SethTisue closed 1 month ago
The linked source is ordinary sbt build, in a Java package, with a correct import. That works in a trivial sbt project.
The linked source is ordinary sbt build, in a Java package, with a correct import. That works in a trivial sbt project.
I successfully reproduced the problem in sbt first before switching to scala-cli. Note that you do have to have both Scala and Java sources.
No doubt it's one of those things.
➜ i20026-annot git:(master) cat src/main/scala/main.scala
class C {
}
➜ i20026-annot git:(master) cat ./src/main/java/trial/J.java
package trial;
import org.junit.jupiter.api.TestInstance;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class J { }
➜ i20026-annot git:(master) cat build.sbt
scalaVersion := "3.4.0"
ThisBuild / scalacOptions ++= Seq(
//"-Vprint:all",
)
ThisBuild / libraryDependencies ++= Seq(
"org.junit.jupiter" % "junit-jupiter-api" % "5.10.2"
)
➜ i20026-annot git:(master) sbt compile
[info] welcome to sbt 1.9.9 (Eclipse Adoptium Java 21.0.2)
[info] loading project definition from .../i20026-annot/project
[info] loading settings for project i20026-annot from build.sbt ...
[info] set current project to i20026-annot
[info] Executing in batch mode. For better performance use sbt's shell
[info] compiling 1 Scala source and 1 Java source to .../i20026-annot/target/scala-3.4.0/classes ...
[success] Total time: 3 s, completed Mar 26, 2024, 12:41:13 PM
The plot thickens! The difference between your version and mine is the presence or absence of package trial;
.
Which is peculiar, since naturally the original alpakka-kafka code does have a package declaration! So this seems to be rather fragile/subtle...
@som-snytt when you were looking into this (thank you!), did you discover whether there's a workaround?
This came up at Lightbend over at https://github.com/akka/alpakka-kafka/pull/1727
Next, I will see if I can construct a reproducer that doesn't involve an external library.