Annotation Processor Completions [message #896644] |
Thu, 19 July 2012 09:16 |
jhairtt eclipse_test Messages: 1 Registered: July 2012 |
Junior Member |
|
|
Hi,
I've implemented an annotation processor extending AbstractProcessor. Just for testing I implemented getCompletion as follows:
@Override
public Iterable<? extends Completion> getCompletions (Element element,
AnnotationMirror annotation,
ExecutableElement member,
String userText)
{
return Arrays.asList(of("3"),
of("7"),
of("31"),
of("127"),
of("8191"),
of("131071"),
of("524287"),
of("2147483647"));
}
See docs.oracle.com/javase/6/docs/api/javax/annotation/processing/Processor.html
The annotation I want to complete is the following:
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface MersennePrime
{
int value();
}
My expectation was that when I type:
@MarsennePrime(1
and then ctrl+space this will provide an auto-completion list with 127, 131071 (see getCompletions above).
However no completion is shown whatsoever. I'm using Eclipse Juno (I tested it with indigo with same result).
Using ProcessingEnvironment.getMesseger ().printMessage (...) to show warnings in the IDE works, it's only completion what is not giving me the expected results. (I've included the annotation processor in the option Java Compiler->Annotation Processing->Factory Path).
Any ideas what could be the reason completion of annotations is not working in my case?
Thanks in advance,
|
|
|
Powered by
FUDForum. Page generated in 0.04807 seconds