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

@CompileStatic calls wrong newInstance method.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.4.10
    • 2.4.13
    • None

    Description

      import groovy.transform.CompileStatic
      
      class Foo {
          static Foo newInstance(Long v) {
              return new Foo()
          }
      }
      
      @CompileStatic   //crash only caused by this CompileStatic
      class TestGroovy {
          static void main(String ... args) {
              def a = Foo.newInstance(123)  //when @CompileStatic, this calls DefaultGroovyMethods.newInstance
              println a
          }
      }
      
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              chice Xiaoguang WANG
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: