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

TypeChecker confuses attribute with field if getter has different type

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.5
    • Fix Version/s: 2.1.6
    • Component/s: Static compilation
    • Labels:
      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

            • Assignee:
              melix C├ędric Champeau
              Reporter:
              robfletcher Rob Fletcher
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: