Skip to content

Commit

Permalink
Fix ASTHelpers#isRuleKind on JDK versions without `CaseTree#getCase…
Browse files Browse the repository at this point in the history
…Kind`

Fixes #4479 (comment)

PiperOrigin-RevId: 653615823
  • Loading branch information
cushon authored and Error Prone Team committed Jul 18, 2024
1 parent 81d3127 commit 5c26d0d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,9 @@ private static Method getCaseTreeGetExpressionsMethod() {
* <expression>}.
*/
public static boolean isRuleKind(CaseTree caseTree) {
if (GET_CASE_KIND_METHOD == null) {
return false;
}
Enum<?> kind;
try {
kind = (Enum<?>) GET_CASE_KIND_METHOD.invoke(caseTree);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public void positive() {

@Test
public void negativeStatement() {
assumeTrue(RuntimeVersion.isAtLeast14());
testHelper
.addSourceLines(
"Test.java",
Expand Down

0 comments on commit 5c26d0d

Please sign in to comment.