Skip to content

Commit 1721d1a

Browse files
committed
Upgrade Checkstyle to 9.3 (#83314)
Checkstyle 9.3 has been released, and contains a fix for the memory problems we saw in previous versions. Upgrade to this version. Note that the IDEA config has also been updated, but the plugin doesn't yet have 9.3 as an option according to the release notes. This shouldn't be a problem.
1 parent a57f929 commit 1721d1a

File tree

5 files changed

+13
-17
lines changed

5 files changed

+13
-17
lines changed

.idea/checkstyle-idea.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-conventions/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ dependencies {
6464
api 'org.apache.maven:maven-model:3.6.2'
6565
api 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
6666
api 'org.apache.rat:apache-rat:0.11'
67-
compileOnly "com.puppycrawl.tools:checkstyle:8.45.1"
67+
compileOnly "com.puppycrawl.tools:checkstyle:9.3"
6868
api('com.diffplug.spotless:spotless-plugin-gradle:6.0.0') {
6969
exclude module: "groovy-xml"
7070
}

build-conventions/src/main/java/org/elasticsearch/gradle/internal/checkstyle/HiddenFieldCheck.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
* @notice
33
* checkstyle: Checks Java source code for adherence to a set of rules.
44
* Copyright (C) 2001-2021 the original author or authors.
5-
5+
*
66
* This library is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU Lesser General Public
88
* License as published by the Free Software Foundation; either
99
* version 2.1 of the License, or (at your option) any later version.
10-
10+
*
1111
* This library is distributed in the hope that it will be useful,
1212
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1313
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1414
* Lesser General Public License for more details.
15-
15+
*
1616
* You should have received a copy of the GNU Lesser General Public
1717
* License along with this library; if not, write to the Free Software
1818
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

build-conventions/src/main/java/org/elasticsearch/gradle/internal/checkstyle/MissingJavadocTypeCheck.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ public int[] getRequiredTokens() {
121121
return CommonUtil.EMPTY_INT_ARRAY;
122122
}
123123

124+
// suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166
125+
@SuppressWarnings("deprecation")
124126
@Override
125127
public void visitToken(DetailAST ast) {
126128
if (shouldCheck(ast)) {
@@ -140,24 +142,18 @@ public void visitToken(DetailAST ast) {
140142
* @return whether we should check a given node.
141143
*/
142144
private boolean shouldCheck(final DetailAST ast) {
143-
final Scope customScope;
144-
145-
if (ScopeUtil.isInInterfaceOrAnnotationBlock(ast)) {
146-
customScope = Scope.PUBLIC;
147-
} else {
148-
final DetailAST mods = ast.findFirstToken(TokenTypes.MODIFIERS);
149-
customScope = ScopeUtil.getScopeFromMods(mods);
150-
}
145+
final Scope customScope = ScopeUtil.getScope(ast);
151146
final Scope surroundingScope = ScopeUtil.getSurroundingScope(ast);
152147

153148
final String outerTypeName = ast.findFirstToken(TokenTypes.IDENT).getText();
154149

155150
return customScope.isIn(scope)
156151
&& (surroundingScope == null || surroundingScope.isIn(scope))
157152
&& (excludeScope == null
158-
|| customScope.isIn(excludeScope) == false
159-
|| surroundingScope != null && surroundingScope.isIn(excludeScope) == false)
160-
&& AnnotationUtil.containsAnnotation(ast, skipAnnotations) == false
153+
|| !customScope.isIn(excludeScope)
154+
|| surroundingScope != null
155+
&& !surroundingScope.isIn(excludeScope))
156+
&& !AnnotationUtil.containsAnnotation(ast, skipAnnotations)
161157
&& ignorePattern.matcher(outerTypeName).find() == false;
162158
}
163159

build-tools-internal/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ lucene = 8.11.1
44
bundled_jdk_vendor = adoptium
55
bundled_jdk = 17.0.2+8
66

7-
checkstyle = 8.45.1
7+
checkstyle = 9.3
88

99
# optional dependencies
1010
spatial4j = 0.7

0 commit comments

Comments
 (0)