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

TypeChecker confuses attribute with field if getter has different type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.5
    • 2.1.6
    • Static compilation
    • None

    Description

      I noticed this today when trying to use @CompileStatic with some code that uses java.awt.Dimension which has a public double getWidth() and public int width.

      I have a method that expects an int parameter and pass it dim.@width but the static compilation reports Cannot find matching method Thing#callee(double). Please check if the declared type is right and if the method exists.

      I have attached a test (well, a piece of code that should compile).

      This may be a regression of GROOVY-5704.

      Attachments

        Activity

          People

            melix Cédric Champeau
            robfletcher Rob Fletcher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: