typetools / typetools/checker-framework

javac API change in Java 25 - Log.DiagnosticHandler

Open
#7,039 0 comments 0 reactions 1 assignee View on GitHub

@smillst is already working on this.

Since Apr 14, 2025.

Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

The internal javac Log.DiagnosticHandler API changes in Java 25: https://github.com/openjdk/jdk/commit/4890b74c048a1472b87687294c316ecfb324e4ba

This affects code in javacutil/src/main/java/org/checkerframework/javacutil/Resolver.java

https://github.com/typetools/checker-framework/blob/039b405c5d08c22324dbce3d45cfdd0ece567baa/javacutil/src/main/java/org/checkerframework/javacutil/Resolver.java#L241C5-L241C26

The diagnostic handler implementations switch from being static member classes to non-static inner classes, so e.g. new Log.DiscardDiagnosticHandler(log) needs to change to log. new DiscardDiagnosticHandler(log). Calling the constructor reflectively works with both versions, since either way it takes one argument for the log, whether that's the explicit parameter in Java < 25 or the synthetic enclosing instance parameter in Java >= 25.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.