Skip to content
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

Gradle 8.0 fails Scala build with isBlank not found in String class error #23905

Closed
stamhankar999 opened this issue Feb 15, 2023 · 2 comments
Closed
Labels
Milestone

Comments

@stamhankar999
Copy link

Steps to reproduce:

  1. Build the attached project with gradle build

Expected Result:
It should build successfully.

Actual Result:
Fails with this error:

[Error] .../scala-example/src/main/scala/scala/example/App.scala:6:15: value isBlank is not a member of String
one error found

This project builds fine with Gradle 7.6, and no deprecations are reported either.
scala-example.tar.gz

@ljacomet ljacomet added this to the 8.0.1 (unconfirmed) milestone Feb 15, 2023
@rpalcolea
Copy link
Contributor

@ljacomet I found this interesting, I tend to look at reported scala issues and since we didn't find problems on our side, I downloaded the sample and took a look.

Assuming you want to use JDK11+ which is where isBlank was added afaik

The scala compiler is indeed instructed to run for 11 as target:

2023-02-15T18:17:32.621-0800 [DEBUG] [org.gradle.api.internal.tasks.scala.NormalizingScalaCompiler] Java compiler arguments: -source 11 -target 11 -d /Users/rperezalcolea/Downloads/scala-example/scala-example/build/classes/scala/main -g -sourcepath  -proc:none -s /Users/rperezalcolea/Downloads/scala-example/scala-example/build/generated/sources/annotationProcessor/scala/main -XDuseUnsharedTable=true -classpath /Users/rperezalcolea/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.13.9/48bad4bee84f503be847be81ae96d32f6e78d658/scala-library-2.13.9.jar:/Users/rperezalcolea/Downloads/scala-example/scala-example/build/classes

However, the cached incremental compiler is using release flag for 8

2023-02-15T18:17:33.924-0800 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] [zinc] Running cached compiler 7e43e9b2 for Scala compiler version 2.13.9
2023-02-15T18:17:33.925-0800 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] [zinc] The Scala compiler is invoked with:
        -deprecation
        -unchecked
        -release:8
        -bootclasspath

Using toolchains definitely works

2023-02-15T18:20:42.615-0800 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] [zinc] Running cached compiler 4b7c6058 for Scala compiler version 2.13.9
2023-02-15T18:20:42.616-0800 [DEBUG] [org.gradle.api.internal.tasks.scala.ZincScalaCompilerFactory] [zinc] The Scala compiler is invoked with:
        -deprecation
        -unchecked
        -release:11
        -bootclasspath
        /Users/rperezalcolea/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.13.9/48bad4bee84f503be847be81ae96d32f6e78d658/scala-library-2.13.9.j

ljacomet added a commit that referenced this issue Feb 17, 2023
Only use release when an explicit toolchain is configured.

Fixes #23905
bot-gradle added a commit that referenced this issue Feb 17, 2023
Only use release when an explicit toolchain is configured.

Fixes #23905

Co-authored-by: Louis Jacomet <louis@gradle.com>
@ljacomet
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@ljacomet @stamhankar999 @rpalcolea and others