Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-10059

NullPointerException is thrown when compiling pure trait impl with @varargs def

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.12.0
    • Fix Version/s: Scala 2.12.1
    • Component/s: None
    • Environment:

      scala 2.12.0
      sbt 0.13.13

      Description

      Following code compiles with 2.11.8, but with 2.12.0 in sbt 0.13.13 NullPointerException is thrown

      trait VarargsTest {
        @varargs def apply(l: Double*): Double
      }
       
      object VarargsTest {
       
        object Impl extends VarargsTest {
          override final def apply(l: Double*): Double = throw new UnsupportedOperationException("dummy impl")
        }
       
      }
      

      exception thrown:

      java.lang.NullPointerException
              at scala.tools.asm.tree.MethodNode.visitLocalVariable(MethodNode.java:572)
              at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitLocalVarScope(BCodeSkelBuilder.scala:719)
              at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.$anonfun$genDefDef$8(BCodeSkelBuilder.scala:629)
              at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitNormalMethodBody$1(BCodeSkelBuilder.scala:629)
              at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genDefDef(BCodeSkelBuilder.scala:636)
              at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:507)
              at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.$anonfun$gen$7(BCodeSkelBuilder.scala:512)
              at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:512)
              at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:113)
              at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.visit(GenBCode.scala:190)
              at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.$anonfun$run$1(GenBCode.scala:139)
              at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.run(GenBCode.scala:139)
              at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.buildAndSendToDisk(GenBCode.scala:381)
              at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:350)
              at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1404)
              at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1389)
              at scala.tools.nsc.Global$Run.compileSources(Global.scala:1384)
              at scala.tools.nsc.Global$Run.compile(Global.scala:1478)
              ...
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rytz Lukas Rytz
                Reporter:
                412b Kirill Plyashkevich
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: