Skip to content

@static lazy val generates invalid bytecode #1225

Closed
@lrytz

Description

@lrytz
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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions