--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
OK, I'll avoid c.eval; it was just a quick way to evaluate constant expressions. I mean quick for me.It's not a problem with primitives.OK, thanks.Yes, it shows the same behavior with `val x: java.util.Formattable = null`.I also wondered if there was an interaction with the recent "flat class path" change, but I haven't pursued that.I remember seeing the types expressed in output as `util.this.Formattable`, but maybe the missing `java` is normal.
I can reproduce outside of partest
and Toolbox
, using an Importer
from the runtime reflection universe is sufficient.
% tail test/files/run/som/*.{java,scala}
==> test/files/run/som/Java_1.java <==
public class Java_1<K, V> {
public class Inner extends Java_1<K, V> {
}
}
class SomeOtherJava {
}
==> test/files/run/som/Macros_1.scala <==
def fImpl(c: Context): c.Tree = {
import c.universe._
import reflect.runtime.{universe => ru}
val formatterSym = c.universe.symbolOf[bakery.SomeOtherJava]
ru.internal.createImporter(c.universe).importSymbol(formatterSym)
q"()"
}
}
==> test/files/run/som/Test_2.scala <==
object Test {
bakery.Bakery.f
}
% javac -d /tmp test/files/run/som/*.java && qscalac -classpath /tmp -d /tmp test/files/run/som/Macros_1.scala && qscalac -classpath /tmp -d /tmp test/files/run/som/Test_2.scala
error: error while loading Java_1$Inner, class file '/tmp/bakery/Java_1$Inner.class' is broken
(class java.util.NoSuchElementException/key not found: K)
one error found
Importer
forces the info of the owner of SomeOtherJava
. This then runs ClassfileParser
over Java_1$Inner
. References it its type signatures to the type parameters of the enclosing class trigger the NSEE. We’d need to contrast this with a situation where these enclosing type parameters are visible (e.g regular compilation), so as to understand where the problem lies.
I can reproduce outside of
partest
andToolbox
, using anImporter
from the runtime reflection universe is sufficient.
% tail sandbox/{Java_1.java,test.scala}
==> sandbox/Java_1.java <==
public class Java_1<K, V> {
public class Inner extends Java_1<K, V> {
}
}
==> sandbox/test.scala <==
object Test {
classOf[Java_1$Inner]
}
% javac -d /tmp sandbox/Java_1.java && qscalac -classpath /tmp sandbox/test.scala
error: error while loading Java_1$Inner, class file '/tmp/Java_1$Inner.class' is broken
(class java.util.NoSuchElementException/key not found: K)
sandbox/test.scala:2: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
classOf[Java_1$Inner]
^
one warning found
one error found