RFR: 8273157: Add convenience methods to Messager [v2]

Joe Darcy darcy at openjdk.java.net
Wed Sep 1 18:46:14 UTC 2021


> 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

Joe Darcy has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - Update copyrigth years.
 - Update a few more test files.
 - Merge branch 'master' into JDK-8273157
 - 8273157

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/5309/files
  - new: https://git.openjdk.java.net/jdk/pull/5309/files/c7fbe977..af256daf

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5309&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5309&range=00-01

  Stats: 2520 lines in 178 files changed: 1644 ins; 316 del; 560 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5309.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5309/head:pull/5309

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


More information about the compiler-dev mailing list