首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Eclipse在批注处理器中在哪里打印它输出的消息?

Eclipse在批注处理器中在哪里打印它输出的消息?
EN

Stack Overflow用户
提问于 2013-01-24 06:45:25
回答 1查看 1.7K关注 0票数 7

下面的批注处理器ComplexityProcessor在编译类SimpleAnnotationTest时输出的消息,Eclipse Juno在哪里打印?编译后,我希望在控制台窗格中看到消息,但它是空的。

代码语言:javascript
复制
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" );
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-01-24 23:37:58

我在Eclipse .metadata/.log中找到了输出

代码语言:javascript
复制
!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
票数 9
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14490796

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档