Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:

run-inspections:
docker:
- image: checkstyle/idea-docker:jdk11-idea2022.2.2
- image: checkstyle/idea-docker:jdk11-idea2022.3.3

steps:
- checkout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ private Properties createOverridingProperties() {
*
* @return the list of listeners.
* @throws BuildException if the listeners could not be created.
* @noinspection MismatchedJavadocCode
* @noinspectionreason MismatchedJavadocCode - until issue #14625
*/
private AuditListener[] getListeners() {
final int formatterCount = Math.max(1, formatters.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public static FullIdent createFullIdent(DetailAST ast) {
*
* @param full the FullIdent to add to
* @param ast the node to recurse from
* @noinspection TailRecursion
* @noinspectionreason TailRecursion - until issue #14625
*/
private static void extractFullIdent(FullIdent full, DetailAST ast) {
if (ast != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ private static String removeQuotes(final String warning) {
*
* @param cond a Conditional type
* {@link TokenTypes#QUESTION QUESTION}
* @noinspection TailRecursion
* @noinspectionreason TailRecursion - until issue #14625
*/
private void walkConditional(final DetailAST cond) {
if (cond.getType() == TokenTypes.QUESTION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@ public void addMethodCall(DetailAST methodCall) {
*
* @param name name of the field to check.
* @return true if this FieldFrame contains instance field.
* @noinspection MismatchedJavadocCode
* @noinspectionreason MismatchedJavadocCode - until issue #14625
*/
public DetailAST findField(String name) {
return fieldNameToAst.get(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ public void addStaticField(String field) {
*
* @param field the field to check
* @return true if this FieldFrame contains instance field
* @noinspection TailRecursion
* @noinspectionreason TailRecursion - until issue #14625
*/
public boolean containsInstanceField(String field) {
return instanceFields.contains(field)
Expand All @@ -661,6 +663,8 @@ public boolean containsInstanceField(String field) {
*
* @param field the field to check
* @return true if this FieldFrame contains static field
* @noinspection TailRecursion
* @noinspectionreason TailRecursion - until issue #14625
*/
public boolean containsStaticField(String field) {
return staticFields.contains(field)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,8 @@ private void modifyVariablesStack(TypeDeclDesc obtainedClass,
*
* @param superClassName name of the super class
* @return true if there is another type declaration with same name.
* @noinspection MismatchedJavadocCode
* @noinspectionreason MismatchedJavadocCode - until issue #14625
*/
private List<TypeDeclDesc> typeDeclWithSameName(String superClassName) {
return typeDeclAstToTypeDeclDesc.values().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,12 @@ public void beginTree(DetailAST rootAST) {
findMatch();
}

/** Recursive method that finds the matches. */
/**
* Recursive method that finds the matches.
*
* @noinspection TailRecursion
* @noinspectionreason TailRecursion - until issue #14625
*/
// suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166
@SuppressWarnings("deprecation")
private void findMatch() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ private void resetState() {
* @param line the line to check
* @param matcher the matcher to use
* @param startPosition the position to start searching from.
* @noinspection TailRecursion
* @noinspectionreason TailRecursion - until issue #14625
*/
private void checkLine(int lineNo, String line, Matcher matcher,
int startPosition) {
Expand Down
24 changes: 24 additions & 0 deletions src/test/java/com/puppycrawl/tools/checkstyle/JavaParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public void testNullRootWithComments() {
.isNull();
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testAppendHiddenBlockCommentNodes() throws Exception {
final DetailAST root =
Expand Down Expand Up @@ -99,6 +105,12 @@ public void testAppendHiddenBlockCommentNodes() throws Exception {
.isEqualTo(1);
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testAppendHiddenSingleLineCommentNodes() throws Exception {
final DetailAST root =
Expand Down Expand Up @@ -139,6 +151,12 @@ public void testAppendHiddenSingleLineCommentNodes() throws Exception {
.startsWith(" inline comment");
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testAppendHiddenSingleLineCommentNodes2() throws Exception {
final DetailAST root =
Expand Down Expand Up @@ -230,6 +248,12 @@ public void testComments() throws Exception {
.isEqualTo(Arrays.asList("5,4", "8,0"));
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testJava14TextBlocks() throws Exception {
final DetailAST root =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,12 @@ public void testLoggedTime() throws IOException {
assertLoggedTime(loggedMessages, testingTime, "To process the files");
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
private static void assertLoggedTime(List<MessageLevelPair> loggedMessages,
long testingTime, String expectedMsg) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ public void testSuppressWarningsAsAnnotationProperty() throws Exception {
verifyWithInlineConfigParser(getPath("InputSuppressWarningsHolder7.java"), expected);
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
@SuppressWarnings("unchecked")
public void testClearState() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ public void testHiddenFieldRecordsImplicitlyStaticClassComparison() throws Excep
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearState() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ public void testImproperToken() {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -193,6 +195,8 @@ public void testClearStateClassNames() throws Exception {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearStateImports() throws Exception {
Expand All @@ -219,6 +223,8 @@ public void testClearStateImports() throws Exception {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ public void testRecordDecompositionInEnhancedForLoop() throws Exception {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public void testTokensNotNull() {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ public void testUnusedMethodFor() throws Exception {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearState() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ public void testMaxForVoid() throws Exception {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public void testTokensNotNull() {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@ public void testUnusedLocalVariableTernaryAndExpressions() throws Exception {
expected);
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearStateVariables() throws Exception {
final UnusedLocalVariableCheck check = new UnusedLocalVariableCheck();
Expand All @@ -382,6 +388,12 @@ public void testClearStateVariables() throws Exception {
.isTrue();
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearStateClasses() throws Exception {
final UnusedLocalVariableCheck check = new UnusedLocalVariableCheck();
Expand Down Expand Up @@ -417,6 +429,12 @@ public void testClearStateClasses() throws Exception {
.isTrue();
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearStateAnonInnerClass() throws Exception {
final UnusedLocalVariableCheck check = new UnusedLocalVariableCheck();
Expand Down Expand Up @@ -451,6 +469,12 @@ public void testClearStateAnonInnerClass() throws Exception {
.isTrue();
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearStatePackageDef() throws Exception {
final UnusedLocalVariableCheck check = new UnusedLocalVariableCheck();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ public void testFinalClassNestedInRecord() throws Exception {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearState() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,8 @@ public void testTrimOption() throws Exception {
* leading to hard-to-detect and unstable violations that will affect our users.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearState() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ public void testThrows() throws Exception {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -325,6 +327,8 @@ public void testClearStateImportedClassPackages() throws Exception {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearStateClassContexts() throws Exception {
Expand All @@ -351,6 +355,8 @@ public void testClearStateClassContexts() throws Exception {
* state of the field will be cleared.
*
* @throws Exception when code tested throws exception
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearStatePackageName() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ public void testStatefulFieldsClearedOnBeginTree2() {
.isTrue();
}

/**
* Temporary java doc.
*
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testStatefulFieldsClearedOnBeginTree3() throws Exception {
final NPathComplexityCheck check = new NPathComplexityCheck();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public void testWithRecords() throws Exception {
* check as they are file specific values.
*
* @throws Exception if there is an error.
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearState() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ public void testBeforeRecordHeader() throws Exception {
* start of processing the next file in the check.
*
* @throws Exception if there is an error.
* @noinspection OptionalGetWithoutIsPresent
* @noinspectionreason OptionalGetWithoutIsPresent - until issue #14625
*/
@Test
public void testClearState() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ public void setUp() throws Exception {
/**
* Validates check javadocs and xdocs for consistency.
*
* @noinspection JUnitTestMethodWithNoAssertions
* @noinspection JUnitTestMethodWithNoAssertions, TestMethodWithoutAssertion
* @noinspectionreason JUnitTestMethodWithNoAssertions - asserts in callstack,
* but not in this method
* @noinspectionreason TestMethodWithoutAssertion - until issue #14625
*/
@Test
public void testAllCheckSectionJavaDocs() throws Exception {
Expand Down
Loading