mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
Require JDK 17 rather than JDK 11 (#603)
By raising this baseline the project can now use Java 17 language features such as text blocks, switch expressions and `instanceof` pattern matching. The code has been updated to make use of these constructs. Note that the project can still be used by builds that target an older version of Java, as long as those builds are executed using JDK 17+.
This commit is contained in:
committed by
GitHub
parent
1f50772433
commit
433b8b90c0
@@ -106,9 +106,6 @@
|
||||
<version>${project.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
<compilerArgs combine.children="append">
|
||||
<arg>-Xplugin:RefasterRuleCompiler</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -154,8 +154,8 @@ public final class RefasterRuleCollection extends BugChecker implements Compilat
|
||||
String expectedClassName = ruleCollectionUnderTest + "Test";
|
||||
|
||||
for (Tree typeDeclaration : tree.getTypeDecls()) {
|
||||
if (typeDeclaration instanceof ClassTree) {
|
||||
if (!((ClassTree) typeDeclaration).getSimpleName().contentEquals(expectedClassName)) {
|
||||
if (typeDeclaration instanceof ClassTree classTree) {
|
||||
if (!classTree.getSimpleName().contentEquals(expectedClassName)) {
|
||||
state.reportMatch(
|
||||
describeMatch(
|
||||
typeDeclaration,
|
||||
@@ -276,9 +276,10 @@ public final class RefasterRuleCollection extends BugChecker implements Compilat
|
||||
unexpectedMatchesByLineNumber.entries().stream()
|
||||
.map(
|
||||
e ->
|
||||
String.format(
|
||||
"Rule `%s` matches on line %s, while it should match in a method named `test%s`.",
|
||||
e.getValue(), e.getKey(), e.getValue()))
|
||||
"""
|
||||
Rule `%s` matches on line %s, while it should match in a method named \
|
||||
`test%s`."""
|
||||
.formatted(e.getValue(), e.getKey(), e.getValue()))
|
||||
.collect(toImmutableSet()),
|
||||
state);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user