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

Forward port sbt/sbt#3701, JDK9/Scala 2.{10,11} overcompilation #450

Merged
merged 1 commit into from
Nov 6, 2017

Conversation

retronym
Copy link
Member

@retronym retronym commented Nov 1, 2017

No description provided.

} binaryDependency(classFile, binaryClassName)
jarFile <- Option(zip.file)
if !jarFile.isDirectory // workaround for JDK9 and Scala 2.10/2.11, see https://github.com/sbt/sbt/pull/3701
} binaryDependency(jarFile, binaryClassName)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change that fixes an observable bug. I didn't figure out why the bug in SBT 0.13 fixed by -Dscala.ext.dirs was not necessary here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate why Scalac reports the underlying source to be a directory under JDK9? I'm curious.

Copy link
Member Author

@retronym retronym Nov 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To integrate the JEP-220 support into Scala 2.10/2.11, I made the jrt:// virtual file system appear as a ZipFile. This was done by subclassing, but the superclass had inadvertently overriden override val underlyingSource = Some(jarFile). I could not override this to return None without making a binary compatible change to the method I was overriding (widening to Option).

So I return Some($JAVA_HOME) instead, but that messed up Zinc.

Rocks and hard places, all around. Filtering here in Zinc seemed the least bad option for now, but we might need to revisit it to make Zinc properly invalidate after the JDK is upgraded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to know this, thanks for the explanation.

@retronym retronym force-pushed the ticket/dirDependency branch 3 times, most recently from 152a6c3 to 5812284 Compare November 1, 2017 03:44
Copy link
Member

@jvican jvican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just have a few questions and a suggestion.

@@ -13,6 +13,7 @@ import xsbti.ArtifactInfo
import scala.util
import java.io.File
import CompilerArguments.{ absString, BootClasspathOption }
import sbt.IO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing a compilation error and can be removed.

def findBoot: String = {
import scala.collection.JavaConverters._
System.getProperties.asScala.iterator.collectFirst {
case (k, v) if k.endsWith(".boot.class.path") => v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you done this to avoid making it specific to scala.boot.class.path? Is there any other valuable system variable that users .boot.class.path as the suffix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is from scalac. I believe the intent is to support non OpenJDK based JVMs that don't use sun.boot.classpath.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=188648#c6
http://mail.openjdk.java.net/pipermail/build-dev/2013-November/011103.html

} binaryDependency(classFile, binaryClassName)
jarFile <- Option(zip.file)
if !jarFile.isDirectory // workaround for JDK9 and Scala 2.10/2.11, see https://github.com/sbt/sbt/pull/3701
} binaryDependency(jarFile, binaryClassName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate why Scalac reports the underlying source to be a directory under JDK9? I'm curious.

@jvican jvican added the bug label Nov 1, 2017
@dwijnand dwijnand added this to the 1.1.0 milestone Nov 2, 2017
@retronym retronym force-pushed the ticket/dirDependency branch from 5812284 to 1c8eefb Compare November 3, 2017 23:25
@retronym retronym force-pushed the ticket/dirDependency branch from 1c8eefb to 641a491 Compare November 3, 2017 23:34
@jvican
Copy link
Member

jvican commented Nov 6, 2017

This is good to go on my side.

Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with this. And given @eed3si9n merged the 0.13 PR sbt/sbt#3701 my guess is he's cool with this too.

@dwijnand dwijnand merged commit 9998a90 into sbt:1.x Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants