diff options
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar/batch')
39 files changed, 70 insertions, 70 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionDictionnary.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionDictionnary.java index 5a66504364e..dfd3a7c009c 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionDictionnary.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionDictionnary.java @@ -160,7 +160,7 @@ public class BatchExtensionDictionnary { * Extension dependencies */ private <T> List<Object> getDependencies(T extension) { - List<Object> result = new ArrayList<Object>(); + List<Object> result = new ArrayList<>(); result.addAll(evaluateAnnotatedClasses(extension, DependsUpon.class)); return result; } @@ -169,7 +169,7 @@ public class BatchExtensionDictionnary { * Objects that depend upon this extension. */ public <T> List<Object> getDependents(T extension) { - List<Object> result = new ArrayList<Object>(); + List<Object> result = new ArrayList<>(); result.addAll(evaluateAnnotatedClasses(extension, DependedUpon.class)); return result; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcLeakPrevention.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcLeakPrevention.java index acf6658a16a..c98fd8faf30 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcLeakPrevention.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcLeakPrevention.java @@ -44,7 +44,7 @@ public class JdbcLeakPrevention { public List<String> unregisterDrivers() throws SQLException { Set<Driver> registeredDrivers = registeredDrivers(); - List<String> unregisteredNames = new ArrayList<String>(); + List<String> unregisteredNames = new ArrayList<>(); Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { Driver driver = drivers.nextElement(); @@ -60,7 +60,7 @@ public class JdbcLeakPrevention { } private Set<Driver> registeredDrivers() { - Set<Driver> registeredDrivers = new HashSet<Driver>(); + Set<Driver> registeredDrivers = new HashSet<>(); Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { Driver driver = drivers.nextElement(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java index 3af2092c66e..1c4bf3e019a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java @@ -102,8 +102,8 @@ public final class DebtDecorator implements Decorator { private void saveMeasures(DecoratorContext context, List<Issue> issues) { Long total = 0L; - SumMap<RuleKey> ruleDebts = new SumMap<RuleKey>(); - SumMap<Characteristic> characteristicDebts = new SumMap<Characteristic>(); + SumMap<RuleKey> ruleDebts = new SumMap<>(); + SumMap<Characteristic> characteristicDebts = new SumMap<>(); // Aggregate rules debt from current issues (and populate current characteristic debt) for (Issue issue : issues) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/deprecated/decorator/DecoratorsSelector.java b/sonar-batch/src/main/java/org/sonar/batch/deprecated/decorator/DecoratorsSelector.java index c50574fb637..a77a09cb844 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/deprecated/decorator/DecoratorsSelector.java +++ b/sonar-batch/src/main/java/org/sonar/batch/deprecated/decorator/DecoratorsSelector.java @@ -39,7 +39,7 @@ public final class DecoratorsSelector { } public Collection<Decorator> select(Project project) { - List<Decorator> decorators = new ArrayList<Decorator>(batchExtDictionnary.select(Decorator.class, project, false, null)); + List<Decorator> decorators = new ArrayList<>(batchExtDictionnary.select(Decorator.class, project, false, null)); SetMultimap<Metric, Decorator> decoratorsByGeneratedMetric = getDecoratorsByMetric(decorators); for (Metric metric : batchExtDictionnary.select(Metric.class, null, false, null)) { if (metric.getFormula() != null) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/DirectoryDsmDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/design/DirectoryDsmDecorator.java index 95c3da4ae8c..f0527ca66f6 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/DirectoryDsmDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/DirectoryDsmDecorator.java @@ -42,7 +42,7 @@ public class DirectoryDsmDecorator extends DsmDecorator { @Override protected List<Resource> getChildren(Resource resource, DecoratorContext context) { List<DecoratorContext> fileContexts = context.getChildren(); - List<Resource> files = new ArrayList<Resource>(fileContexts.size()); + List<Resource> files = new ArrayList<>(fileContexts.size()); for (DecoratorContext decoratorContext : fileContexts) { files.add(decoratorContext.getResource()); } @@ -51,7 +51,7 @@ public class DirectoryDsmDecorator extends DsmDecorator { @Override protected Set<Edge> doProcess(List<Resource> children, DecoratorContext context) { - IncrementalCyclesAndFESSolver<Resource> cycleDetector = new IncrementalCyclesAndFESSolver<Resource>(getIndex(), children); + IncrementalCyclesAndFESSolver<Resource> cycleDetector = new IncrementalCyclesAndFESSolver<>(getIndex(), children); Set<Cycle> cycles = cycleDetector.getCycles(); MinimumFeedbackEdgeSetSolver solver = new MinimumFeedbackEdgeSetSolver(cycles); diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/DsmDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/design/DsmDecorator.java index 8dafbe0cbd0..790debf713b 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/DsmDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/DsmDecorator.java @@ -91,7 +91,7 @@ public abstract class DsmDecorator implements Decorator { } protected final Dsm<Resource> getDsm(Collection<Resource> children, Set<Edge> feedbackEdges) { - Dsm<Resource> dsm = new Dsm<Resource>(index, children, feedbackEdges); + Dsm<Resource> dsm = new Dsm<>(index, children, feedbackEdges); DsmTopologicalSorter.sort(dsm); return dsm; } @@ -112,7 +112,7 @@ public abstract class DsmDecorator implements Decorator { } protected final List<Dependency> getEdges(Collection<Resource> vertices) { - List<Dependency> result = new ArrayList<Dependency>(); + List<Dependency> result = new ArrayList<>(); for (Resource vertice : vertices) { Collection<Dependency> outgoingEdges = index.getOutgoingEdges(vertice); if (outgoingEdges != null) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/MavenDependenciesSensor.java b/sonar-batch/src/main/java/org/sonar/batch/design/MavenDependenciesSensor.java index 4d04022e509..6956cac89b7 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/MavenDependenciesSensor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/MavenDependenciesSensor.java @@ -112,7 +112,7 @@ public class MavenDependenciesSensor implements Sensor { private String scope; - List<InputDependency> dependencies = new ArrayList<InputDependency>(); + List<InputDependency> dependencies = new ArrayList<>(); public InputDependency(String key, String version) { this.key = key; diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/ProjectDsmDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/design/ProjectDsmDecorator.java index 66471955795..620ceeabd3f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/ProjectDsmDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/ProjectDsmDecorator.java @@ -61,7 +61,7 @@ public class ProjectDsmDecorator extends DsmDecorator { @Override protected Set<Edge> doProcess(List<Resource> children, DecoratorContext context) { - CycleDetector<Resource> cycleDetector = new CycleDetector<Resource>(getIndex(), children); + CycleDetector<Resource> cycleDetector = new CycleDetector<>(getIndex(), children); Set<Cycle> cycles = cycleDetector.getCycles(); MinimumFeedbackEdgeSetSolver solver = new MinimumFeedbackEdgeSetSolver(cycles); diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/SubProjectDsmDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/design/SubProjectDsmDecorator.java index 9e03a13c7df..62aa622b11d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/SubProjectDsmDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/SubProjectDsmDecorator.java @@ -43,7 +43,7 @@ public class SubProjectDsmDecorator extends DsmDecorator { @Override protected List<Resource> getChildren(Resource resource, DecoratorContext context) { List<DecoratorContext> directoryContexts = context.getChildren(); - List<Resource> directories = new ArrayList<Resource>(directoryContexts.size()); + List<Resource> directories = new ArrayList<>(directoryContexts.size()); for (DecoratorContext decoratorContext : directoryContexts) { directories.add(decoratorContext.getResource()); } @@ -52,7 +52,7 @@ public class SubProjectDsmDecorator extends DsmDecorator { @Override protected Set<Edge> doProcess(List<Resource> children, DecoratorContext context) { - IncrementalCyclesAndFESSolver<Resource> cycleDetector = new IncrementalCyclesAndFESSolver<Resource>(getIndex(), children); + IncrementalCyclesAndFESSolver<Resource> cycleDetector = new IncrementalCyclesAndFESSolver<>(getIndex(), children); Set<Cycle> cycles = cycleDetector.getCycles(); MinimumFeedbackEdgeSetSolver solver = new MinimumFeedbackEdgeSetSolver(cycles); diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/BatchResource.java b/sonar-batch/src/main/java/org/sonar/batch/index/BatchResource.java index 5fe13a1c89a..af4eedd4bd9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/BatchResource.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/BatchResource.java @@ -37,7 +37,7 @@ public class BatchResource { private final Resource r; private Snapshot s; private final BatchResource parent; - private final Collection<BatchResource> children = new ArrayList<BatchResource>(); + private final Collection<BatchResource> children = new ArrayList<>(); private InputPath inputPath; public BatchResource(int batchId, Resource r, @Nullable BatchResource parent) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/Cache.java b/sonar-batch/src/main/java/org/sonar/batch/index/Cache.java index fa98e02d0b8..be01e354f7b 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/Cache.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/Cache.java @@ -300,29 +300,29 @@ public class Cache<V> { * Lazy-loading values for given keys */ public Iterable<V> values(Object firstKey, Object secondKey) { - return new ValueIterable<V>(exchange, firstKey, secondKey); + return new ValueIterable<>(exchange, firstKey, secondKey); } /** * Lazy-loading values for a given key */ public Iterable<V> values(Object firstKey) { - return new ValueIterable<V>(exchange, firstKey); + return new ValueIterable<>(exchange, firstKey); } /** * Lazy-loading values */ public Iterable<V> values() { - return new ValueIterable<V>(exchange); + return new ValueIterable<>(exchange); } public Iterable<Entry<V>> entries() { - return new EntryIterable<V>(exchange); + return new EntryIterable<>(exchange); } public Iterable<Entry<V>> entries(Object firstKey) { - return new EntryIterable<V>(exchange, firstKey); + return new EntryIterable<>(exchange, firstKey); } private void resetKey(Object key) { @@ -370,7 +370,7 @@ public class Cache<V> { } originExchange.append(Key.BEFORE); Exchange iteratorExchange = new Exchange(originExchange); - return new ValueIterator<T>(iteratorExchange, filter); + return new ValueIterator<>(iteratorExchange, filter); } } @@ -431,7 +431,7 @@ public class Cache<V> { } originExchange.append(Key.BEFORE); Exchange iteratorExchange = new Exchange(originExchange); - return new EntryIterator<T>(iteratorExchange, filter); + return new EntryIterator<>(iteratorExchange, filter); } } @@ -468,7 +468,7 @@ public class Cache<V> { for (int i = 0; i < key.getDepth(); i++) { array[i] = key.indexTo(i - key.getDepth()).decode(); } - return new Entry<T>(array, value); + return new Entry<>(array, value); } throw new NoSuchElementException(); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/Caches.java b/sonar-batch/src/main/java/org/sonar/batch/index/Caches.java index ac0f509ec9d..74c2d7f6ad9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/Caches.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/Caches.java @@ -91,7 +91,7 @@ public class Caches implements Startable { try { Exchange exchange = persistit.getExchange(volume, cacheName, true); exchange.setMaximumValueSize(Value.MAXIMUM_SIZE); - Cache<V> cache = new Cache<V>(cacheName, exchange); + Cache<V> cache = new Cache<>(cacheName, exchange); cacheNames.add(cacheName); return cache; } catch (Exception e) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index 14803caa3b5..a0436ba85fa 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -223,7 +223,7 @@ public class DefaultIndex extends SonarIndex { } else { unfiltered = measureCache.byResource(indexedResource); } - Collection<Measure> all = new ArrayList<Measure>(); + Collection<Measure> all = new ArrayList<>(); if (unfiltered != null) { for (Measure measure : unfiltered) { all.add(measure); @@ -300,7 +300,7 @@ public class DefaultIndex extends SonarIndex { private void registerOutgoingDependency(Dependency dependency) { Map<Resource, Dependency> outgoingDeps = outgoingDependenciesByResource.get(dependency.getFrom()); if (outgoingDeps == null) { - outgoingDeps = new HashMap<Resource, Dependency>(); + outgoingDeps = new HashMap<>(); outgoingDependenciesByResource.put(dependency.getFrom(), outgoingDeps); } outgoingDeps.put(dependency.getTo(), dependency); @@ -309,7 +309,7 @@ public class DefaultIndex extends SonarIndex { private void registerIncomingDependency(Dependency dependency) { Map<Resource, Dependency> incomingDeps = incomingDependenciesByResource.get(dependency.getTo()); if (incomingDeps == null) { - incomingDeps = new HashMap<Resource, Dependency>(); + incomingDeps = new HashMap<>(); incomingDependenciesByResource.put(dependency.getTo(), incomingDeps); } incomingDeps.put(dependency.getFrom(), dependency); diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java index 33c2a98cc69..81891856cdf 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java @@ -80,9 +80,9 @@ public class ResourceKeyMigration { void migrateIfNeeded(Project module, Iterable<InputFile> inputFiles, DefaultModuleFileSystem fs) { logger.info("Update component keys"); - Map<String, InputFile> deprecatedFileKeyMapper = new HashMap<String, InputFile>(); - Map<String, InputFile> deprecatedTestKeyMapper = new HashMap<String, InputFile>(); - Map<String, String> deprecatedDirectoryKeyMapper = new HashMap<String, String>(); + Map<String, InputFile> deprecatedFileKeyMapper = new HashMap<>(); + Map<String, InputFile> deprecatedTestKeyMapper = new HashMap<>(); + Map<String, String> deprecatedDirectoryKeyMapper = new HashMap<>(); for (InputFile inputFile : inputFiles) { String deprecatedKey = computeDeprecatedKey(module.getKey(), (DeprecatedDefaultInputFile) inputFile, fs); if (deprecatedKey != null) { @@ -225,7 +225,7 @@ public class ResourceKeyMigration { .setParameter("rootId", moduleId) .setParameter("enabled", false) .getResultList(); - Map<String, ResourceModel> disabledResourceByKey = new HashMap<String, ResourceModel>(); + Map<String, ResourceModel> disabledResourceByKey = new HashMap<>(); for (ResourceModel disabledResourceModel : disabledResources) { disabledResourceByKey.put(disabledResourceModel.getKey(), disabledResourceModel); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java index 9f92432a026..35765f96fb9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java +++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/BatchMediumTester.java @@ -296,7 +296,7 @@ public class BatchMediumTester { } private static class FakeServerLineHashesLoader implements ServerLineHashesLoader { - private Map<String, String[]> byKey = new HashMap<String, String[]>(); + private Map<String, String[]> byKey = new HashMap<>(); @Override public String[] getLineHashes(String fileKey) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java index 8aa0a88a574..b352631eddd 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java +++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java @@ -193,7 +193,7 @@ public class TaskResult implements org.sonar.batch.mediumtest.ScanTaskObserver { return Collections.emptyList(); } TextPointer pointer = file.newPointer(line, lineOffset); - List<TypeOfText> result = new ArrayList<TypeOfText>(); + List<TypeOfText> result = new ArrayList<>(); InputStream inputStream = null; try { inputStream = FileUtils.openInputStream(highlightingFile); diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java b/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java index 612e4d49d5a..32c2538ab10 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/PhasesTimeProfiler.java @@ -81,7 +81,7 @@ public class PhasesTimeProfiler implements SensorExecutionHandler, DecoratorExec static class DecoratorsProfiler { List<Decorator> decorators = Lists.newArrayList(); - Map<Decorator, Long> durations = new IdentityHashMap<Decorator, Long>(); + Map<Decorator, Long> durations = new IdentityHashMap<>(); long startTime; Decorator currentDecorator; diff --git a/sonar-batch/src/main/java/org/sonar/batch/profiling/AbstractTimeProfiling.java b/sonar-batch/src/main/java/org/sonar/batch/profiling/AbstractTimeProfiling.java index d4bce006df4..687adba5178 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/profiling/AbstractTimeProfiling.java +++ b/sonar-batch/src/main/java/org/sonar/batch/profiling/AbstractTimeProfiling.java @@ -76,7 +76,7 @@ public abstract class AbstractTimeProfiling { return Long.valueOf(o2.getValue().totalTime()).compareTo(o1.getValue().totalTime()); } }); - Map<Object, G> sortedMap = new LinkedHashMap<Object, G>(); + Map<Object, G> sortedMap = new LinkedHashMap<>(); for (Map.Entry<?, G> entry : entries) { sortedMap.put(entry.getKey(), entry.getValue()); } @@ -85,7 +85,7 @@ public abstract class AbstractTimeProfiling { static <G extends AbstractTimeProfiling> List<G> truncate(Collection<G> sortedList) { int maxSize = 10; - List<G> result = new ArrayList<G>(maxSize); + List<G> result = new ArrayList<>(maxSize); int i = 0; for (G item : sortedList) { if (i >= maxSize || item.totalTime() == 0) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/profiling/ModuleProfiling.java b/sonar-batch/src/main/java/org/sonar/batch/profiling/ModuleProfiling.java index c4a0fc19174..f4bae408420 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/profiling/ModuleProfiling.java +++ b/sonar-batch/src/main/java/org/sonar/batch/profiling/ModuleProfiling.java @@ -30,8 +30,8 @@ import java.util.Map.Entry; public class ModuleProfiling extends AbstractTimeProfiling { - private Map<Phase, PhaseProfiling> profilingPerPhase = new HashMap<Phase, PhaseProfiling>(); - private Map<String, ItemProfiling> profilingPerBatchStep = new LinkedHashMap<String, ItemProfiling>(); + private Map<Phase, PhaseProfiling> profilingPerPhase = new HashMap<>(); + private Map<String, ItemProfiling> profilingPerBatchStep = new LinkedHashMap<>(); private final Project module; public ModuleProfiling(@Nullable Project module, System2 system) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhaseProfiling.java b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhaseProfiling.java index 2bb5599a0fe..15b16d02b49 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhaseProfiling.java +++ b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhaseProfiling.java @@ -30,7 +30,7 @@ public class PhaseProfiling extends AbstractTimeProfiling { private final Phase phase; - private Map<String, ItemProfiling> profilingPerItem = new HashMap<String, ItemProfiling>(); + private Map<String, ItemProfiling> profilingPerItem = new HashMap<>(); PhaseProfiling(System2 system, Phase phase) { super(system); diff --git a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java index b4357e407bd..c62c528c2fb 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java +++ b/sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java @@ -59,7 +59,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx @VisibleForTesting ModuleProfiling totalProfiling; - private Map<Project, ModuleProfiling> modulesProfilings = new HashMap<Project, ModuleProfiling>(); + private Map<Project, ModuleProfiling> modulesProfilings = new HashMap<>(); private DecoratorsProfiler decoratorsProfiler; private final System2 system; @@ -258,7 +258,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx class DecoratorsProfiler { private List<Decorator> decorators = Lists.newArrayList(); - private Map<Decorator, Long> durations = new IdentityHashMap<Decorator, Long>(); + private Map<Decorator, Long> durations = new IdentityHashMap<>(); private long startTime; private Decorator currentDecorator; diff --git a/sonar-batch/src/main/java/org/sonar/batch/repository/language/DefaultLanguagesRepository.java b/sonar-batch/src/main/java/org/sonar/batch/repository/language/DefaultLanguagesRepository.java index fe5f50ba9ea..dd3b43b422f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/repository/language/DefaultLanguagesRepository.java +++ b/sonar-batch/src/main/java/org/sonar/batch/repository/language/DefaultLanguagesRepository.java @@ -54,7 +54,7 @@ public class DefaultLanguagesRepository implements LanguagesRepository { @Override public Collection<Language> all() { org.sonar.api.resources.Language[] all = languages.all(); - Collection<Language> result = new ArrayList<Language>(all.length); + Collection<Language> result = new ArrayList<>(all.length); for (org.sonar.api.resources.Language language : all) { result.add(new Language(language.getKey(), language.getName(), language.getFileSuffixes())); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProfileWrapper.java b/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProfileWrapper.java index 41914729afa..302f71e5db2 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProfileWrapper.java +++ b/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProfileWrapper.java @@ -85,7 +85,7 @@ public class RulesProfileWrapper extends RulesProfile { @Override public List<ActiveRule> getActiveRules() { - List<ActiveRule> activeRules = new ArrayList<ActiveRule>(); + List<ActiveRule> activeRules = new ArrayList<>(); for (RulesProfile profile : profiles) { activeRules.addAll(profile.getActiveRules()); } @@ -105,7 +105,7 @@ public class RulesProfileWrapper extends RulesProfile { @Override public List<ActiveRule> getActiveRulesByRepository(String repositoryKey) { - List<ActiveRule> activeRules = new ArrayList<ActiveRule>(); + List<ActiveRule> activeRules = new ArrayList<>(); for (RulesProfile profile : profiles) { activeRules.addAll(profile.getActiveRulesByRepository(repositoryKey)); } @@ -114,7 +114,7 @@ public class RulesProfileWrapper extends RulesProfile { @Override public List<ActiveRule> getActiveRules(boolean acceptDisabledRules) { - List<ActiveRule> activeRules = new ArrayList<ActiveRule>(); + List<ActiveRule> activeRules = new ArrayList<>(); for (RulesProfile profile : profiles) { activeRules.addAll(profile.getActiveRules(acceptDisabledRules)); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/UsedQProfiles.java b/sonar-batch/src/main/java/org/sonar/batch/rule/UsedQProfiles.java index ac923055950..15a6d3cd3ae 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/rule/UsedQProfiles.java +++ b/sonar-batch/src/main/java/org/sonar/batch/rule/UsedQProfiles.java @@ -103,7 +103,7 @@ public class UsedQProfiles { } public Map<String, QProfile> profilesByKey() { - Map<String, QProfile> map = new HashMap<String, QProfile>(); + Map<String, QProfile> map = new HashMap<>(); for (QProfile profile : profiles) { map.put(profile.getKey(), profile); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java index 3c63472ede6..861600fdba9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java @@ -125,9 +125,9 @@ public class ProjectReactorBuilder { } private Map<String, Map<String, String>> extractPropertiesByModule(String currentModuleId, Map<String, String> parentProperties) { - Map<String, String> allProperties = new HashMap<String, String>(); + Map<String, String> allProperties = new HashMap<>(); allProperties.putAll(parentProperties); - Map<String, String> currentModuleProperties = new HashMap<String, String>(); + Map<String, String> currentModuleProperties = new HashMap<>(); String prefix = !currentModuleId.isEmpty() ? currentModuleId + "." : ""; // By default all properties starting with module prefix belong to current module for (Map.Entry<String, String> entry : allProperties.entrySet()) { @@ -138,11 +138,11 @@ public class ProjectReactorBuilder { parentProperties.remove(key); } } - List<String> moduleIds = new ArrayList<String>(Arrays.asList(getListFromProperty(currentModuleProperties, PROPERTY_MODULES))); + List<String> moduleIds = new ArrayList<>(Arrays.asList(getListFromProperty(currentModuleProperties, PROPERTY_MODULES))); // Sort module by reverse lexicographic order to avoid issue when one module id is a prefix of another one Collections.sort(moduleIds); Collections.reverse(moduleIds); - Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>(); + Map<String, Map<String, String>> result = new HashMap<>(); for (String moduleId : moduleIds) { result.putAll(extractPropertiesByModule(moduleId, currentModuleProperties)); } @@ -445,7 +445,7 @@ public class ProjectReactorBuilder { dirPath = pattern.substring(0, i); filePattern = pattern.substring(i + 1); } - List<IOFileFilter> filters = new ArrayList<IOFileFilter>(); + List<IOFileFilter> filters = new ArrayList<>(); if (pattern.indexOf('*') >= 0) { filters.add(FileFileFilter.FILE); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorValidator.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorValidator.java index 88970aa75da..208b5766483 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorValidator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorValidator.java @@ -61,7 +61,7 @@ public class ProjectReactorValidator { String branch = settings.getString(CoreProperties.PROJECT_BRANCH_PROPERTY); String rootProjectKey = ComponentKeys.createKey(reactor.getRoot().getKey(), branch); - List<String> validationMessages = new ArrayList<String>(); + List<String> validationMessages = new ArrayList<>(); checkDeprecatedProperties(validationMessages); for (ProjectDefinition moduleDef : reactor.getProjects()) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java index c45dd646495..5809addf3f5 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DefaultModuleFileSystem.java @@ -122,7 +122,7 @@ public class DefaultModuleFileSystem extends DefaultFileSystem implements Module } private List<File> keepOnlyDirs(List<File> dirsOrFiles) { - List<File> result = new ArrayList<File>(); + List<File> result = new ArrayList<>(); for (File f : dirsOrFiles) { if (f.isDirectory()) { result.add(f); diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java index 0e5dec4bbad..87527835a81 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java @@ -90,7 +90,7 @@ public class FileIndexer { InputFileBuilder inputFileBuilder = inputFileBuilderFactory.create(fileSystem); executorService = Executors.newFixedThreadPool(Math.max(1, Runtime.getRuntime().availableProcessors() - 1)); - tasks = new ArrayList<Future<Void>>(); + tasks = new ArrayList<>(); indexFiles(fileSystem, progress, inputFileBuilder, fileSystem.sources(), InputFile.Type.MAIN); indexFiles(fileSystem, progress, inputFileBuilder, fileSystem.tests(), InputFile.Type.TEST); diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReport.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReport.java index fb23eed4c21..5604537b15f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReport.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReport.java @@ -75,11 +75,11 @@ public class IssuesReport { } public List<ResourceReport> getResourceReports() { - return new ArrayList<ResourceReport>(resourceReportsByResource.values()); + return new ArrayList<>(resourceReportsByResource.values()); } public List<BatchResource> getResourcesWithReport() { - return new ArrayList<BatchResource>(resourceReportsByResource.keySet()); + return new ArrayList<>(resourceReportsByResource.keySet()); } public void addIssueOnResource(BatchResource resource, Issue issue, Rule rule, RulePriority severity) { diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/JSONReport.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/JSONReport.java index 3025da02f0d..11b8be7a456 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/JSONReport.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/JSONReport.java @@ -122,7 +122,7 @@ public class JSONReport implements Reporter { writeJsonIssues(json, ruleKeys, userLogins); writeJsonComponents(json); writeJsonRules(json, ruleKeys); - Collection<BatchInput.User> users = userRepository.loadFromWs(new ArrayList<String>(userLogins)); + Collection<BatchInput.User> users = userRepository.loadFromWs(new ArrayList<>(userLogins)); writeUsers(json, users); json.endObject().close(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/ReportSummary.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/ReportSummary.java index 192d8f0d9d1..18e964fa262 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/ReportSummary.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/ReportSummary.java @@ -89,7 +89,7 @@ public class ReportSummary { } public List<RuleReport> getRuleReports() { - List<RuleReport> result = new ArrayList<RuleReport>(ruleReportByRuleKey.values()); + List<RuleReport> result = new ArrayList<>(ruleReportByRuleKey.values()); Collections.sort(result, new RuleReportComparator()); return result; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/ResourceReport.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/ResourceReport.java index 18a7fc8a1e3..e48ffc3e40a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/ResourceReport.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/ResourceReport.java @@ -36,7 +36,7 @@ public final class ResourceReport { private final IssueVariation total = new IssueVariation(); private final Map<ReportRuleKey, RuleReport> ruleReportByRuleKey = Maps.newHashMap(); - private List<Issue> issues = new ArrayList<Issue>(); + private List<Issue> issues = new ArrayList<>(); private Map<Integer, List<Issue>> issuesPerLine = Maps.newHashMap(); private Map<Integer, List<Issue>> newIssuesPerLine = Maps.newHashMap(); private Map<Rule, AtomicInteger> issuesByRule = Maps.newHashMap(); @@ -146,7 +146,7 @@ public final class ResourceReport { } public List<RuleReport> getRuleReports() { - List<RuleReport> result = new ArrayList<RuleReport>(ruleReportByRuleKey.values()); + List<RuleReport> result = new ArrayList<>(ruleReportByRuleKey.values()); Collections.sort(result, new RuleReportComparator()); return result; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/SourceProvider.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/SourceProvider.java index 1f913e2b63f..bbe6106df06 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/SourceProvider.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/SourceProvider.java @@ -54,7 +54,7 @@ public class SourceProvider { try { InputFile inputFile = (InputFile) inputPathCache.getInputPath(component); List<String> lines = FileUtils.readLines(inputFile.file(), fs.encoding()); - List<String> escapedLines = new ArrayList<String>(lines.size()); + List<String> escapedLines = new ArrayList<>(lines.size()); for (String line : lines) { escapedLines.add(StringEscapeUtils.escapeHtml(line)); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/scm/DefaultBlameOutput.java b/sonar-batch/src/main/java/org/sonar/batch/scm/DefaultBlameOutput.java index d369b9efec1..399d2d3779f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scm/DefaultBlameOutput.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scm/DefaultBlameOutput.java @@ -49,7 +49,7 @@ class DefaultBlameOutput implements BlameOutput { private final BatchReportWriter writer; private final ResourceCache componentCache; - private final Set<InputFile> allFilesToBlame = new HashSet<InputFile>(); + private final Set<InputFile> allFilesToBlame = new HashSet<>(); private ProgressReport progressReport; private int count; private int total; diff --git a/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java b/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java index 526316f16f2..19e3abacd97 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java @@ -59,7 +59,7 @@ public final class ScmConfiguration implements Startable { private final ProjectReactor projectReactor; private final Settings settings; - private final Map<String, ScmProvider> providerPerKey = new LinkedHashMap<String, ScmProvider>(); + private final Map<String, ScmProvider> providerPerKey = new LinkedHashMap<>(); private final AnalysisMode analysisMode; private ScmProvider provider; diff --git a/sonar-batch/src/main/java/org/sonar/batch/scm/ScmSensor.java b/sonar-batch/src/main/java/org/sonar/batch/scm/ScmSensor.java index 51365f6d5c6..24492bbdc78 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scm/ScmSensor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scm/ScmSensor.java @@ -91,7 +91,7 @@ public final class ScmSensor implements Sensor { if (configuration.forceReloadAll()) { LOG.warn("Forced reloading of SCM data for all files."); } - List<InputFile> filesToBlame = new LinkedList<InputFile>(); + List<InputFile> filesToBlame = new LinkedList<>(); for (InputFile f : fs.inputFiles(fs.predicates().all())) { if (configuration.forceReloadAll()) { addIfNotEmpty(filesToBlame, f); diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/CodeColorizers.java b/sonar-batch/src/main/java/org/sonar/batch/source/CodeColorizers.java index c8eb840272f..46dbef1bc93 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/source/CodeColorizers.java +++ b/sonar-batch/src/main/java/org/sonar/batch/source/CodeColorizers.java @@ -53,7 +53,7 @@ public class CodeColorizers { private final Map<String, CodeColorizerFormat> byLang; public CodeColorizers(List<CodeColorizerFormat> formats) { - byLang = new HashMap<String, CodeColorizerFormat>(); + byLang = new HashMap<>(); for (CodeColorizerFormat format : formats) { byLang.put(format.getLanguageKey(), format); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolTable.java b/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolTable.java index 2ab9999bf1b..e2bbf13bfa8 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolTable.java +++ b/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolTable.java @@ -41,7 +41,7 @@ public class DefaultSymbolTable implements Symbolizable.SymbolTable { @Override public List<Symbol> symbols() { - List<Symbol> result = new ArrayList<Symbol>(); + List<Symbol> result = new ArrayList<>(); for (Symbol symbol : referencesBySymbol.keySet()) { result.add((Symbol) symbol); } @@ -55,7 +55,7 @@ public class DefaultSymbolTable implements Symbolizable.SymbolTable { public static class Builder implements Symbolizable.SymbolTableBuilder { - private final Map<Symbol, Set<TextRange>> referencesBySymbol = new LinkedHashMap<Symbol, Set<TextRange>>(); + private final Map<Symbol, Set<TextRange>> referencesBySymbol = new LinkedHashMap<>(); private final DefaultInputFile inputFile; public Builder(DefaultInputFile inputFile) { @@ -66,7 +66,7 @@ public class DefaultSymbolTable implements Symbolizable.SymbolTable { public Symbol newSymbol(int fromOffset, int toOffset) { TextRange declarationRange = inputFile.newRange(fromOffset, toOffset); DefaultSymbol symbol = new DefaultSymbol(declarationRange, toOffset - fromOffset); - referencesBySymbol.put(symbol, new TreeSet<TextRange>(new Comparator<TextRange>() { + referencesBySymbol.put(symbol, new TreeSet<>(new Comparator<TextRange>() { @Override public int compare(TextRange o1, TextRange o2) { return o1.start().compareTo(o2.start()); diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/HighlightingRenderer.java b/sonar-batch/src/main/java/org/sonar/batch/source/HighlightingRenderer.java index 6858d6de1f0..dca733fd1f8 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/source/HighlightingRenderer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/source/HighlightingRenderer.java @@ -32,7 +32,7 @@ import java.util.List; public class HighlightingRenderer { public void render(Reader code, List<? extends Channel<HtmlCodeBuilder>> tokenizers, NewHighlighting highlighting) { - List<Channel<HtmlCodeBuilder>> allTokenizers = new ArrayList<Channel<HtmlCodeBuilder>>(); + List<Channel<HtmlCodeBuilder>> allTokenizers = new ArrayList<>(); HighlightingCodeBuilder codeBuilder = new HighlightingCodeBuilder(highlighting); allTokenizers.addAll(tokenizers); |