Skip to content

Scala 2.13 with Zinc 1.4.3 fails with NoSuchMethodError #15491

Description

@marc-szalkiewicz-dd

Expected Behavior

Gradle's Scala plugin is incompatible with Zinc 1.4.3 and Scala 2.13.

Current Behavior

A NoSuchMethod exception is thrown:

Caused by: java.lang.NoSuchMethodError: 'void sbt.internal.inc.AnalyzingCompiler$.compileSources(scala.collection.Iterable, java.io.File, scala.collection.Iterable, java.lang.String, sbt.internal.inc.RawCompiler, sbt.util.Logger)'
        at org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory.lambda$getBridgeJar$1(ZincScalaCompilerFactory.java:172)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:220)

Context

I encountered this issue while using ScalaFix with ExplicitResultTypes, which requires binary compatibility between the Scala compiler and ScalaFix.

This occurs because the signature to compileSources changed in the second parameter from File to Path between Zinc 1.3.5 and 1.4.3:

AnalyzingCompiler#compileSources@1.3.5

AnalyzingCompiler#compileSources@1.4.3

With any luck, this change is all that is needed to address #12869 (comment).

Steps to Reproduce

In a convention plugin, set:

scala {
    zincVersion.set("1.4.3")
}

scalafix {
    configFile.set(file("$rootDir/.scalafix.conf"))
}

dependencies {
    zinc("org.scala-sbt:zinc_2.13:1.4.3")
}

Your Environment

OSX, Gradle 6.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions