Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.4
-
None
-
MacOSX Snow Leopard, Groovy 1.7.4, Java 1.6.0_17
Description
Spotted this problem when upgrading Griffon to Groovy 1.7.4.
Start with a base contract defined in java
import java.util.List; public interface IApp { void event(String name); void event(String name, List params); }
Implement said contract in Groovy
class BaseApp implements IApp { private IApp appDelegate BaseApp(IApp app) { this.appDelegate = app } void event(String name, List params = []) { // empty } }
Now create a Groovy class where the previous will be used as delegate
class RealApp { @Delegate BaseApp _base RealApp() { _base = new BaseApp(this) } }
Compile the code
groovyc IApp.java BaseApp.groovy RealApp.groovy
With Groovy 1.7.3 you get the following method signatures
$ javap BaseApp | grep event public void event(java.lang.String, java.util.List); public void event(java.lang.String); $ javap RealApp | grep event public void event(java.lang.String); public void event(java.lang.String, java.util.List);
However 1.7.4 fails to recognize that the second argument to event() has a default value
$ groovy -version Groovy Version: 1.7.4 JVM: 1.6.0_17 $ groovyc IApp.java BaseApp.groovy RealApp.groovy org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: RealApp.groovy: 1: Can't have an abstract method in a non-abstract class. The class 'RealApp' must be declared abstract or the method 'void event(java.lang.String)' must be implemented. @ line 1, column 1. class RealApp { ^ 1 error
Attachments
Attachments
Issue Links
- relates to
-
GROOVY-3683 groovyc can't joint compile a Java class that uses a delegate method from a Groovy class with an @Delegate property annotation
- Open