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

No way to disable -javaextdirs in scalac #8435

Open
scabug opened this issue Mar 21, 2014 · 3 comments
Open

No way to disable -javaextdirs in scalac #8435

scabug opened this issue Mar 21, 2014 · 3 comments
Milestone

Comments

@scabug
Copy link

scabug commented Mar 21, 2014

Cross-compiling on a different JDK than the one used to run scalac is hindered by the fact that -javaextirs is always picking up the jars found in the running JDK.

For example, running Java 7, and compiling using JDK8

$ scalac -javabootclasspath `/usr/libexec/java_home -v 1.8`/jre/lib/rt.jar  /Users/dragos/sandbox/fx.scala  -Ylog-classpath
...
Calculated: object Calculated {
  scalaHome            = /opt/scala-2.10.3
  javaBootClassPath    = /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/rt.jar
  javaExtDirs          = 
/Users/dragos/Library/Java/Extensions
/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/jre/lib/ext
/Library/Java/Extensions
/Network/Library/Java/Extensions
/System/Library/Java/Extensions
/usr/lib/java
  javaUserClassPath    = ""
    useJavaClassPath   = true
  scalaBootClassPath   = 
  scalaExtDirs         = 
  userClassPath        = .
  sourcePath           = 
}

Notice the JDK 7 entries. Passing -javaextdirs "" won't have any effect.

This scenario is used in the IDE, where users configure the JDK per project, and probably JDK 8 is a prime example. Mixing JDK7 and JDK8 on the classpath crashes scalac with MissingRequirementError @FunctionalInterface not found (since rt.jar comes from Java 7, but a JavaFX class would come from extdirs, meaning the JDK8 version, version that might use the new FunctionalInterface).

The PathResolver hardcodes the idea that an empty string means it should pick up the default value.

Workaround: use a whitespace character -javaextdirs " "

@scabug
Copy link
Author

scabug commented Mar 21, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8435?orig=1
Reporter: @dragos
Affected Versions: 2.10.4, 2.11.0-RC3

@scabug
Copy link
Author

scabug commented Mar 21, 2014

@adriaanm said:
sounds like java8 interop will require at least a minimal fix in 2.11.x, with a cleanup of classpath handling in 2.12

@scala scala deleted a comment from scabug Mar 3, 2018
@scala scala deleted a comment from scabug Mar 3, 2018
@SethTisue SethTisue added this to the Backlog milestone Mar 3, 2018
@SethTisue
Copy link
Member

anyone know if this should remain open?

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