-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Scala 2.11 / 2.12 classfile parser crashes on dotty-compiler_0.1-0.1.2-RC1.jar #2670
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
Comments
My guess: Dotty doesn't emit generic signatures. |
Without checking, I don't think the classfile parser can assume presence of any signatures, as they are optional in the classfile format. |
@lrytz Have you had a look at this? I'm tempted to close this here and move this issue to scala/bug |
Dotty is emitting a zero-length
Contrast with a
This is still treated as an "empty ScalaSig attribute": val attrName = readTypeName()
val attrLen = u4
attrName match {
case tpnme.ScalaSignatureATTR =>
isScala = true
val pbuf = new PickleBuffer(in.buf, in.bp, in.bp + attrLen)
pbuf.readNat(); pbuf.readNat()
if (pbuf.readNat == 0) // a scala signature attribute with no entries means that the actual scala signature
isScalaAnnot = true // is in a ScalaSignature annotation.
in.skip(attrLen) Which implies that the actual Scala2 pickle should be found in the |
Some history: Scala pickles used to be stored in classfile attributes, but were moved to annotations for better interop with, e.g, runtime reflection. The |
The other question, is what are these package objects doing in
|
I see that the absence of the // BCodeSkelBuilder.initJClass
val ssa = getAnnotPickle(thisName, claszSymbol)
cnode.visitAttribute(if (ssa.isDefined) pickleMarkerLocal else pickleMarkerForeign) // BCodeHelpers 2.11-dotty
def pickleMarkerForeign = {
createJAttribute(ScalaSignatureATTRName, new Array[Byte](0), 0, 0)
} This is a bug in // GenASM 2.11
def pickleMarkerForeign = {
createJAttribute(tpnme.ScalaATTR.toString, new Array[Byte](0), 0, 0)
} |
I haven't untangled the history of this, but the code in 2.12 looks right, so I'd suggest an upgrade of your version of the compiler backend.. |
Looks like it is a bug introduced in lampepfl/scala@3d66b0d#diff-7a3aa9d1c9acd44da15dc536d4760e5aR179 |
@retronym Thanks for the investigation!
We try to keep our backend compiling with both scalac and dotty, to do that we introduced some dummy package objects that forward to real implementations in dotty with other names: https://github.com/lampepfl/dotty/tree/master/compiler/src/scala |
Fix in lampepfl/scala#21, thanks again for looking into it @retronym ! |
Fix #2670: Scalac classfile parser crashes on dotty jar
It's either a bug in Scalac's classfile parser on in dotty's code gen.
The text was updated successfully, but these errors were encountered: