History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GROOVY-2803
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Daniel.Sun
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

annotations definition in groovy

Created: 02/May/08 11:21 PM   Updated: 08/May/08 11:40 AM
Component/s: None
Affects Version/s: 1.6-beta-1
Fix Version/s: 1.5.7, 1.6-beta-2

Time Tracking:
Not Specified


 Description  « Hide
the following code can not execute properly, exceptions:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script12: 2: Constructor not permitted within an interface. at line: 2 column: 5. File: Script12 @ line 2, column 5.
1 error

it seems that the method hello has the same name with annotation hello and groovy mistake method hello as a constructor

@interface hello {
    String hello()
}

println "test"


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jochen Theodorou - 03/May/08 11:20 AM
when you try this in Java, does it compile? I doubt it.

Daniel.Sun - 04/May/08 02:49 AM
Hi Jochen,

I tried the code in the groovy console

Cheers,
Daniel.Sun


Jochen Theodorou - 08/May/08 11:40 AM
the problem happens also for normal interfaces. The code around AntlrParserPlugin.java:558 does not check if the return type is used. In that case it is of course no constructor. Probably "def" has no representation, I need to check that, but if it has, then the check should be move to the return type processing. Or maybe removing the test altogether is best? I need to check the grammar to see if the return type is really optional... I think it should not be that way. If it is not optional, then the grammar part would fail already, no need for this test then.