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

Groovy stub generator generate invalid file for return value with generic type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.7
    • None
    • Ant integration
    • None

    Description

      Hi I migrated to 1.8.7 from 1.8.6 and now have problem with groovy stub generator, here is my class

       
      class MessagingTask<T extends Serializable> {
      
        private static final long serialVersionUID = -5533069690405593263L;
      
        Long id
        String messageId
        String inDestination
        String outDestination
        MessagingTaskType messageType
        T messagePayload
      
        public String toString() {
          return "Task{" +
                  "id=" + id +
                  ", messageId='" + messageId + '\'' +
                  ", inDestination='" + inDestination + '\'' +
                  ", outDestination='" + outDestination + '\'' +
                  ", messageType='" + messageType + '\'' +
                  ", messagePayload=" + messagePayload +
                  '}';
        }
      }
      

      and here is ant error:

      groovy.compile:
      [mkdir] Created dir: /home/sargis/projects/twm3.git/modules/accounting/Server/classes
      [groovyc] Compiling 186 source files to /home/sargis/projects/twm3.git/modules/accounting/Server/classes
      [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      [groovyc] Compile error during compilation with javac.
      [groovyc] warning: [options] bootstrap class path not set in conjunction with -source 1.6
      [groovyc] /tmp/groovy-generated-5697683262775722553-java-source/com/webbfontaine/twm/accounting/epaylog/emess/task/MessagingTask.java:28: error: incompatible types
      [groovyc] public T getMessagePayload()

      { return (java.io.Serializable)null;}

      [groovyc] ^
      [groovyc] required: T
      [groovyc] found: Serializable
      [groovyc] where T is a type-variable:
      [groovyc] T extends Serializable declared in class MessagingTask
      [groovyc] Note: /home/sargis/projects/twm3.git/modules/accounting/Server/src/com/webbfontaine/twm/accounting/epaylog/repository/request/RequestDatabase.java uses or overrides a deprecated API.
      [groovyc] Note: Recompile with -Xlint:deprecation for details.
      [groovyc] Note: Some input files use unchecked or unsafe operations.
      [groovyc] Note: Recompile with -Xlint:unchecked for details.
      [groovyc] 1 error
      [groovyc] 1 warning
      [groovyc]
      [groovyc]
      [groovyc] 1 error

      BUILD FAILED

      also want to mention that I was able to compile my project with IntelliJ groovy compiler. Thanks in advance.

      Attachments

        Activity

          People

            Unassigned Unassigned
            armsargis Sargis Harutyunyan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: