diff options
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnary.java')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnary.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnary.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnary.java index a1f3451eaa8..1726adf4056 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnary.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnary.java @@ -19,9 +19,6 @@ */ package org.sonar.scanner.bootstrap; -import com.google.common.base.Predicates; -import com.google.common.collect.Collections2; -import com.google.common.collect.Lists; import java.lang.annotation.Annotation; import java.lang.reflect.Array; import java.lang.reflect.Method; @@ -30,6 +27,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; +import java.util.stream.Collectors; + import javax.annotation.Nullable; import org.apache.commons.lang.ClassUtils; import org.sonar.api.batch.CheckProject; @@ -94,7 +93,7 @@ public class ScannerExtensionDictionnary { } private <T> List<T> getFilteredExtensions(Class<T> type, @Nullable DefaultInputModule module, @Nullable ExtensionMatcher matcher) { - List<T> result = Lists.newArrayList(); + List<T> result = new ArrayList<>(); for (Object extension : getExtensions(type)) { if (org.sonar.api.batch.Sensor.class.equals(type) && extension instanceof Sensor) { extension = new SensorWrapper((Sensor) extension, sensorContext, sensorOptimizer); @@ -125,7 +124,7 @@ public class ScannerExtensionDictionnary { } protected <T> List<T> getExtensions(Class<T> type) { - List<T> extensions = Lists.newArrayList(); + List<T> extensions = new ArrayList<>(); completeBatchExtensions(componentContainer, extensions, type); return extensions; } @@ -153,7 +152,9 @@ public class ScannerExtensionDictionnary { } List<?> sortedList = dag.sort(); - return (Collection<T>) Collections2.filter(sortedList, Predicates.in(extensions)); + return (Collection<T>) sortedList.stream() + .filter(extensions::contains) + .collect(Collectors.toList()); } /** @@ -187,7 +188,7 @@ public class ScannerExtensionDictionnary { } protected List<Object> evaluateAnnotatedClasses(Object extension, Class<? extends Annotation> annotation) { - List<Object> results = Lists.newArrayList(); + List<Object> results = new ArrayList<>(); Class<? extends Object> aClass = extension.getClass(); while (aClass != null) { evaluateClass(aClass, annotation, results); |