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

java.lang.VerifyError when using nested try/catch and ControlThrowable

    Details

      Description

      There may be an issue with nested try/catch blocks and ControlThrowable.

      import scala.util.control.ControlThrowable

      object Bar {
        def main(args: Array[String]) {
          try {
            println("...")
          }
          finally {
            try {
              println("...")
            }
            finally {
              try {
                println("...")
              }
              catch {
                case ct: ControlThrowable => throw(ct)
                case t: Throwable => t.printStackTrace()
              }
            }
          }
        }
      }
      

      compiles, but when run leads to a VerifyError:

      [info] Running Bar 
      [error] java.lang.VerifyError: (class: Bar$, method: main signature: ([Ljava/lang/String;)V) Accessing value from uninitialized register 9
      [error] 	at Bar.main(Bar.scala)
      [error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      [error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [error] 	at java.lang.reflect.Method.invoke(Method.java:606)
      [error] 	at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:71)
      [error] 	at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
      [error] 	at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:139)
      [error] 	at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:71)
      [error] 	at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:139)
      [error] 	at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
      [error] 	at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
      [error] 	at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
      [error] 	at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
      [error] 	at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:74)
      [error] 	at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
      [error] 	at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
      [error] 	at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
      

        Attachments

          Activity

            People

            • Assignee:
              rytz Lukas Rytz
              Reporter:
              ptschorn Patrick Tschorn
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: