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

Improve error message when using generic ClassNodes in ASTT

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.0.5
    • 4.0.12
    • Compiler
    • None

    Description

      When mistakenly using a shared instance of a ClassNode that has generics applied, the compiler (helpfully!) produces this error:

      transform used a generics containing ClassNode com.example.Resource<com.example.FooAttributes> for the super class com.example.FooResource 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.
      

      However, there is no explanation of how to create the "new ClassNode", and I couldn't find anything in the API that made the error go away. It would be helpful to ASTT neophytes if the error message specified the method call(s) suitable for this operation.

      Attachments

        Activity

          People

            emilles Eric Milles
            chrylis Christopher Smith
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: