Skip to content

Commit

Permalink
[WIP] fix some warnings
Browse files Browse the repository at this point in the history
Signed-off-by: David Thompson <davthomp@redhat.com>
  • Loading branch information
datho7561 committed Jan 29, 2024
1 parent 8f9bd0a commit f60cfc9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void testGuardedPattern() throws CoreException {
SwitchCase caseInteger = (SwitchCase) statements.get(0);
Expression guardedPattern = (Expression)caseInteger.expressions().get(0);
assertEquals("Guarded Pattern", ASTNode.GUARDED_PATTERN, guardedPattern.getNodeType());
Pattern pattern = ((GuardedPattern)guardedPattern).getPattern();
Pattern pattern = ((GuardedPattern)guardedPattern).patterns().get(0);
SingleVariableDeclaration patternVariable = ((TypePattern)pattern).getPatternVariable();
assertEquals("Type Pattern Integer", "Integer", patternVariable.getType().toString());
SingleVariableDeclaration patternVariable2 = ((TypePattern)pattern).patternVariables().get(0);
Expand All @@ -193,7 +193,7 @@ public void testGuardedPattern() throws CoreException {
SwitchCase caseString = (SwitchCase) statements.get(2);
guardedPattern = (Expression)caseString.expressions().get(0);
assertEquals("Guarded Pattern", guardedPattern.getNodeType(), ASTNode.GUARDED_PATTERN);
pattern = ((GuardedPattern)guardedPattern).getPattern();
pattern = ((GuardedPattern)guardedPattern).patterns().get(0);
patternVariable = ((TypePattern)pattern).getPatternVariable();
assertEquals("Type Pattern String", "String", patternVariable.getType().toString());
patternVariable2 = ((TypePattern)pattern).patternVariables().get(0);
Expand Down Expand Up @@ -566,6 +566,6 @@ public void testRecordPattern004() throws CoreException {
SwitchCase caseStmt = (SwitchCase) switchStatements.get(0);
assertEquals("incorrect type", ASTNode.GUARDED_PATTERN, ((Expression)caseStmt.expressions().get(0)).getNodeType());
GuardedPattern guardedPattern = (GuardedPattern)caseStmt.expressions().get(0);
assertEquals("There should be 1 Record Pattern", ASTNode.RECORD_PATTERN , guardedPattern.getPattern().getNodeType());
assertEquals("There should be 1 Record Pattern", ASTNode.RECORD_PATTERN , guardedPattern.patterns().get(0).getNodeType());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ public boolean match(GuardedPattern node, Object other) {
return false;
}
GuardedPattern o = (GuardedPattern) other;
return safeSubtreeMatch(node.getPattern(), o.getPattern())
return safeSubtreeListMatch(node.patterns(), o.patterns())
&& safeSubtreeMatch(node.getExpression(), o.getExpression());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @noreference This class is not intended to be referenced by clients.
*/

@SuppressWarnings("rawtypes")
@SuppressWarnings({"rawtypes", "unchecked"})
public class GuardedPattern extends Pattern{

GuardedPattern(AST ast) {
Expand Down Expand Up @@ -249,7 +249,7 @@ public Pattern getPattern() {
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @since 3.37
*/
public List patterns() {
public List<Pattern> patterns() {
supportedOnlyIn21();
return this.patterns;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public boolean visit(RecordPattern node) {

@Override
public boolean visit(GuardedPattern node) {
handleTokenAfter(node.getPattern(), TokenNameRestrictedIdentifierWhen, true, true);
handleCommas(node.patterns(), false, true);
return true;
}

Expand Down

0 comments on commit f60cfc9

Please sign in to comment.