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

Static compilation requires casting inside instanceof check

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.12
    • Fix Version/s: 2.4.13
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      macOS JDK 1.8

      Description

      There are many times I find myself having to cast variables directly inside an instanceof Class check.

      In addition, I have found a specific problem with a generic <T extends SomeClass> where a method in the class that returns T, Groovy believes a collection is being returned. This is the line in question: https://github.com/grails/gorm-graphql/blob/ea6887bef0ced75d9cc0d01dc7b94d4fc0520266/core/src/main/groovy/org/grails/gorm/graphql/fetcher/impl/EntityDataFetcher.groovy#L45

      The goal of this issue is to have the following codebase compile without changes.

      git clone -b broken_compilation https://github.com/grails/gorm-graphql

      Attempt to compile with ./gradlew clean classes

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                Schlogen James Kleeh
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: