groovy

the abstract method test seems not to know covariant returns types yet

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1-rc-2
  • Fix Version/s: 1.1-rc-3
  • Component/s: class generator
  • Labels:
    None
  • Environment:
    JDK6u3, WinXP
  • Number of attachments :
    0

Description

from mailing list:

Hi all,

Executing the following code, Groovy will complain:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script2: 3: Can't have an abstract method in a non-abstract class. The class 'CallableTask' must be declared abstract or the method 'java.lang.Object call()' must be implemented.
@ line 3, column 1.
1 error

<groovy>
import java.util.concurrent.*

class CallableTask implements Callable<String> {
public String call() { return new Date().toString() }
}
</groovy>

but in Java, the code can be compiled with no problem.

Could you some one tell me why?

Thanks in advance,
Daniel.Sun

Activity

Hide
blackdrag blackdrag added a comment -

looks like the code just ignored interfaces. I corrected that.

Show
blackdrag blackdrag added a comment - looks like the code just ignored interfaces. I corrected that.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: