Skip to content

Scala runner puts cwd ahead of its temporary -d on the class path #15015

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
som-snytt opened this issue Apr 22, 2022 · 0 comments
Closed

Scala runner puts cwd ahead of its temporary -d on the class path #15015

som-snytt opened this issue Apr 22, 2022 · 0 comments

Comments

@som-snytt
Copy link
Contributor

Compiler version

3.2.0-RC1

Minimized code

12 |object Test:
   |       ^
   |object Test differs only in case from class test. Such classes will overwrite one another on case-insensitive filesystems.
1 warning found
Exception in thread "main" java.lang.NoSuchMethodError: 'scala.languageFeature$postfixOps Test$.c()'
        at i15013$package$.test(i15013.scala:21)
        at test.main(i15013.scala:20)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at dotty.tools.scripting.ScriptingDriver.compileAndRun(ScriptingDriver.scala:36)
        at dotty.tools.scripting.Main$.main(Main.scala:45)
        at dotty.tools.MainGenericRunner$.run$1(MainGenericRunner.scala:248)
        at dotty.tools.MainGenericRunner$.main(MainGenericRunner.scala:267)
        at dotty.tools.MainGenericRunner.main(MainGenericRunner.scala)

Output

 rm *.class *.tasty
 ~/projects/dotty/bin/scala  i15013.scala
-- Warning: .../snips/i15013.scala:12:7 -----------------------------------------------------------------------
12 |object Test:
   |       ^
   |object Test differs only in case from class test. Such classes will overwrite one another on case-insensitive filesystems.
1 warning found
scala.languageFeature$postfixOps$@5b7ee56c

The warning was because

object Test
@main def test() = println()

But the error was that I had a local Test.class from previous experiments.

Expectation

As with REPL, I expect the compilation products of scala runner to "take precedence" over random files in my file system.

Either they should "come first" on the class path, or the class loaders should be constructed to prioritize an in-memory file system over the ordinary class path that uses the default file system.

I included the warning in this ticket just to show that the coincidence was unnecessarily confusing or distracting.

@som-snytt som-snytt added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 22, 2022
@Kordyjan Kordyjan added area:classpath and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 25, 2022
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