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

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.3.9, 2.4.0
    • Fix Version/s: 2.3.10, 2.4.1
    • Component/s: Static compilation
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: