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

Generic Traits and SAM type coercion

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0-beta-1, 2.3.0-rc-2
    • Fix Version/s: 2.3.10, 2.4.0-rc-1
    • Component/s: Compiler
    • Labels:
      None

      Description

      The following code:

      trait GPredicate<T> {
          abstract boolean test( T t )
      }
      
      GPredicate<Integer> p = { Integer n -> n > 1 }
      

      Results in an exception:

      A transform used a generics containing ClassNode GPredicate <T extends java.lang.Object -> java.lang.Object> for the super class GPredicate$TraitAdapter directly. You are not supposed to do this. Please create a new ClassNode referring to the old ClassNode and use the new ClassNode instead of the old one. Otherwise the compiler will create wrong descriptors and a potential NullPointerException in TypeResolver in the OpenJDK. If this is not your own doing, please report this bug to the writer of the transform.
       at line: -1, column: -1
      

        Attachments

          Activity

            People

            • Assignee:
              melix C├ędric Champeau
              Reporter:
              tim_yates Tim Yates
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: