Skip to content

not found: type Serializable after Scala 2.13.6 upgrade up to 2.13.7+ #12740

Closed
scala/scala
#10333
@pomadchin

Description

@pomadchin

Reproduction steps

I was unable to get a locally reproducible / relatively easy project that fails. I could not reproduce it locally at all. 😭 Thx team with all the help to reproduce it!

Scala version: 2.13.7+
SBT and JDK versions independent.

Code:

package test

package object X extends Serializable { }

object Test {
  def main(args: Array[String]): Unit = {
    
  }

}

Scasite: https://scastie.scala-lang.org/pomadchin/X8YFi5YuT9yUNTp1fpmNEA/1

Publish: $ ./sbt +publishLocal

Steps to try to reproduce locally with the https://github.com/PDAL/java project

$ git clone git@github.com:PDAL/java.git pdal-java
$ git checkout -f bug/scala-upd
$ cd pdal-java
$ docker run --rm -it -v $PWD:/pdal daunnc/pdal-ubuntu:2.5.1 bash
$ cd /pdal
$ ./sbt ++2.13 core-scala/publishLocal

I know that it makes this bug / feature report very hard to work with, but mb there is any chance to get some help tracing it?
Any help / comments are really appreciated.

I spent a the whole weekend trying to catch it and was only able ("got lucky") to catch it in a smaller OSS project and reduce failure await times in CI.

Problem

In several projects (https://github.com/PDAL/java, https://github.com/locationtech/geotrellis/) after updating Scala 2.13.6 up to 2.13.7+ I get not found: type Serializable error on the package +publish command invocation, more specifically, on the Compile/doc stage.

The most unclear thing is that it may fail within some specific modules of a project, not in every module of a project, I was unable to catch the real issue / to find a simple reproducible way to catch it.

By experiments, I was able to double check that this behavior is not related to the SBT version and to the JDK version.

Code: https://github.com/PDAL/java/blob/bug/scala-upd/core-scala/src/main/scala/io/pdal/pipeline/package.scala#L19
Diff that triggers the CI error: PDAL/java@f068ac2
CI Error: https://github.com/PDAL/java/actions/runs/4277401013/jobs/7446185708#step:6:201

[error] /__w/java/java/core-scala/src/main/scala/io/pdal/pipeline/package.scala:19:75: not found: type Serializable
[error] package object pipeline extends json.Implicits with syntax.Implicits with Serializable
[error]                                                                           ^
[error] one error found
...
[error] Scaladoc generation failed
[error] 	at xsbt.Runner.run(ScaladocBridge.scala:50)
[error] 	at xsbt.ScaladocBridge.run(ScaladocBridge.scala:21)
[error] 	at sbt.internal.inc.AnalyzingCompiler.doc(AnalyzingCompiler.scala:154)
[error] 	at sbt.internal.inc.AnalyzingCompiler.doc(AnalyzingCompiler.scala:133)
[error] 	at sbt.Doc$.$anonfun$scaladoc$1(Doc.scala:52)
[error] 	at sbt.Doc$.$anonfun$scaladoc$1$adapted(Doc.scala:40)
[error] 	at sbt.RawCompileLike$.$anonfun$prepare$1(RawCompileLike.scala:79)
[error] 	at sbt.RawCompileLike$.$anonfun$prepare$1$adapted(RawCompileLike.scala:72)
[error] 	at sbt.RawCompileLike$.$anonfun$cached$4(RawCompileLike.scala:63)
[error] 	at sbt.RawCompileLike$.$anonfun$cached$4$adapted(RawCompileLike.scala:61)
[error] 	at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:219)
[error] 	at sbt.RawCompileLike$.$anonfun$cached$1(RawCompileLike.scala:68)
[error] 	at sbt.RawCompileLike$.$anonfun$cached$1$adapted(RawCompileLike.scala:52)
[error] 	at sbt.Defaults$.$anonfun$docTaskSettings$4(Defaults.scala:2156)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] 	at sbt.Execute.work(Execute.scala:[291])
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] 	at java.base/java.lang.Thread.run(Thread.java:829)
[error] (core-scala / Compile / doc) Scaladoc generation failed

Workarounds that work for now:

  • Skipping the doc stage
  • Using java.io.Serializable instead of scala.Serializable in places that cause problems
  • Use Scala 2.13.6

Ref to another project issue where I have the same problem locationtech/geotrellis#3503

Metadata

Metadata

Assignees

Labels

fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)has PR

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions