Skip to content

Commit f8220bf

Browse files
committed
ClassCastException when ctrl+hover over a 'case' literal
Fixes #1764
1 parent 6755dba commit f8220bf

File tree

1 file changed

+8
-3
lines changed
  • org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/dom

1 file changed

+8
-3
lines changed

org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/dom/ASTFlattener.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2023 IBM Corporation and others.
2+
* Copyright (c) 2000, 2024 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -2017,8 +2017,13 @@ public boolean visit(TypeParameter node) {
20172017

20182018
@Override
20192019
public boolean visit(TypePattern node) {
2020-
if (ASTHelper.isPatternSupported(node.getAST())) {
2021-
node.getPatternVariable().accept(this);
2020+
AST ast= node.getAST();
2021+
if (ASTHelper.isPatternSupported(ast)) {
2022+
if (ast.apiLevel() >= ASTHelper.JLS22) {
2023+
node.getPatternVariable2().accept(this);
2024+
} else {
2025+
node.getPatternVariable().accept(this);
2026+
}
20222027
}
20232028
return false;
20242029
}

0 commit comments

Comments
 (0)