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

Add @TupleConstructor(includeFields = true) to a class implements a trait which contains properties will cause NPE

    XMLWordPrintableJSON

Details

    Description

      Hi, guys:

      I got NPE when I wrote the following codes:

      Groovy Script
      trait T {
      
          def x = 'abc'
      
      }
      
      
      import groovy.transform.TupleConstructor
      
      @TupleConstructor(includeFields = true)
      class A implements T {
          def a
          private b
      }
      
      
      assert 'ABC' == new A().x.toUpperCase()
      
      

      I found that it will works well if I remove (includefields = true).

      Attachments

        Activity

          People

            emilles Eric Milles
            digitarts Huabin Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: