Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Eclipse print messages that it outputs within an annotation processor?

Where does Eclipse Juno print the messages that the following annotation processor, ComplexityProcessor, outputs when it compiles class SimpleAnnotationTest? After compilation, I expect to see the messages in the Console pane, but it is empty.

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" );
    }
}
like image 228
Derek Mahar Avatar asked Jan 23 '13 22:01

Derek Mahar


Video Answer


1 Answers

I found the output in the Eclipse .metadata/.log:

!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2013-01-23 16:45:35.102
!MESSAGE Annotation found in SimpleAnnotationTest with complexity VERY_SIMPLE

!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2013-01-23 16:45:35.102
!MESSAGE Annotation found in theMethod with complexity MEDIUM
like image 197
Derek Mahar Avatar answered Sep 30 '22 04:09

Derek Mahar