google / google/error-prone

`PlaceholderUnificationVisitor` using javac 21 API

Open
#4,846 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

In f093681 the `PlaceholderUnificationVisitor` class was modified to call `CaseTree.getGuard()`:

https://github.com/google/error-prone/blob/cc12b63b439df353672c89d08acba3baa4c8b43f/core/src/main/java/com/google/errorprone/refaster/PlaceholderUnificationVisitor.java#L665

But, this API was only introduced in JDK 21:

https://github.com/openjdk/jdk/blob/9477c705c0bd5ce2d445abb5ca44d46656fc315f/src/jdk.compiler/share/classes/com/sun/source/tree/CaseTree.java#L78-L84

So I think this code will fail if it is run on JDK 17 (which Error Prone still supports). Maybe this wasn't detected on CI due to missing test coverage?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.