On Apr 13, 2012, at 10:16 AM, Eugene Burmako wrote:
[INFO] uncaught exception during compilation: java.lang.UnsupportedOperationException
[ERROR] error: java.lang.UnsupportedOperationException: Scala reflection not available on this platform
[INFO] at scala.reflect.package$.mkMirror(package.scala:23)
[INFO] at scala.reflect.package$.mirror(package.scala:13)
[INFO] at scala.tools.nsc.Phases$TimingModel.<init>(Phases.scala:29)
[INFO] at scala.tools.nsc.Global.scala$tools$nsc$Global$$phaseTimings(Global.scala:726)
[INFO] at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1313)
[INFO] at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1278)
[INFO] at scala.tools.nsc.Global$Run.compileSources(Global.scala:1272)
[INFO] at scala.tools.nsc.Global$Run.compile(Global.scala:1405)
[INFO] at scala.tools.nsc.Driver.doCompile(Driver.scala:31)
[INFO] at scala.tools.nsc.Main$.doCompile(Main.scala:81)
[INFO] at scala.tools.nsc.Driver.process(Driver.scala:52)
[INFO] at scala.tools.nsc.Driver.main(Driver.scala:65)
[INFO] at scala.tools.nsc.Main.main(Main.scala)
What we see here indicates that scala-compiler needs to be on classpath.
Tags (aka manifests & classmanifests) now use reflection mirror (aka scala.reflect.mirror). Hence, the very startup of the compiler, which instantiates a class manifest, triggers initialization of the mirror. This initialization tries to load scala.reflect.runtime.Mirror class from the classpath and instantiate it. If it fails, you see the error message above.
In 2.10.0 final release, we will have a fallback mirror in case you don't have scala-compiler.jar on the classpath. But for now this is a mandatory requirement.
Let's rerun the build, and see what happens.
Yeah, but it uses scala.compiler-2.10.0.v20120412-164128-6680522ccb.jar/lib/scala-compiler.jar, whereas the first build that featured macros appeared today (13.04) at night.I meant "[let's fix the classpath and] rerun the build".
That one is the OSGi version of the latest 2.10-SNAPSHOTIf you open the compiler.properties:#Fri, 13 Apr 2012 02:13:00 +0200
version.number=2.10.0-20120412-164128-6680522ccb
All right, I get it.Since it's OSGi, maybe it has a different notion of reflection? No idea how it works though. Could you, please, explain?What Scala reflection needs is a successful call to Class.forName("scala.reflect.runtime.package$", true, getClass.getClassLoader) invoked from ReflectionUtils. What could mess with that?
This link suggests that we need to update manifests in both scala library and scala compiler to allow classes from library to reflectively load classes from scala compiler. Could you please check this out?
I will look into that after I finish with urgent macro stuff that still needs to be implemented.Could you please prepare a non-scary test case for me?
Here's what I see:
[INFO] primordial classloader with boot classpath [c:\PROGRA~1\Java
\JDK16~1.0_2\jre\lib\resources.jar;c:\PROGRA~1\Java\JDK16~1.0_2\jre\lib
\rt.jar;c:\PROGRA~1\Java\JDK16~1.0_2\jre\lib\sunrsasign.jar;c:
\PROGRA~1\Java\JDK16~1.0_2\jre\lib\js
se.jar;c:\PROGRA~1\Java\JDK16~1.0_2\jre\lib\jce.jar;c:\PROGRA~1\Java
\JDK16~1.0_2\jre\lib\charsets.jar;c:\PROGRA~1\Java\JDK16~1.0_2\jre\lib
\modules\jdk.boot.jar;c:\PROGRA~1\Java\JDK16~1.0_2\jre\classes;C:\Users
\xeno.by\.m2\repository\org\
skife\com\typesafe\config\typesafe-config\0.3.0\typesafe-
config-0.3.0.jar;C:\Users\xeno.by\.m2\repository\org\scala-lang\scala-
library\2.10.0-SNAPSHOT\scala-library-2.10.0-SNAPSHOT.jar]
[INFO] loading class named: scala.reflect.runtime.package$
Compiler is not on the classpath, and, I believe, this is a
responsibility of maven-scala plugin. Right?
Okay, updated pom.xml/project/dependencies, and scala-compiler gets added, but it's still not in the primordial classloader. Hmmm
scala-tools is down. is this normal and it will be up eventually, or I
should report this to someone?
Yeah, I will surely print a message.Speaking of SBT. Is there any up-to-date guide about how to set up SBT for M2? A few weeks ago I downloaded fresh sbt-launcher from Typesafe, but it failed to launch whining about missing scala/ScalaObject. I didn't have much time to look into that and put my SBT adventures on hold. Could you, please, help me out?
- the compiler should start using its own classloader regardless of
anything else
- using manifests really cannot require the compiler, that's an
unacceptable regression and it shouldn't even be considered (for
release anyway, we will have to live with however things are for M3)
- I have a lot of classloader improvement done and waiting for me to
integrate it, but it will probably explode my machine under merge
conflicts