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

NPE in TypeResolver when access$XXX method generated for a method with generic types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.3.9, 2.4.0
    • 2.3.10, 2.4.1
    • Static compilation
    • None

    Description

      If a bridge method is generated for a method that uses generic types defined in a super class or interface, then the compilation will succeed, but trying to use the generated class will fail with a NPE in TypeResover.

      For example:

      public class BaseGeneric<T> {
              protected boolean foo(T t) {
                  true
              }
      }
      
      // ...
      
      @groovy.transform.CompileStatic
      class Ext extends BaseGeneric<Integer> {
      
          int doSomething() {
              def c = {
                  foo(123) // a bridge method is generated (access$...)
              }
              c.call()?1:0
          }
      }
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: