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

error message glitch for LUB

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.1, 2.3.0
    • 5.0.0-alpha-1
    • Static Type Checker
    • None

    Description

      the static compiled script

      def i="d"
      def tmp = {i=1}
      tmp()
      i.MAX_VALUE

      is supposed to give an error message mentioning the open block usage and the LUB, but not this: "No such property: MAX_VALUE for class: java.lang.String"
      Using toUpperCase() instead of MAX_VALUE for example reports the correct message:
      A closure shared variable [i] has been assigned with various types and the method [toUpperCase()] does not exist in the lowest upper bound of those types: [java.io.Serializable <? extends java.lang.Object>]. In general, this is a bad practice (variable reuse) because the compiler cannot determine safely what is the type of the variable at the moment of the call in a multithreaded context.

      Attachments

        Activity

          People

            emilles Eric Milles
            blackdrag Jochen Theodorou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: