Scala Programming Language
  1. Scala Programming Language
  2. SI-5812

def in constructor invocation causes VerifyError at runtime

    Details

      Description

      The following small App causes a VerifyError at runtime. I think the spec (c.f. 5.1.1) should allow this.

      object Test extends App {
        class A(x: Int)
        class B extends A({
          def p(x: Int) = x + 1
          p(1)
        })
        new B 
      }
      

      The stack trace is

      java.lang.VerifyError: (class: Test$B, method: <init> signature: ()V) Expecting to find object/array on stack
      	at Test$.<init>(t5812.scala:8)
      	at Test$.<clinit>(t5812.scala)
      	at Test.main(t5812.scala)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:70)
      	at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:30)
      	at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:138)
      

        Issue Links

          Activity

          Hide
          Paul Phillips added a comment -

          It's a small variation on SI-3832.

          Show
          Paul Phillips added a comment - It's a small variation on SI-3832 .
          Hide
          Hubert Plociniczak added a comment -

          True, I had it today in front of my eyes but didn't connect the dots. Thanks Paul.

          Show
          Hubert Plociniczak added a comment - True, I had it today in front of my eyes but didn't connect the dots. Thanks Paul.

            People

            • Assignee:
              Hubert Plociniczak
              Reporter:
              Scott Morrison
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development