Ron Shapiro ronshapiro at google.com
Fri Jul 19 20:09:20 UTC 2019

In a number of processors that I've implemented, I've wanted to wrap a
Messager instance to track if I've printed a diagnostic with an ERROR kind
so I can know to abort any generation if the inputs are invalid.

There are a number of ways to do this, but what always feels like would be
most natural is to be able to create a ForwardingMessager of some sort. I
think the easiest way to do this is if there were already an
AbstractMessager class, so I wanted to propose adding it to the JSR 269

The implementation would be rather simple, just telescoping the calls with
`null` arguments, just like JavacMessager works.

public void printMessage(Diagnostic.Kind kind, CharSequence msg) {
    printMessage(kind, msg, null);

public void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e)
    printMessage(kind, msg, e, null);

// etc

Alternatively, the methods could become default methods, which is probably
the easiest change and doesn't introduce a new type.

Does something like this make sense?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20190719/6c6cad99/attachment.html>

More information about the compiler-dev mailing list