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

Compound assignments to "mixed type" properties don't type-check

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • Static Type Checker
    • None

    Description

      class Foo {
        // "mixed type" property
        String getBar() {}
        void setBar(Object bar) {}
      }
      
      // assume script is @TypeChecked
      
      def foo = new Foo()
      
      // type checks
      foo.bar = foo.bar + "def"
      
      // does not type check
      // [Static type checking] - Cannot find matching method java.lang.Object#plus
      foo.bar += "def"
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            pniederw Peter Niederwieser
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: