1515
1616import java .util .Collections ;
1717
18-
18+ import java . util . Locale ;
1919import java .util .Set ;
20+ import java .util .concurrent .atomic .AtomicReference ;
2021
2122import javax .annotation .processing .Completion ;
2223import javax .annotation .processing .ProcessingEnvironment ;
2728import javax .lang .model .element .Element ;
2829import javax .lang .model .element .ExecutableElement ;
2930import javax .lang .model .element .TypeElement ;
31+ import javax .tools .Diagnostic ;
3032
3133import org .joor .CompileOptions ;
3234import org .joor .Reflect ;
@@ -154,6 +156,7 @@ public SourceVersion getSupportedSourceVersion() {
154156
155157 @ Override
156158 public void init (ProcessingEnvironment processingEnv ) {
159+ processingEnv .getMessager ().printMessage (Diagnostic .Kind .NOTE , "running " + getClass ().getName ());
157160 }
158161
159162 @ Override
@@ -179,10 +182,16 @@ public Iterable<? extends Completion> getCompletions(Element element, Annotation
179182 * see https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html
180183 */
181184 @ Test
182- public void testProcOnly () {
185+ public void testProcOnlyWithDiagnostics () {
186+ AtomicReference <String > diagMessage = new AtomicReference <>();
183187 Object result = Reflect .compile ("p.D" , "package p; public class D extends B {} class B {}" ,
184- new CompileOptions ().options ("-proc:only" ).processors (new AProcessor ()));
188+ new CompileOptions ().options ("-proc:only" )
189+ .processors (new AProcessor ())
190+ .withDiagnosticListener (diagnostic -> {
191+ diagMessage .set (diagnostic .getMessage (Locale .ENGLISH ));
192+ }));
185193 assertNull (result );
194+ assertNotNull (diagMessage .get ());
186195 }
187196
188197}
0 commit comments