From 20647618c02bde45c2678221f1ebb5a0f7c044b7 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 - .../tools/checkstyle/checks/imports/RedundantImportCheck.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/pitest.sh b/.ci/pitest.sh index 665d6d42463..6632c1d5c96 100755 --- a/.ci/pitest.sh +++ b/.ci/pitest.sh @@ -86,7 +86,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 4c71e4eeb68..e35c3a95a4a 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); } }