diff options
author | David Gageot <david@gageot.net> | 2015-05-12 10:42:31 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2015-05-12 14:33:41 +0200 |
commit | 7d5701e0a327448484ccee968e12ae3d9162d407 (patch) | |
tree | 48765dedbd2125480a531d71e30801ee44d8bce9 /sonar-plugin-api | |
parent | 4bab89867b0484fa9d21d0d54e6d7687d2b2f5bf (diff) | |
download | sonarqube-7d5701e0a327448484ccee968e12ae3d9162d407.tar.gz sonarqube-7d5701e0a327448484ccee968e12ae3d9162d407.zip |
Useless code
Diffstat (limited to 'sonar-plugin-api')
31 files changed, 51 insertions, 51 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java index 9f123486313..755eecc1d70 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java @@ -77,7 +77,7 @@ public class ProjectDefinition { private static final char SEPARATOR = ','; private File baseDir, workDir, buildDir; - private Map<String, String> properties = new HashMap<String, String>(); + private Map<String, String> properties = new HashMap<>(); private ProjectDefinition parent = null; private List<ProjectDefinition> subProjects = new ArrayList<>(); private List<Object> containerExtensions = new ArrayList<>(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFilePredicates.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFilePredicates.java index 7d3d34f7642..164febb9094 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFilePredicates.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFilePredicates.java @@ -129,7 +129,7 @@ public class DefaultFilePredicates implements FilePredicates { @Override public FilePredicate hasLanguages(Collection<String> languages) { - List<FilePredicate> list = new ArrayList<FilePredicate>(); + List<FilePredicate> list = new ArrayList<>(); for (String language : languages) { list.add(hasLanguage(language)); } @@ -138,7 +138,7 @@ public class DefaultFilePredicates implements FilePredicates { @Override public FilePredicate hasLanguages(String... languages) { - List<FilePredicate> list = new ArrayList<FilePredicate>(); + List<FilePredicate> list = new ArrayList<>(); for (String language : languages) { list.add(hasLanguage(language)); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java index 719dd2f8aac..2876fdfa9ba 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java @@ -50,7 +50,7 @@ import java.util.TreeSet; public class DefaultFileSystem implements FileSystem { private final Cache cache; - private final SortedSet<String> languages = new TreeSet<String>(); + private final SortedSet<String> languages = new TreeSet<>(); private final Path baseDir; private Path workDir; private Charset encoding; @@ -256,12 +256,12 @@ public class DefaultFileSystem implements FileSystem { * Used only for testing */ private static class MapCache extends Cache { - private final Map<String, InputFile> fileMap = new HashMap<String, InputFile>(); - private final Map<String, InputDir> dirMap = new HashMap<String, InputDir>(); + private final Map<String, InputFile> fileMap = new HashMap<>(); + private final Map<String, InputDir> dirMap = new HashMap<>(); @Override public Iterable<InputFile> inputFiles() { - return new ArrayList<InputFile>(fileMap.values()); + return new ArrayList<>(fileMap.values()); } @Override diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java index 0862cfca9e8..19b101720a4 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java @@ -191,7 +191,7 @@ public class FileMetadata { private static class LineOffsetCounter extends CharHandler { private int currentOriginalOffset = 0; - private List<Integer> originalLineOffsets = new ArrayList<Integer>(); + private List<Integer> originalLineOffsets = new ArrayList<>(); private int lastValidOffset = 0; public LineOffsetCounter() { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java index 93fca999844..924832e2d6a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java @@ -37,6 +37,6 @@ public class CheckFactory { } public <C> Checks<C> create(String repository) { - return new Checks<C>(activeRules, repository); + return new Checks<>(activeRules, repository); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultActiveRules.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultActiveRules.java index 91b5cafda55..2104b3d4e50 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultActiveRules.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultActiveRules.java @@ -36,8 +36,8 @@ public class DefaultActiveRules implements ActiveRules { // TODO use disk-backed cache (persistit) instead of full in-memory cache ? private final ListMultimap<String, ActiveRule> activeRulesByRepository; - private final Map<String, Map<String, ActiveRule>> activeRulesByRepositoryAndKey = new HashMap<String, Map<String, ActiveRule>>(); - private final Map<String, Map<String, ActiveRule>> activeRulesByRepositoryAndInternalKey = new HashMap<String, Map<String, ActiveRule>>(); + private final Map<String, Map<String, ActiveRule>> activeRulesByRepositoryAndKey = new HashMap<>(); + private final Map<String, Map<String, ActiveRule>> activeRulesByRepositoryAndInternalKey = new HashMap<>(); private final ListMultimap<String, ActiveRule> activeRulesByLanguage; public DefaultActiveRules(Collection<NewActiveRule> newActiveRules) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewActiveRule.java index 07e85dc9a76..db91ca70fe4 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewActiveRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewActiveRule.java @@ -35,7 +35,7 @@ public class NewActiveRule { final RuleKey ruleKey; String name; String severity = Severity.defaultSeverity(); - Map<String, String> params = new HashMap<String, String>(); + Map<String, String> params = new HashMap<>(); String internalKey, language, templateRuleKey; private final ActiveRulesBuilder builder; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java index 213236247d2..593f859c695 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java @@ -40,7 +40,7 @@ public class NewRule { String name, description, severity = DEFAULT_SEVERITY, internalKey, debtSubCharacteristic; DebtRemediationFunction debtRemediationFunction; RuleStatus status = RuleStatus.defaultStatus(); - Map<String, NewRuleParam> params = new HashMap<String, NewRuleParam>(); + Map<String, NewRuleParam> params = new HashMap<>(); NewRule(RuleKey key) { this.key = key; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/RulesBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/RulesBuilder.java index e43f864a291..c46cb987e9f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/RulesBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/RulesBuilder.java @@ -33,7 +33,7 @@ import java.util.Map; public class RulesBuilder { - private final Map<RuleKey, NewRule> map = new HashMap<RuleKey, NewRule>(); + private final Map<RuleKey, NewRule> map = new HashMap<>(); public NewRule add(RuleKey key) { if (map.containsKey(key)) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/duplication/internal/DefaultDuplication.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/duplication/internal/DefaultDuplication.java index d9836036646..6c00e8ba33a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/duplication/internal/DefaultDuplication.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/duplication/internal/DefaultDuplication.java @@ -40,7 +40,7 @@ import java.util.List; public class DefaultDuplication extends DefaultStorable implements NewDuplication, Duplication { private Block originBlock; - private List<Block> duplicates = new LinkedList<Duplication.Block>(); + private List<Block> duplicates = new LinkedList<>(); public DefaultDuplication() { super(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java index 70f80865045..13027e24426 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorContextTester.java @@ -224,7 +224,7 @@ public class SensorContextTester implements SensorContext { if (syntaxHighlightingData == null) { return Collections.emptyList(); } - List<TypeOfText> result = new ArrayList<TypeOfText>(); + List<TypeOfText> result = new ArrayList<>(); DefaultTextPointer location = new DefaultTextPointer(line, lineOffset); for (SyntaxHighlightingRule sortedRule : syntaxHighlightingData.getSyntaxHighlightingRuleSet()) { if (sortedRule.range().start().compareTo(location) <= 0 && sortedRule.range().end().compareTo(location) > 0) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java index 4907cda4609..b07a0d400eb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java @@ -135,18 +135,18 @@ public final class PropertyDefinitions { * @since 3.7 */ public Map<Category, Map<SubCategory, Collection<PropertyDefinition>>> propertiesByCategory(@Nullable String qualifier) { - Map<Category, Map<SubCategory, Collection<PropertyDefinition>>> byCategory = new HashMap<Category, Map<SubCategory, Collection<PropertyDefinition>>>(); + Map<Category, Map<SubCategory, Collection<PropertyDefinition>>> byCategory = new HashMap<>(); if (qualifier == null) { // Special categories on global page - Map<SubCategory, Collection<PropertyDefinition>> emailSubCategories = new HashMap<SubCategory, Collection<PropertyDefinition>>(); + Map<SubCategory, Collection<PropertyDefinition>> emailSubCategories = new HashMap<>(); emailSubCategories.put(new SubCategory("email", true), new ArrayList<PropertyDefinition>()); byCategory.put(new Category(CoreProperties.CATEGORY_GENERAL, false), emailSubCategories); - HashMap<SubCategory, Collection<PropertyDefinition>> licenseSubCategories = new HashMap<SubCategory, Collection<PropertyDefinition>>(); + HashMap<SubCategory, Collection<PropertyDefinition>> licenseSubCategories = new HashMap<>(); licenseSubCategories.put(new SubCategory("server_id", true), new ArrayList<PropertyDefinition>()); byCategory.put(new Category(CoreProperties.CATEGORY_LICENSES, false), licenseSubCategories); - HashMap<SubCategory, Collection<PropertyDefinition>> encryptionSubCategories = new HashMap<SubCategory, Collection<PropertyDefinition>>(); + HashMap<SubCategory, Collection<PropertyDefinition>> encryptionSubCategories = new HashMap<>(); encryptionSubCategories.put(new SubCategory("encryption", true), new ArrayList<PropertyDefinition>()); byCategory.put(new Category(CoreProperties.CATEGORY_SECURITY, false), encryptionSubCategories); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java index ef79ca10051..42530abf132 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MeasuresFilters.java @@ -40,7 +40,7 @@ public final class MeasuresFilters { return new MeasuresFilter<Collection<Measure>>() { @Override public Collection<Measure> filter(Collection<Measure> measures) { - Collection<Measure> all = new ArrayList<Measure>(); + Collection<Measure> all = new ArrayList<>(); for (Measure measure : measures) { if (measure != null) { all.add(measure); @@ -174,7 +174,7 @@ public final class MeasuresFilters { if (measures == null) { return null; } - List<RuleMeasure> result = new ArrayList<RuleMeasure>(); + List<RuleMeasure> result = new ArrayList<>(); for (Measure measure : measures) { if (apply(measure)) { result.add((RuleMeasure) measure); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java index e53c1471b44..574c3d87ea0 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java @@ -801,7 +801,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a this.bestValue = (direction == DIRECTION_BETTER ? 100.0 : 0.0); this.worstValue = (direction == DIRECTION_BETTER ? 0.0 : 100.0); } - return new Metric<G>(this); + return new Metric<>(this); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/PropertiesBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/PropertiesBuilder.java index 3bef4b9e0c2..8f498befcca 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/PropertiesBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/PropertiesBuilder.java @@ -32,17 +32,17 @@ public class PropertiesBuilder<K, V> { private Map<K, V> props; public PropertiesBuilder(Metric metric, Map<K, V> map) { - this.props = new TreeMap<K, V>(map); + this.props = new TreeMap<>(map); this.metric = metric; } public PropertiesBuilder(Metric metric) { - this.props = new TreeMap<K, V>(); + this.props = new TreeMap<>(); this.metric = metric; } public PropertiesBuilder() { - this.props = new TreeMap<K, V>(); + this.props = new TreeMap<>(); } public PropertiesBuilder<K, V> clear() { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java index b966968e547..2b4471ef5b7 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/RangeDistributionBuilder.java @@ -223,7 +223,7 @@ public class RangeDistributionBuilder implements MeasureBuilder { */ public Measure<String> build(boolean allowEmptyData) { if (isValid && (!isEmpty || allowEmptyData)) { - return new Measure<String>(metric, KeyValueFormat.format(countBag, -1)); + return new Measure<>(metric, KeyValueFormat.format(countBag, -1)); } return null; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java index 84b971dbe92..6ac3287dd6e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java @@ -116,7 +116,7 @@ public class XMLProfileParser { } private void processRules(SMInputCursor rulesCursor, RulesProfile profile, ValidationMessages messages) throws XMLStreamException { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); while (rulesCursor.getNext() != null) { SMInputCursor ruleCursor = rulesCursor.childElementCursor(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java index d0ae370809f..cf9fc43b040 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java @@ -68,7 +68,7 @@ public class Languages { * @return the list of suffix files associates to languages included in the current object */ public String[] getSuffixes(String... keys) { - List<String> suffixes = new ArrayList<String>(); + List<String> suffixes = new ArrayList<>(); for (Map.Entry<String, Language> entry : map.entrySet()) { if (ArrayUtils.isEmpty(keys) || ArrayUtils.contains(keys, entry.getKey())) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java index 466902b61c9..14549bd4433 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java @@ -91,7 +91,7 @@ public class Project extends Resource implements Component { // modules tree private Project parent; - private List<Project> modules = new ArrayList<Project>(); + private List<Project> modules = new ArrayList<>(); public Project(String key) { setKey(key); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java index 493267a4b91..d9bc510c1fa 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java @@ -40,7 +40,7 @@ public class ActiveRule implements Cloneable { private Rule rule; private RulePriority severity; private RulesProfile rulesProfile; - private List<ActiveRuleParam> activeRuleParams = new ArrayList<ActiveRuleParam>(); + private List<ActiveRuleParam> activeRuleParams = new ArrayList<>(); private String inheritance; /** diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java index 6b7f1d79e01..0014f8df527 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java @@ -136,7 +136,7 @@ public class Rule { @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN}) @OneToMany(mappedBy = "rule") - private List<RuleParam> params = new ArrayList<RuleParam>(); + private List<RuleParam> params = new ArrayList<>(); @Temporal(TemporalType.TIMESTAMP) @Column(name = "created_at", updatable = true, nullable = true) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java index 910f56fe2fb..398d1681c65 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java @@ -125,8 +125,8 @@ public class RulesDefinitionXmlLoader { private void processRule(RulesDefinition.NewRepository repo, SMInputCursor ruleC) throws XMLStreamException { String key = null, name = null, description = null, internalKey = null, severity = Severity.defaultSeverity(), status = null; Cardinality cardinality = Cardinality.SINGLE; - List<ParamStruct> params = new ArrayList<ParamStruct>(); - List<String> tags = new ArrayList<String>(); + List<ParamStruct> params = new ArrayList<>(); + List<String> tags = new ArrayList<>(); /* BACKWARD COMPATIBILITY WITH VERY OLD FORMAT */ String keyAttribute = ruleC.getAttrValue("key"); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java index 00ba41a1d4b..23a904c46e6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java @@ -48,7 +48,7 @@ public class LocalizedMessages extends ResourceBundle { */ public LocalizedMessages(Locale locale, String... basenames) { this.locale = locale; - bundles = new ArrayList<ResourceBundle>(basenames.length); + bundles = new ArrayList<>(basenames.length); for (String basename : basenames) { bundles.add(getBundle("sonar.bundles." + basename, locale)); } @@ -108,7 +108,7 @@ public class LocalizedMessages extends ResourceBundle { } private class KeyEnumeration implements Enumeration<String> { - private Set<String> keys = new HashSet<String>(); + private Set<String> keys = new HashSet<>(); // Set iterator to simulate enumeration private Iterator<String> i; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ManifestUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ManifestUtils.java index 10f22a2523e..e8e13ce02d4 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ManifestUtils.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ManifestUtils.java @@ -41,7 +41,7 @@ public final class ManifestUtils { * @return the values, an empty list if the property is not found. */ public static List<String> getPropertyValues(ClassLoader classloader, String key) { - List<String> values = new ArrayList<String>(); + List<String> values = new ArrayList<>(); try { Enumeration<URL> resources = classloader.getResources("META-INF/MANIFEST.MF"); while (resources.hasMoreElements()) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java index 967bcd67dbb..9b753335518 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java @@ -28,9 +28,9 @@ import java.util.List; public final class ValidationMessages { - private List<String> errors = new ArrayList<String>(); - private List<String> warnings = new ArrayList<String>(); - private List<String> infos = new ArrayList<String>(); + private List<String> errors = new ArrayList<>(); + private List<String> warnings = new ArrayList<>(); + private List<String> infos = new ArrayList<>(); /** * Use the factory method <code>create()</code> diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java index 176edf7dbca..9d7aa27061e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java @@ -61,7 +61,7 @@ import org.apache.commons.lang.StringUtils; */ public class WildcardPattern { - private static final Map<String, WildcardPattern> CACHE = new HashMap<String, WildcardPattern>(); + private static final Map<String, WildcardPattern> CACHE = new HashMap<>(); private static final String SPECIAL_CHARS = "()[]^$.{}+|"; private Pattern pattern; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java index e206847699b..ea3ef78527a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java @@ -172,7 +172,7 @@ public class XpathParser { } public List<Element> getChildElements(String elementName) { - List<Element> rtrVal = new ArrayList<Element>(); + List<Element> rtrVal = new ArrayList<>(); NodeList childrens = getRoot().getElementsByTagName(elementName); for (int i = 0; i < childrens.getLength(); i++) { Node nde = childrens.item(i); @@ -184,7 +184,7 @@ public class XpathParser { } public List<Element> getChildElements(Element base, String elementName) { - List<Element> rtrVal = new ArrayList<Element>(); + List<Element> rtrVal = new ArrayList<>(); NodeList childrens = base.getElementsByTagName(elementName); for (int i = 0; i < childrens.getLength(); i++) { Node nde = childrens.item(i); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/DirectAcyclicGraph.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/DirectAcyclicGraph.java index 76595f08550..c9c7d2a598b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/DirectAcyclicGraph.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/DirectAcyclicGraph.java @@ -34,8 +34,8 @@ import java.util.Map; */ public class DirectAcyclicGraph { - private Map<Object, Node> registeredObjects = new HashMap<Object, Node>(); - private List<Node> nodes = new ArrayList<Node>(); + private Map<Object, Node> registeredObjects = new HashMap<>(); + private List<Node> nodes = new ArrayList<>(); public DirectAcyclicGraph(final Object... objects) { if (objects != null) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java index db391a688f0..bb29ba99d87 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java @@ -32,7 +32,7 @@ public class Node implements Comparable<Node> { private final Object object; private int order = 0; private boolean seen = false; - private final List<Node> dependencies = new ArrayList<Node>(); + private final List<Node> dependencies = new ArrayList<>(); public Node(final Object object) { if (object == null) { diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/PropertiesBuilderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/PropertiesBuilderTest.java index d540ddb1a61..f7e89fd07f3 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/measures/PropertiesBuilderTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/measures/PropertiesBuilderTest.java @@ -27,7 +27,7 @@ import org.junit.Test; public class PropertiesBuilderTest { @Test public void buildMeasure() { - PropertiesBuilder<Integer, Integer> builder = new PropertiesBuilder<Integer, Integer>(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION); + PropertiesBuilder<Integer, Integer> builder = new PropertiesBuilder<>(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION); Measure measure = builder .add(1, 30) .add(2, 27) @@ -39,7 +39,7 @@ public class PropertiesBuilderTest { @Test public void sortKeys() { - PropertiesBuilder<String, String> builder = new PropertiesBuilder<String, String>(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION); + PropertiesBuilder<String, String> builder = new PropertiesBuilder<>(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION); Measure measure = builder .add("foo", "fooooo") .add("bar", "baaaaar") @@ -51,7 +51,7 @@ public class PropertiesBuilderTest { @Test public void valueIsOptional() { - PropertiesBuilder<String, String> builder = new PropertiesBuilder<String, String>(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION); + PropertiesBuilder<String, String> builder = new PropertiesBuilder<>(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION); Measure measure = builder .add("foo", null) .add("bar", "bar") @@ -63,7 +63,7 @@ public class PropertiesBuilderTest { @Test public void clearBeforeBuildingOtherMeasure() { - PropertiesBuilder<String, String> builder = new PropertiesBuilder<String, String>(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION); + PropertiesBuilder<String, String> builder = new PropertiesBuilder<>(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION); builder .add("foo", "foo") .add("bar", "bar") diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java index fa36ab4986b..ddc5e569528 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java @@ -56,7 +56,7 @@ public class UserQueryTest { @Test public void should_limit_number_of_logins() { - List<String> logins = new ArrayList<String>(); + List<String> logins = new ArrayList<>(); for (int i = 0; i < 1010; i++) { logins.add(String.valueOf(i)); } |