Why are my groovy listings not working or even not compiling?

I am running Groovy Version: 1.7.0 JVM: 1.6.0_17

(Update - I just upgraded to 1.7.1 and got the same errors!)

I tried using enums using the exact syntax from the Groovy documentation, and every time I see a compilation error:

Groovy:The class java.lang.Enum refers to the class java.lang.Enum and uses 1 parameters, but the referred class takes no parameters

Any ideas on what's going on?

For example: this code will not compile or run, and the error above appears.

enum VehicleStatus { OFF, IDLING, ACCELERATING, DECELARATING }

class Vehicle
{
    Long id
    Long version
    VehicleStatus status
}
+3
source share
3 answers

This might be a bug with the Netbeans IDE: http://netbeans.org/bugzilla/show_bug.cgi?id=189275

I found that after running Clean, the error is saved in the editor, but it actually does not cause a run-time problem.

+1

I just tried it. I get the same error as you, if only the code in the script matches yours. However, it goes away after adding the line

def a = new Vehicle(id: 1, version: 0, status: VehicleStatus.IDLING) 

I am using Groovy 1.7.1 and also running a script from NetBeans 6.8.

0
source

Source: https://habr.com/ru/post/1735763/


All Articles