Skip to content
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

ToolBox unable to compile code with vals' types that contain $'s in the name #7732

Closed
scabug opened this issue Aug 9, 2013 · 4 comments
Closed

Comments

@scabug
Copy link

scabug commented Aug 9, 2013

ToolBox compiler can't compile code such as:

val t: test.MyApp$$anonfun$1

Example stack trace with ToolBox compilation error:

	scala.tools.reflect.ToolBoxError: reflective compilation has failed: 

	type MyApp$$anonfun$1 is not a member of package test
		at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal.throwIfErrors(ToolBoxFactory.scala:311)
		at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl$ToolBoxGlobal.compile(ToolBoxFactory.scala:244)
		at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl.compile(ToolBoxFactory.scala:408)
		at scala.tools.reflect.ToolBoxFactory$ToolBoxImpl.eval(ToolBoxFactory.scala:411)
		at test.T$delayedInit$body.apply(sep.scala:8)
		at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
		at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
		at scala.App$$anonfun$main$1.apply(App.scala:71)
		at scala.App$$anonfun$main$1.apply(App.scala:71)
		at scala.collection.immutable.List.foreach(List.scala:318)
		at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
		at scala.App$class.main(App.scala:71)
		at test.T$.main(sep.scala:4)
		at test.T.main(sep.scala)
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
		at java.lang.reflect.Method.invoke(Method.java:597)
		at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:71)
		at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
		at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:139)
		at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:71)
		at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:139)
		at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
		at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
		at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
		at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
		at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:74)
		at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
		at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
		at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
@scabug
Copy link
Author

scabug commented Aug 9, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7732?orig=1
Reporter: Jedd Haberstro (jhaberstro)
Affected Versions: 2.10.2
Duplicates #7733
Attachments:

@scabug
Copy link
Author

scabug commented Aug 9, 2013

@retronym said:
Not sure if we discussed this already, but if you have the classpath available as JARs / .class files, you might be better of using the full compiler rather than the toolbox compiler. ToolBox is somewhat crippled, as is runtime reflection, but the inability to enumerate packages via Java reflection / classloader API, which is probably the cause of this bug.

@scabug
Copy link
Author

scabug commented Aug 9, 2013

Jedd Haberstro (jhaberstro) said:
I should also point out that Eugene has looked at this and found the root of the bug. Here's a change he made that makes the ToolBox able to compile my example fine: xeno-by/scala@84278d0

@scabug
Copy link
Author

scabug commented Aug 9, 2013

@xeno-by said:
Oops, sorry guys, it looks like I resubmitted this bug myself, somehow I have missed a notification about it. Since my PR is tied to my submission, I'm closing this issue: #7733.

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

1 participant