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

@CompileStatic calls wrong newInstance method.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.4.10
    • Fix Version/s: 2.4.13
    • Labels:
      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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: