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

Stub compiler expands generic-inner-class variable declaration incorrectly

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      @Log4j
      abstract class AbstractProcessingQueue<T> extends AbstractAgent {
          ...
      
          protected Queue<ProcessingQueueMember<T>> items
          ...
      
          private class ProcessingQueueMember<E> {
              ...
          }
      }
      

      Produces the following line in AbstractProcessingQueue.java:

      protected java.util.Queue<nz.ac.auckland.digitizer.AbstractProcessingQueue.ProcessingQueueMember<T>> items;
      

      Which produces the following compile error:

      [ERROR] C:\Documents and Settings\Administrator\digitizer\target\generated-sources\groovy-stubs\main\nz\ac\auckland\digitizer\AbstractProcessingQueue.java:[14,96] error: improperly formed type, type arguments given on a raw type
      

      Because ProcessingQueueMember is a non-static nested class of AbstractProcessingQueue and as such is instantiated as a subclass of a given instance of AbstractProcessingQueue, a generic class, the fully-qualified expansion of Queue<ProcessingQueueMember<T>> needs to be java.util.Queue<nz.ac.auckland.digitizer.AbstractProcessingQueue<T>.ProcessingQueueMember<T>>, with the type parameter given to both the inner and outer classes in the declaration.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            guillaume Guillaume Sauthier
            johansensen Alex Fulton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment