Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.1
-
None
-
sargis@sargis:~> uname -a
Linux sargis.webbfontaine.fr 2.6.37.6-0.5-desktop #1 SMP PREEMPT 2011-04-25 21:48:33 +0200 x86_64 x86_64 x86_64 GNU/Linux
sargis@sargis:~> java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
sargis@sargis:~> groovy -version
Groovy Version: 1.8.1 JVM: 1.6.0_26
sargis@sargis:~>
sargis@sargis :~> uname -a Linux sargis.webbfontaine.fr 2.6.37.6-0.5-desktop #1 SMP PREEMPT 2011-04-25 21:48:33 +0200 x86_64 x86_64 x86_64 GNU/Linux sargis@sargis :~> java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode) sargis@sargis :~> groovy -version Groovy Version: 1.8.1 JVM: 1.6.0_26 sargis@sargis :~>
Description
Hi I have following code which was ok for groovy 1.8.0 but after updating to groovy 1.8.1 I have failed compilation
MessagingTask.groovy
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 + '}'; } }
MessagingTaskDatabase.groovy
class MessagingTaskDatabase { public List<MessagingTask<OutMessage>> loadOutMessage() { return new ArrayList<MessagingTask<OutMessage>>(); } }
SomeClient.java
List<MessagingTask<OutMessage>> messagingTasks = taskDatabase.loadOutMessage();
And the compile log:
[mkdir] Created dir: /home/sargis/projects/twm_v3/trunk/twm_v3/accounting/Server/classes [groovyc] Compiling 185 source files to /home/sargis/projects/twm_v3/trunk/twm_v3/accounting/Server/classes [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: [groovyc] Compile error during compilation with javac. [groovyc] /home/sargis/projects/twm_v3/trunk/twm_v3/accounting/Server/src/com/webbfontaine/twm/accounting/epaylog/scheduler/SendingScheduler.java:46: incompatible types [groovyc] found : java.util.List<com.webbfontaine.twm.accounting.epaylog.emess.task.MessagingTask> [groovyc] required: java.util.List<com.webbfontaine.twm.accounting.epaylog.emess.task.MessagingTask<com.webbfontaine.twm.accounting.epaylog.emess.core.OutMessage>> [groovyc] List<MessagingTask<OutMessage>> messagingTasks = taskDatabase.loadOutMessage(); [groovyc] ^ [groovyc] Note: Some input files use unchecked or unsafe operations. [groovyc] Note: Recompile with -Xlint:unchecked for details. [groovyc] 1 error [groovyc] [groovyc] [groovyc] 1 error
But if I remove generic type parameters from return and compilation is ok
public List loadOutMessage() { return new ArrayList<MessagingTask<OutMessage>>(); }