Eclipse JunoComplexityProcessor
は、クラスをコンパイルするときに次のアノテーションプロセッサが出力するメッセージをどこに出力しますSimpleAnnotationTest
か?コンパイル後、コンソールペインにメッセージが表示されるはずですが、空です。
public @interface Complexity
{
public enum Level
{
VERY_SIMPLE,
SIMPLE,
MEDIUM,
COMPLEX,
VERY_COMPLEX;
}
Level value() default Level.MEDIUM;
}
@SupportedAnnotationTypes("com.intelerad.annotations.Complexity")
@SupportedSourceVersion(SourceVersion.RELEASE_6)
public class ComplexityProcessor extends AbstractProcessor
{
@Override
public boolean process( final Set<? extends TypeElement> annotations,
final RoundEnvironment environment )
{
for ( final Element element : environment.getElementsAnnotatedWith( Complexity.class ) )
{
final Complexity complexity = element.getAnnotation( Complexity.class );
String message =
"Annotation found in " + element.getSimpleName() + " with complexity " +
complexity.value();
// Where does Eclipse print this message?
processingEnv.getMessager().printMessage( Diagnostic.Kind.NOTE, message );
}
return true;
}
}
@Complexity(Level.VERY_SIMPLE)
public class SimpleAnnotationTest
{
@Complexity()
public void theMethod()
{
System.out.println( "console output" );
}
}