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

Unnecessary recompilation with long nested type names under -Xmax-classfile-name #716

Closed
pmpfr opened this issue Dec 10, 2019 · 3 comments
Closed

Comments

@pmpfr
Copy link

pmpfr commented Dec 10, 2019

steps

sbt version: 1.3.4 (and 1.3.3)
but sbt 1.2.8 works as expected
(scala 2.12.8)

problem

Files with nested types whose combined names are longer than a certain limit are seen as always needing recompilation by sbt (invalidated). For me, -Xmax-classfile-name=80 gives a limit of 65 characters: at or beyond that my test file always gets recompiled.

package foo

object ABCD45678901234567890123456789012345678901234567890123456789 {
  class ABCD
}

object Test {
  val _ = new ABCD45678901234567890123456789012345678901234567890123456789.ABCD
  //          ^^^^^^^^^^^^^^^^^^^^^^ 65 characters long ^^^^^^^^^^^^^^^^^^^^^^^
}

expectation

When unchanged, the file should not be recompiled no matter how long the type names inside. This was the behaviour under sbt 1.2.8

notes

Transcript

MB19090:LengthLimit peter.robinson$ cat project/build.properties
sbt.version=1.3.4
MB19090:LengthLimit peter.robinson$ cat LengthTest.scala
package foo

object ABCD45678901234567890123456789012345678901234567890123456789 {
  class ABCD
}

object Test {
  val _ = new ABCD45678901234567890123456789012345678901234567890123456789.ABCD
  //          ^^^^^^^^^^^^^^^^^^^^^^ 65 characters long ^^^^^^^^^^^^^^^^^^^^^^^
}
MB19090:LengthLimit peter.robinson$ cat build.sbt
scalaVersion := "2.12.8"
scalacOptions ++= Seq("-Xmax-classfile-name", "80")
MB19090:LengthLimit peter.robinson$ sbt
[info] Loading settings for project global-plugins from idea.sbt ...
[info] Loading global plugins from /Users/peter.robinson/.sbt/1.0/plugins
[info] Loading project definition from /private/tmp/LengthLimit/project
[info] Loading settings for project lengthlimit from build.sbt ...
[info] Set current project to lengthlimit (in build file:/private/tmp/LengthLimit/)
[info] sbt server started at local:///Users/peter.robinson/.sbt/1.0/server/b778c582df5d59e42bb9/sock
sbt:lengthlimit> compile
[info] Compiling 1 Scala source to /private/tmp/LengthLimit/target/scala-2.12/classes ...
[success] Total time: 3 s, completed 10-Dec-2019 13:03:32
sbt:lengthlimit> compile
[info] Compiling 1 Scala source to /private/tmp/LengthLimit/target/scala-2.12/classes ...
[success] Total time: 0 s, completed 10-Dec-2019 13:03:35
sbt:lengthlimit>
@pmpfr
Copy link
Author

pmpfr commented Dec 10, 2019

I can also reproduce the problem (with an even longer name) without setting -Xmax-classfile-name at all, including under scala 2.13 where that's not an option. Again it's a problem for sbt 1.3.4 but not for 1.2.8.

@eed3si9n
Copy link
Member

@pmpfr Thanks for the report. I am going to transfer this issue to Zinc.

@eed3si9n eed3si9n transferred this issue from sbt/sbt Dec 10, 2019
@Friendseeker
Copy link
Member

Fixed by #1259

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

No branches or pull requests

3 participants