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

Calling a non-static outer class method from a static class passes STC

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.6
    • 2.4.7
    • Static Type Checker
    • None

    Description

      Example:

      @groovy.transform.TypeChecked
      class Foo {
          def bar() { 2 }
      
          static class Baz {
              def doBar() {
                  bar()
              }
          }
      }
      new Foo.Baz().doBar()
      

      The doBar() call in the method above results in a MissingMethodException. If the code is statically compiled rather than just type checked, a VerifyError occurs instead.

      The usage of ClassNode#isStaticClass() within StaticTypeCheckingVisitor#findMethod(ClassNode, String, ClassNode...) seems to be responsible, as the former does not return true when the receiver is a static class.

      Attachments

        Activity

          People

            shils Shil Sinha
            shils Shil Sinha
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: