Integrated: 8273157: Add convenience methods to Messager

Joe Darcy darcy at openjdk.java.net
Wed Sep 1 20:31:36 UTC 2021


On Tue, 31 Aug 2021 05:06:38 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Hello,
> 
> Please review the addition of a half dozen convenience methods to Messager to allow code like
> 
>     m.printError("Error message")
> 
> rather than
> 
>     m.printMessage(Kind.ERROR, "Error message")
> 
> For each of notes, warnings, and errors, two methods are added: one taking a message, the second taking a message and an element. There are other overloads of the printMessage method with additional arguments, but they are less commonly used and weren't judged to merit dedicated convenience methods.
> 
> The changeset also refactors ~125 of ~150 call sites of printMessage in the langtools regression tests to use the new methods. The updated tests (or tests using the updated files) all pass. I became more convinced of the utility of the new methods after using them in the refactoring.
> 
> I'll run a script to update the copyright years before any integration.
> 
> CSR for review: https://bugs.openjdk.java.net/browse/JDK-8273160

This pull request has now been integrated.

Changeset: 2f01a6f8
Author:    Joe Darcy <darcy at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/2f01a6f8b6c0bc08c6e3b7ea279d3826f451607f
Stats:     445 lines in 87 files changed: 91 ins; 86 del; 268 mod

8273157: Add convenience methods to Messager

Reviewed-by: jjg

-------------

PR: https://git.openjdk.java.net/jdk/pull/5309


More information about the compiler-dev mailing list