Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.6-beta-1
-
Fix Version/s: 1.5.7, 1.6-beta-2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Given these Java interfaces:
import java.util.List; public interface Base { List foo(); }
import java.util.ArrayList; public interface Child extends Base { ArrayList foo(); }
Java allows the return type for methods to be the most specified or a derived type:
import java.util.ArrayList; public class JavaChildImpl implements Child { public ArrayList foo() { return null; } }
But compiling this Groovy script:
class GroovyChildImpl implements Child { public ArrayList foo() { return null } }
yields:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, GroovyChildImpl.groovy: 2: the return type is incompatible with java.util.List foo() in Base.
Node: org.codehaus.groovy.ast.MethodNode. At [2:5] @ line 2, column 5.
public ArrayList foo() {
^
1 error
Attached patch fixes this problem.
Activity
blackdrag blackdrag
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Fix Version/s | 1.6-beta-2 [ 14261 ] |
Paul King
made changes -
| Assignee | Paul King [ paulk ] | Jochen Theodorou [ blackdrag ] |
blackdrag blackdrag
made changes -
| Status | Open [ 1 ] | Closed [ 6 ] |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Status | Closed [ 6 ] | Reopened [ 4 ] |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Attachment | groovy2829_additional.patch [ 34599 ] |
Paul King
made changes -
| Resolution | Fixed [ 1 ] | |
| Status | Reopened [ 4 ] | Resolved [ 5 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |