Affects PMD Version: 7.18
Make sure, to test with the latest PMD version.
Description:
Parser fails to parse valid expression with the new switch syntax when it's used in a super call of a constructor.
Exception Stacktrace:
[ERROR] testGitHubBug()#null ParseException Parse exception in file '/Users/sergey.tyurin/src/pmd/pmd/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug.java' at line 10, column 10: Encountered "(".
Was expecting one of:
"." ...
"::" ...
Code Sample demonstrating the issue:
import java.util.concurrent.Callable;
class A {
A(Callable<Boolean> x) {}
}
class B extends A {
private static final int X = 1;
B() {
super(
() -> {
return switch (1) {
case X -> true;
default -> false;
};
}
);
}
}
Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
- Check out styurin@babe074
./mvnw clean verify. Fails with a parsing exception, not use test error.
Affects PMD Version: 7.18
Make sure, to test with the latest PMD version.
Description:
Parser fails to parse valid expression with the new switch syntax when it's used in a super call of a constructor.
Exception Stacktrace:
Code Sample demonstrating the issue:
Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
./mvnw clean verify. Fails with a parsing exception, not use test error.