Replace fast-classpath-scanner with classgraph

This commit is contained in:
Paul Campbell 2018-08-26 20:18:35 +01:00 committed by dependabot[bot]
parent 093c3ddd3e
commit f53b638441
2 changed files with 9 additions and 7 deletions

View file

@ -32,7 +32,7 @@
<mockito.version>2.21.0</mockito.version>
<assertj.version>3.11.0</assertj.version>
<conditional.version>0.6.0</conditional.version>
<fast-classpath-scanner.version>3.1.15</fast-classpath-scanner.version>
<classgraph.version>4.1.2</classgraph.version>
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
<kemitix.checkstyle.ruleset.version>${project.version}</kemitix.checkstyle.ruleset.version>
@ -66,9 +66,9 @@
<version>${conditional.version}</version>
</dependency>
<dependency>
<groupId>io.github.lukehutch</groupId>
<artifactId>fast-classpath-scanner</artifactId>
<version>${fast-classpath-scanner.version}</version>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>${classgraph.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>

View file

@ -21,7 +21,7 @@
package net.kemitix.checkstyle.ruleset.builder;
import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
import io.github.classgraph.ClassGraph;
import org.springframework.stereotype.Service;
import java.util.List;
@ -38,9 +38,11 @@ public class DefaultPackageScanner implements PackageScanner {
@Override
public final List<String> apply(final RuleSource ruleSource) {
final String basePackage = ruleSource.getBasePackage();
return new FastClasspathScanner(basePackage)
return new ClassGraph()
.whitelistPackages(basePackage)
.scan()
.getNamesOfAllStandardClasses()
.getAllStandardClasses()
.getNames()
.stream()
.filter(packageName -> packageName.startsWith(basePackage))
.collect(Collectors.toList());