This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Scala reflection fails in IDE

No replies
gkossakowski
Joined: 2010-03-11,
User offline. Last seen 33 weeks 5 days ago.
Hi,
If you try to run https://gist.github.com/1257784 in Scala IDE (Eclipse) you'll get:
Exception in thread "main" java.lang.UnsupportedOperationException: Scala reflection not available on this platform at scala.reflect.package$.mirror(package.scala:10) at test.ScalaProxy$ScalaHandler.methodToSymbol(Main.scala:32) at test.ScalaProxy$ScalaHandler.invoke(Main.scala:21) at $Proxy0.foo(Unknown Source) at test.Test$delayedInit$body.apply(Main.scala:66) at scala.Function0$class.apply$mcV$sp(Function0.scala:34) at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) at scala.App$$anonfun$main$1.apply(App.scala:61) at scala.App$$anonfun$main$1.apply(App.scala:61) at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) at scala.collection.immutable.List.foreach(List.scala:77) at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:31) at scala.App$class.main(App.scala:61) at test.Test$.main(Main.scala:50) at test.Test.main(Main.scala)
I tried moving scala library and scala compiler from boot classpath to regular classpath but it didn't help. I have no idea if it's a problem in Scala reflection implementation or classpath management.
Also, trying to use Scala reflection from sbt 0.11 (e.g. using sbt's run command) will lead to some other weird errors related to classpath.
Not sure if we want a tickets for those problems.
--
Grzegorz Kossakowski

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland