package org.ejc.AnnotationProcessorMessagerBug; import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Messager; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.tools.Diagnostic.Kind; /** * Sample annotation provider to expose the bug */ @SupportedAnnotationTypes("org.ejc.AnnotationProcessorMessagerBug.SampleAnnotation") @SupportedSourceVersion(SourceVersion.RELEASE_6) public class AnnotationProcessor extends AbstractProcessor { public boolean process(Set annotations, RoundEnvironment roundEnv) { Messager messager = processingEnv.getMessager(); messager.printMessage(Kind.NOTE, "Note: This message will not appear."); messager.printMessage(Kind.OTHER, "Other: This message will not appear."); messager.printMessage(Kind.WARNING, "Warning: This message will not appear."); messager.printMessage(Kind.MANDATORY_WARNING, "Mandatory Warning: This message will appear and cause the build to fail."); messager.printMessage(Kind.ERROR, "Error: This message will appear appear and cause the build to fail."); return true; } }