Skip to content

@static lazy val generates invalid bytecode #1225

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

Closed
lrytz opened this issue Apr 18, 2016 · 1 comment
Closed

@static lazy val generates invalid bytecode #1225

lrytz opened this issue Apr 18, 2016 · 1 comment

Comments

@lrytz
Copy link
Member

lrytz commented Apr 18, 2016

import annotation.static
class T
object T {
  @static lazy val x = "hi"
  def main(args: Array[String]): Unit = {
    println(x)
  }
}

gives

java.lang.VerifyError: Bad local variable type
Exception Details:
  Location:
    T$.x()Ljava/lang/String; @0: aload_0
  Reason:
    Type top (current frame, locals[0]) is not assignable to reference type
  Current Frame:
    bci: @0
    flags: { }
    locals: { }
    stack: { }
  Bytecode:
    0x0000000: 2ab4 0018 9a00 06a7 000a 2ab4 001a a700
    0x0000010: 122a 04b5 0018 2a12 1cb5 001a 2ab4 001a
    0x0000020: b0
  Stackmap Table:
    same_frame(@10)
    same_frame(@17)
    same_locals_1_stack_item_frame(@32,Object[#30])

    at T.main(Test.scala)
@DarkDimius
Copy link
Contributor

DarkDimius commented Apr 18, 2016

Fixed by disallowing @static lazy vals. #1226

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

3 participants