Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10218

BUG! exception in phase 'instruction selection' when non-existent method called

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.8, 4.0.0-beta-1, 3.0.9
    • 4.0.0-beta-2, 3.0.10
    • None
    • None
    • linux

    Description

      My file "ite.groovy":

      import groovy.transform.TypeChecked
      interface A {}
      @TypeChecked
      trait B implements A {
        def foo() {
          bar()
        }
      }
      class C implements B {}
      println new C().foo()
      

      Fails to compile (as it should) but does not give a helpful error message:

      $ groovy ite.groovy 
      Caught: BUG! exception in phase 'instruction selection' in source unit '<my path>/ite.groovy' ClassNode#getTypeClass for A called before the type class is set
      BUG! exception in phase 'instruction selection' in source unit '<my path>/ite.groovy' ClassNode#getTypeClass for A called before the type class is set
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      Remove the @TypeChecked and it gives a coherent and useful error. 

      Attachments

        Activity

          People

            paulk Paul King
            tofor Ian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: