0

I am stumped. It should be a non-issue. I took a patch from Scala 2 repository for a bug which crashes the compiler, compiled those classes separately against "scala-lang" % "scala-compiler" % "2.13.10" and packed into a jar. Then I tried to put them on boot class path of SBT, so they would be picked over the class loader used by the compiler:

scalacOptions ++= Seq(
    "-JXbootclasspath/a:/home/turin/scala/patches/ConcurrentModificationExceptionPatch.jar",
    "-bootclasspath:/home/turin/scala/patches/ConcurrentModificationExceptionPatch.jar",
)

The options above didn't work, and neither did

javaOptions ++= Seq(
    "-Xbootclasspath/a:/home/turin/scala/patches/ConcurrentModificationExceptionPatch.jar",
)

I know the compiler does not see them, because line numbers in the stack trace of the exception thrown during compilation match release files, not 'my' files. SBT recognizes the Scalac bootclasspath, but, apparently, not the java one. Here's the output generated with "-Ylog-classpath":

scalac: Classpath built from (-bootclasspath = /home/turin/scala/patches/ConcurrentModificationExceptionPatch.jar -encoding = UTF-8 -feature = true -g = vars -verbose = true -Wconf = List(msg=export:silent, cat=other-match-analysis&msg=Singleton():silent, cat=deprecation&msg=foldLeft:silent, cat=deprecation&msg=foldRight:silent, cat=deprecation:w, cat=feature:w, cat=feature:w, cat=deprecation:ws, cat=feature:ws, cat=optimizer:ws) -Wperformance = PerformanceWarnings.ValueSet() -Wunused = UnusedWarnings.ValueSet(patvars, privates, locals) -Xlint = LintWarnings.ValueSet(nullary-unit, poly-implicit-overload, option-implicit, delayedinit-select, implicit-not-found) -classpath = /home/turin/porn/oldsql/target/scala-2.13/classes:/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar:/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.12.23/byte-buddy-1.12.23.jar:/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar:/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jline/jline/3.21.0/jline-3.21.0.jar:/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.10/scala-compiler-2.13.10.jar:/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar:/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.13.10/scala-reflect-2.13.10.jar -language = languageFeatures.ValueSet(existentials, higherKinds, implicitConversions, reflectiveCalls) -Vlog = List(0-100) -Vclasspath = true -Vprint-types = true -Vimplicits = true -Vimplicits-verbose-tree = true -Vreflective-calls = true) 

Sorry for the mile long line, I didn't want to edit it for fear of removing something important.

scalac: Defaults: object Defaults {
  scalaHome            = 
  javaBootClassPath    = 
  scalaLibDirFound     = None
  scalaLibFound        = 
  scalaBootClassPath   = 
  scalaPluginPath      = misc/scala-devel/plugins
}
calac: Calculated: object Calculated {
  scalaHome            = 
  javaBootClassPath    = 
  javaExtDirs          = 
  javaUserClassPath    = 
  useJavaClassPath     = false
  scalaBootClassPath   = /home/turin/scala/patches/ConcurrentModificationExceptionPatch.jar
  scalaExtDirs         = 
  userClassPath        = 
/home/turin/porn/oldsql/target/scala-2.13/classes
/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar
/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.12.23/byte-buddy-1.12.23.jar
/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar
/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jline/jline/3.21.0/jline-3.21.0.jar
/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.10/scala-compiler-2.13.10.jar
/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar
/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.13.10/scala-reflect-2.13.10.jar
  sourcePath           = 
}
scalac: After java boot/extdirs classpath has 9 entries:
  ZipArchiveClassPath(/home/turin/scala/patches/ConcurrentModificationExceptionPatch.jar,None)
  DirectoryClassPath(/home/turin/porn/oldsql/target/scala-2.13/classes)
  ZipArchiveClassPath(/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar,None)
  ZipArchiveClassPath(/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.12.23/byte-buddy-1.12.23.jar,None)
  ZipArchiveClassPath(/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar,None)
  ZipArchiveClassPath(/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jline/jline/3.21.0/jline-3.21.0.jar,None)
  ZipArchiveClassPath(/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.10/scala-compiler-2.13.10.jar,None)
  ZipArchiveClassPath(/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar,None)
  ZipArchiveClassPath(/home/turin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.13.10/scala-reflect-2.13.10.jar,None)

What am I doing wrong?

Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66
Turin
  • 2,208
  • 15
  • 23

0 Answers0