Reputation: 13585
I have Groovy-Eclipse for Juno but my Groovy classes are not able to recognize any Annotations. I am getting Groovy:class Translation is not an annotation in @Translation
.Or Groovy:class Override is not an annotation in @Override
For example:
import somewhere.Translation
@Translation(translationContext = TranslationContext.SOMETHING)
class SOMECLASS extends SOMETHING {
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Translation {
Here all the annotations @Target,@Retention
and @interface
are compiling fine for Translation
I have all the jars included in my project lib. What am I missing here?
Upvotes: 1
Views: 3103
Reputation: 105
I have faced the same issue. My Eclipse IDE underlines the annotations but the code works fine! Just try to run it. That's it for me. Hope that's it for you as well)
Upvotes: 0
Reputation: 28757
Looks like you have your project/workspace configured for Java 1.4 or earlier. Annotations are not being recognized since the source level doesn't allow them.
Go to Project -> Properties -> Java Compiler. Enable project settings and set the compliance level to 1.5 or later.
Upvotes: 1
Reputation: 12538
import java.lang.annotation.*;
?translationContext
defined like a method in the @interface
?Translation
in the classpath, and no duplicates are there.This code works for me in the groovy console :
@Translation
class A{
def meth = { print "HzzzI" }
}
@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)
public @interface Translation {
}
A a = new A();
a.meth()
Upvotes: 0