From 407e44b94384064989d1ed2a9c11de20ac8e7e8f Mon Sep 17 00:00:00 2001 From: Gaurav Punjabi Date: Sat, 21 Mar 2020 16:42:44 +0530 Subject: [PATCH] Issue #7920: Resolve Pitest Issues - RedundantImportCheck --- .ci/pitest.sh | 1 - .../checks/imports/RedundantImportCheck.java | 2 +- ...gContinuationIndentationNewLineDescription.java | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctagcontinuationindentation/InputJavadocTagContinuationIndentationNewLineDescription.java diff --git a/.ci/pitest.sh b/.ci/pitest.sh index 690bf9e82f88..139167012dcd 100755 --- a/.ci/pitest.sh +++ b/.ci/pitest.sh @@ -87,7 +87,6 @@ pitest-imports) "PkgImportControl.java.html:
        if (regex || parent.regex) {
" "PkgImportControl.java.html:
        if (regex) {
" "PkgImportRule.java.html:
        if (isRegExp()) {
" - "RedundantImportCheck.java.html:
            else if (pkgName != null && isFromPackage(imp.getText(), pkgName)) {
" "UnusedImportsCheck.java.html:
            if (collect) {
" ); checkPitestReport "${ignoredItems[@]}" diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.java index 4c71e4eeb688..e35c3a95a4a7 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.java @@ -150,7 +150,7 @@ private static boolean isFromPackage(String importName, String pkg) { // So '.' must be present in member name and we are not checking for it final int index = importName.lastIndexOf('.'); final String front = importName.substring(0, index); - return front.equals(pkg); + return pkg.equals(front); } } diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctagcontinuationindentation/InputJavadocTagContinuationIndentationNewLineDescription.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctagcontinuationindentation/InputJavadocTagContinuationIndentationNewLineDescription.java new file mode 100644 index 000000000000..39be168ad3be --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctagcontinuationindentation/InputJavadocTagContinuationIndentationNewLineDescription.java @@ -0,0 +1,14 @@ +package com.puppycrawl.tools.checkstyle.checks.javadoc.javadoctagcontinuationindentation; + +public class InputJavadocTagContinuationIndentation1 { + /** + * Desc. + * + * @param s + * Desc. Line 8. + * Desc 2. + * Desc 3. + * Desc 4. Line 11. + */ + public void test(String s) {} +}