Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groovy-eclipse - confused by annotations on enum values #278

Closed
simonmarshall opened this issue Apr 4, 2017 · 2 comments
Closed

Groovy-eclipse - confused by annotations on enum values #278

simonmarshall opened this issue Apr 4, 2017 · 2 comments

Comments

@simonmarshall
Copy link

If i place an annotation on an enum value, it doesn't work. It doesn't identify the annotation as a syntax error, but it does mis-highlight it and refuse to import the annotation class (if that is necessary). The same code (when ported) works fine in Java.

Here's how I can reproduce it:

  • download eclipse-jee-neon-3-win32-x86_64.zip
  • run eclipse
  • create new workspace
  • install new software using http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/ and select all and install
  • create new project containing attached source
  • see file A.groovy contains:
    @Target([ElementType.FIELD, ElementType.TYPE]) @Retention(RetentionPolicy.RUNTIME) @interface A { String value() }
  • see file E.groovy contains:
    @A("C") enum E { @A("B") C }
  • see script S.groovy contains:
    println 'Class annotations = ' + E.class.getAnnotations()
    println 'Field annotations = ' + E.class.getField(E.C.name()).getAnnotations()
  • run script and you will see:

Class annotations = [@enumsgroovy.A(value=C)]
Field annotations = []

such that it has not found the annotation on E.C.

src.zip

@eric-milles
Copy link
Member

Can you retest with the latest snapshot?

@simonmarshall
Copy link
Author

simonmarshall commented Apr 7, 2017

Can you retest with the latest snapshot?

fantastic - now works (tested with 2.4.10 and 2.5.0.snapshot) - many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants