Skip to content

Inconsistent, forced {{-Dscala.usejavacp}} treatment #8368

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

Closed
scabug opened this issue Mar 6, 2014 · 9 comments
Closed

Inconsistent, forced {{-Dscala.usejavacp}} treatment #8368

scabug opened this issue Mar 6, 2014 · 9 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Mar 6, 2014

As per https://github.com/scala/scala/blob/master/src/repl/scala/tools/nsc/interpreter/AbstractOrMissingHandler.scala#L28
{quote}{code}
|** Note that as of 2.8 scala does not assume use of the java classpath.
|** For the old behavior pass -usejavacp to scala, or if using a Settings
|** object programatically, settings.usejavacp.value = true."""
{code}{quote}

Except the Scalac tools force the setting to -Dscala.usejavacp=true:
https://github.com/scala/scala/blob/master/src/compiler/scala/tools/ant/templates/tool-unix.tmpl#L202
https://github.com/scala/scala/blob/master/src/compiler/scala/tools/ant/templates/tool-windows.tmpl#L129

And yet tools/tests visibly expect the tool to set usejavacp=false since they override the setting:

huitseeker➜~/Scala/scala(issue/DeprecWarning✗)» ag 'Dscala\.usejavacp'                                                                                                           [17:35:29]
build/locker/classes/compiler/scala/tools/ant/templates/tool-unix.tmpl
202:  -Dscala.usejavacp=true \

build/locker/classes/compiler/scala/tools/ant/templates/tool-windows.tmpl
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true @properties@

build/quick/classes/compiler/scala/tools/ant/templates/tool-unix.tmpl
202:  -Dscala.usejavacp=true \

build/quick/classes/compiler/scala/tools/ant/templates/tool-windows.tmpl
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true @properties@

build/quick/bin/fsc.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/quick/bin/fsc
202:  -Dscala.usejavacp=true \

build/quick/bin/scaladoc.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/quick/bin/scaladoc
202:  -Dscala.usejavacp=true \

build/quick/bin/scalap.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/quick/bin/scalac.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/quick/bin/scala
202:  -Dscala.usejavacp=true \

build/quick/bin/scalac
202:  -Dscala.usejavacp=true \

build/quick/bin/scala.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/quick/bin/scalap
202:  -Dscala.usejavacp=true \

build/pack/bin/scalap.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/pack/bin/fsc.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/pack/bin/scalac
202:  -Dscala.usejavacp=true \

build/pack/bin/scala
202:  -Dscala.usejavacp=true \

build/pack/bin/scaladoc.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/pack/bin/fsc
202:  -Dscala.usejavacp=true \

build/pack/bin/scalac.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/pack/bin/scaladoc
202:  -Dscala.usejavacp=true \

build/pack/bin/scala.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

build/pack/bin/scalap
202:  -Dscala.usejavacp=true \

dists/scala-2.11.0-SNAPSHOT/bin/scala
202:  -Dscala.usejavacp=true \

dists/scala-2.11.0-SNAPSHOT/bin/scalap.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

dists/scala-2.11.0-SNAPSHOT/bin/scalac
202:  -Dscala.usejavacp=true \

dists/scala-2.11.0-SNAPSHOT/bin/fsc
202:  -Dscala.usejavacp=true \

dists/scala-2.11.0-SNAPSHOT/bin/scala.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

dists/scala-2.11.0-SNAPSHOT/bin/scaladoc.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

dists/scala-2.11.0-SNAPSHOT/bin/scalac.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

dists/scala-2.11.0-SNAPSHOT/bin/fsc.bat
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true 

dists/scala-2.11.0-SNAPSHOT/bin/scaladoc
202:  -Dscala.usejavacp=true \

dists/scala-2.11.0-SNAPSHOT/bin/scalap
202:  -Dscala.usejavacp=true \

src/compiler/scala/tools/ant/FastScalac.scala
166:    java.createJvmarg() setValue "-Dscala.usejavacp=true"

src/compiler/scala/tools/ant/templates/tool-windows.tmpl
129:set _PROPS=-Dscala.home="!_SCALA_HOME!" -Denv.emacs="%EMACS%" -Dscala.usejavacp=true @properties@

src/compiler/scala/tools/ant/templates/tool-unix.tmpl
202:  -Dscala.usejavacp=true \

More worryingly, both scripts ignore the setting that may be passed to them by the user, preemptively forcing their own stuff by placing it after java args.

Attached is a patch that fixes things for src/compiler/scala/tools/ant/templates/tool-unix.tmpl. I have no idea how to proceed with the windows equivalent.

@scabug
Copy link
Author

scabug commented Mar 6, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8368?orig=1
Reporter: @huitseeker
Affected Versions: 2.11.0-RC1
See #8358
Attachments:

@scabug
Copy link
Author

scabug commented Mar 6, 2014

@som-snytt said:
Partest doesn't force it, which is why the flag is supplied by tests that need it.

Just for fun, the comment from the transitional period before the switch:

-    /** I have distilled everyone's classpath hopes and dreams into the
-     *  question of how to resolve this boolean.  Right at this moment if I
-     *  do anything but default to true right here, partest chokes.  I'm
-     *  steadily reworking all the places partest gets its hands on the
-     *  classpath so eventually I'll be able to remedy that, at which point
-     *  my current plan is to have this default to false unless some
-     *  property or command line option is supplied.  This is negotiable,
-     *  but at this point I can say with confidence that less magic and
-     *  less autodetection is more better.
-     */
-    def useJavaClassPath    = true
-    // hypothetically:
-    // def useJavaClassPath = propIsSet("scala.classpath.guess")

That's four years ago, right after the "Decade of Sane Class Paths" initiative was announced.

@scabug
Copy link
Author

scabug commented Mar 7, 2014

@gkossakowski said:
Somewhat related: #8358

In #8358 we are confused about what should be included in classpath as well.

@scabug
Copy link
Author

scabug commented Mar 7, 2014

@huitseeker said:
Then maybe it would at least be possible to make (unix, windows) scalac instances at least not ignore a setting of usejavacp explicitly passed as argument ?

@scabug
Copy link
Author

scabug commented Mar 7, 2014

@dragos said:
I vote for fixing this, as it makes the -Xsource flag useless when used with the runner script. In fact, there is absolutely no way to pass a different scala library when using scalac (other than the one loaded in the JVM running the compiler).

As Francois suggests, having a way to override the default would be good enough.

@scabug
Copy link
Author

scabug commented Mar 7, 2014

@adriaanm said:
scala/scala#3608

@scabug
Copy link
Author

scabug commented Mar 7, 2014

@adriaanm said (edited on Mar 7, 2014 6:46:59 PM UTC):
Sorry, not touching the windows runners with a 100m long pole.

@scabug
Copy link
Author

scabug commented Mar 8, 2014

@som-snytt said:
In journalism, the idiom is: "with a 3.048 m (10 feet) pole."

@scabug scabug closed this as completed Mar 10, 2014
@scabug
Copy link
Author

scabug commented Mar 11, 2014

@adriaanm said:
Stefan wielded the pole masterfully: scala/scala#3621

@scabug scabug added this to the 2.11.0-RC3 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants