Cleanup and format code
This commit is contained in:
@@ -62,7 +62,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
public AutoConfigureAnnotationProcessor() {
|
||||
Map<String, String> annotations = new LinkedHashMap<String, String>();
|
||||
Map<String, String> annotations = new LinkedHashMap<>();
|
||||
addAnnotations(annotations);
|
||||
this.annotations = Collections.unmodifiableMap(annotations);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<Object> getValues(AnnotationMirror annotation) {
|
||||
List<Object> result = new ArrayList<Object>();
|
||||
List<Object> result = new ArrayList<>();
|
||||
for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annotation
|
||||
.getElementValues().entrySet()) {
|
||||
String attributeName = entry.getKey().getSimpleName().toString();
|
||||
|
||||
@@ -71,7 +71,7 @@ public class AutoConfigureAnnotationProcessorTests {
|
||||
@Test
|
||||
public void annotatedMethod() throws Exception {
|
||||
Properties properties = compile(TestMethodConfiguration.class);
|
||||
List<String> matching = new ArrayList<String>();
|
||||
List<String> matching = new ArrayList<>();
|
||||
for (Object key : properties.keySet()) {
|
||||
if (key.toString().startsWith(
|
||||
"org.springframework.boot.autoconfigureprocessor.TestMethodConfiguration")) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,9 +34,9 @@ public class ConfigurationMetadataGroup implements Serializable {
|
||||
|
||||
private final String id;
|
||||
|
||||
private final Map<String, ConfigurationMetadataSource> sources = new HashMap<String, ConfigurationMetadataSource>();
|
||||
private final Map<String, ConfigurationMetadataSource> sources = new HashMap<>();
|
||||
|
||||
private final Map<String, ConfigurationMetadataProperty> properties = new HashMap<String, ConfigurationMetadataProperty>();
|
||||
private final Map<String, ConfigurationMetadataProperty> properties = new HashMap<>();
|
||||
|
||||
public ConfigurationMetadataGroup(String id) {
|
||||
this.id = id;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,9 +33,9 @@ class ConfigurationMetadataHint {
|
||||
|
||||
private String id;
|
||||
|
||||
private final List<ValueHint> valueHints = new ArrayList<ValueHint>();
|
||||
private final List<ValueHint> valueHints = new ArrayList<>();
|
||||
|
||||
private final List<ValueProvider> valueProviders = new ArrayList<ValueProvider>();
|
||||
private final List<ValueProvider> valueProviders = new ArrayList<>();
|
||||
|
||||
public boolean isMapKeyHints() {
|
||||
return (this.id != null && this.id.endsWith(KEY_SUFFIX));
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class ConfigurationMetadataRepositoryJsonBuilder {
|
||||
|
||||
private final JsonReader reader = new JsonReader();
|
||||
|
||||
private final List<SimpleConfigurationMetadataRepository> repositories = new ArrayList<SimpleConfigurationMetadataRepository>();
|
||||
private final List<SimpleConfigurationMetadataRepository> repositories = new ArrayList<>();
|
||||
|
||||
private ConfigurationMetadataRepositoryJsonBuilder(Charset defaultCharset) {
|
||||
this.defaultCharset = defaultCharset;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ public class ConfigurationMetadataSource implements Serializable {
|
||||
|
||||
private String sourceMethod;
|
||||
|
||||
private final Map<String, ConfigurationMetadataProperty> properties = new HashMap<String, ConfigurationMetadataProperty>();
|
||||
private final Map<String, ConfigurationMetadataProperty> properties = new HashMap<>();
|
||||
|
||||
/**
|
||||
* The identifier of the group to which this source is associated.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,13 +29,13 @@ import java.util.List;
|
||||
*/
|
||||
public class Hints {
|
||||
|
||||
private final List<ValueHint> keyHints = new ArrayList<ValueHint>();
|
||||
private final List<ValueHint> keyHints = new ArrayList<>();
|
||||
|
||||
private final List<ValueProvider> keyProviders = new ArrayList<ValueProvider>();
|
||||
private final List<ValueProvider> keyProviders = new ArrayList<>();
|
||||
|
||||
private final List<ValueHint> valueHints = new ArrayList<ValueHint>();
|
||||
private final List<ValueHint> valueHints = new ArrayList<>();
|
||||
|
||||
private final List<ValueProvider> valueProviders = new ArrayList<ValueProvider>();
|
||||
private final List<ValueProvider> valueProviders = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* The list of well-defined keys, if any. Only applicable if the type of the related
|
||||
|
||||
@@ -61,7 +61,7 @@ class JsonReader {
|
||||
|
||||
private List<ConfigurationMetadataSource> parseAllSources(JSONObject root)
|
||||
throws Exception {
|
||||
List<ConfigurationMetadataSource> result = new ArrayList<ConfigurationMetadataSource>();
|
||||
List<ConfigurationMetadataSource> result = new ArrayList<>();
|
||||
if (!root.has("groups")) {
|
||||
return result;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class JsonReader {
|
||||
|
||||
private List<ConfigurationMetadataItem> parseAllItems(JSONObject root)
|
||||
throws Exception {
|
||||
List<ConfigurationMetadataItem> result = new ArrayList<ConfigurationMetadataItem>();
|
||||
List<ConfigurationMetadataItem> result = new ArrayList<>();
|
||||
if (!root.has("properties")) {
|
||||
return result;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class JsonReader {
|
||||
|
||||
private List<ConfigurationMetadataHint> parseAllHints(JSONObject root)
|
||||
throws Exception {
|
||||
List<ConfigurationMetadataHint> result = new ArrayList<ConfigurationMetadataHint>();
|
||||
List<ConfigurationMetadataHint> result = new ArrayList<>();
|
||||
if (!root.has("hints")) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,9 +36,9 @@ class RawConfigurationMetadata {
|
||||
RawConfigurationMetadata(List<ConfigurationMetadataSource> sources,
|
||||
List<ConfigurationMetadataItem> items,
|
||||
List<ConfigurationMetadataHint> hints) {
|
||||
this.sources = new ArrayList<ConfigurationMetadataSource>(sources);
|
||||
this.items = new ArrayList<ConfigurationMetadataItem>(items);
|
||||
this.hints = new ArrayList<ConfigurationMetadataHint>(hints);
|
||||
this.sources = new ArrayList<>(sources);
|
||||
this.items = new ArrayList<>(items);
|
||||
this.hints = new ArrayList<>(hints);
|
||||
for (ConfigurationMetadataItem item : this.items) {
|
||||
resolveName(item);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,7 @@ import java.util.Map;
|
||||
public class SimpleConfigurationMetadataRepository
|
||||
implements ConfigurationMetadataRepository, Serializable {
|
||||
|
||||
private final Map<String, ConfigurationMetadataGroup> allGroups = new HashMap<String, ConfigurationMetadataGroup>();
|
||||
private final Map<String, ConfigurationMetadataGroup> allGroups = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public Map<String, ConfigurationMetadataGroup> getAllGroups() {
|
||||
@@ -41,7 +41,7 @@ public class SimpleConfigurationMetadataRepository
|
||||
|
||||
@Override
|
||||
public Map<String, ConfigurationMetadataProperty> getAllProperties() {
|
||||
Map<String, ConfigurationMetadataProperty> properties = new HashMap<String, ConfigurationMetadataProperty>();
|
||||
Map<String, ConfigurationMetadataProperty> properties = new HashMap<>();
|
||||
for (ConfigurationMetadataGroup group : this.allGroups.values()) {
|
||||
properties.putAll(group.getProperties());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,7 +35,7 @@ public class ValueProvider implements Serializable {
|
||||
|
||||
private String name;
|
||||
|
||||
private final Map<String, Object> parameters = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> parameters = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Return the name of the provider.
|
||||
|
||||
@@ -385,7 +385,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
|
||||
}
|
||||
|
||||
private Map<String, Object> getAnnotationElementValues(AnnotationMirror annotation) {
|
||||
Map<String, Object> values = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> values = new LinkedHashMap<>();
|
||||
for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annotation
|
||||
.getElementValues().entrySet()) {
|
||||
values.put(entry.getKey().getSimpleName().toString(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ import org.springframework.boot.configurationprocessor.metadata.ItemMetadata;
|
||||
*/
|
||||
public class MetadataCollector {
|
||||
|
||||
private final List<ItemMetadata> metadataItems = new ArrayList<ItemMetadata>();
|
||||
private final List<ItemMetadata> metadataItems = new ArrayList<>();
|
||||
|
||||
private final ProcessingEnvironment processingEnvironment;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class MetadataCollector {
|
||||
|
||||
private final TypeUtils typeUtils;
|
||||
|
||||
private final Set<String> processedSourceTypes = new HashSet<String>();
|
||||
private final Set<String> processedSourceTypes = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Creates a new {@code MetadataProcessor} instance.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,13 +49,13 @@ class TypeElementMembers {
|
||||
|
||||
private final TypeUtils typeUtils;
|
||||
|
||||
private final Map<String, VariableElement> fields = new LinkedHashMap<String, VariableElement>();
|
||||
private final Map<String, VariableElement> fields = new LinkedHashMap<>();
|
||||
|
||||
private final Map<String, ExecutableElement> publicGetters = new LinkedHashMap<String, ExecutableElement>();
|
||||
private final Map<String, ExecutableElement> publicGetters = new LinkedHashMap<>();
|
||||
|
||||
private final Map<String, List<ExecutableElement>> publicSetters = new LinkedHashMap<String, List<ExecutableElement>>();
|
||||
private final Map<String, List<ExecutableElement>> publicSetters = new LinkedHashMap<>();
|
||||
|
||||
private final Map<String, Object> fieldValues = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> fieldValues = new LinkedHashMap<>();
|
||||
|
||||
private final FieldValuesParser fieldValuesParser;
|
||||
|
||||
@@ -107,7 +107,7 @@ class TypeElementMembers {
|
||||
List<ExecutableElement> matchingSetters = this.publicSetters
|
||||
.get(propertyName);
|
||||
if (matchingSetters == null) {
|
||||
matchingSetters = new ArrayList<ExecutableElement>();
|
||||
matchingSetters = new ArrayList<>();
|
||||
this.publicSetters.put(propertyName, matchingSetters);
|
||||
}
|
||||
TypeMirror paramType = method.getParameters().get(0).asType();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,7 @@ import javax.lang.model.type.TypeMirror;
|
||||
*/
|
||||
class TypeExcludeFilter {
|
||||
|
||||
private final Set<String> excludes = new HashSet<String>();
|
||||
private final Set<String> excludes = new HashSet<>();
|
||||
|
||||
TypeExcludeFilter() {
|
||||
add("com.zaxxer.hikari.IConnectionCustomizer");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ class TypeUtils {
|
||||
private static final Map<TypeKind, Class<?>> PRIMITIVE_WRAPPERS;
|
||||
|
||||
static {
|
||||
Map<TypeKind, Class<?>> wrappers = new HashMap<TypeKind, Class<?>>();
|
||||
Map<TypeKind, Class<?>> wrappers = new HashMap<>();
|
||||
wrappers.put(TypeKind.BOOLEAN, Boolean.class);
|
||||
wrappers.put(TypeKind.BYTE, Byte.class);
|
||||
wrappers.put(TypeKind.CHAR, Character.class);
|
||||
@@ -56,7 +56,7 @@ class TypeUtils {
|
||||
private static final Map<String, TypeKind> WRAPPER_TO_PRIMITIVE;
|
||||
|
||||
static {
|
||||
Map<String, TypeKind> primitives = new HashMap<String, TypeKind>();
|
||||
Map<String, TypeKind> primitives = new HashMap<>();
|
||||
for (Map.Entry<TypeKind, Class<?>> entry : PRIMITIVE_WRAPPERS.entrySet()) {
|
||||
primitives.put(entry.getValue().getName(), entry.getKey());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -75,7 +75,7 @@ class ExpressionTree extends ReflectionWrapper {
|
||||
public List<? extends ExpressionTree> getArrayExpression() throws Exception {
|
||||
if (this.newArrayTreeType.isAssignableFrom(getInstance().getClass())) {
|
||||
List<?> elements = (List<?>) this.arrayValueMethod.invoke(getInstance());
|
||||
List<ExpressionTree> result = new ArrayList<ExpressionTree>();
|
||||
List<ExpressionTree> result = new ArrayList<>();
|
||||
if (elements == null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,7 +62,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser {
|
||||
private static final Map<String, Class<?>> WRAPPER_TYPES;
|
||||
|
||||
static {
|
||||
Map<String, Class<?>> types = new HashMap<String, Class<?>>();
|
||||
Map<String, Class<?>> types = new HashMap<>();
|
||||
types.put("boolean", Boolean.class);
|
||||
types.put(Boolean.class.getName(), Boolean.class);
|
||||
types.put("byte", Byte.class);
|
||||
@@ -79,7 +79,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser {
|
||||
private static final Map<Class<?>, Object> DEFAULT_TYPE_VALUES;
|
||||
|
||||
static {
|
||||
Map<Class<?>, Object> values = new HashMap<Class<?>, Object>();
|
||||
Map<Class<?>, Object> values = new HashMap<>();
|
||||
values.put(Boolean.class, false);
|
||||
values.put(Byte.class, (byte) 0);
|
||||
values.put(Short.class, (short) 0);
|
||||
@@ -91,15 +91,15 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser {
|
||||
private static final Map<String, Object> WELL_KNOWN_STATIC_FINALS;
|
||||
|
||||
static {
|
||||
Map<String, Object> values = new HashMap<String, Object>();
|
||||
Map<String, Object> values = new HashMap<>();
|
||||
values.put("Boolean.TRUE", true);
|
||||
values.put("Boolean.FALSE", false);
|
||||
WELL_KNOWN_STATIC_FINALS = Collections.unmodifiableMap(values);
|
||||
}
|
||||
|
||||
private final Map<String, Object> fieldValues = new HashMap<String, Object>();
|
||||
private final Map<String, Object> fieldValues = new HashMap<>();
|
||||
|
||||
private final Map<String, Object> staticFinals = new HashMap<String, Object>();
|
||||
private final Map<String, Object> staticFinals = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void visitVariable(VariableTree variable) throws Exception {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ConfigurationMetadata {
|
||||
|
||||
static {
|
||||
List<Character> chars = Arrays.asList('-', '_');
|
||||
SEPARATORS = Collections.unmodifiableSet(new HashSet<Character>(chars));
|
||||
SEPARATORS = Collections.unmodifiableSet(new HashSet<>(chars));
|
||||
}
|
||||
|
||||
private final Map<String, List<ItemMetadata>> items;
|
||||
@@ -48,13 +48,13 @@ public class ConfigurationMetadata {
|
||||
private final Map<String, List<ItemHint>> hints;
|
||||
|
||||
public ConfigurationMetadata() {
|
||||
this.items = new LinkedHashMap<String, List<ItemMetadata>>();
|
||||
this.hints = new LinkedHashMap<String, List<ItemHint>>();
|
||||
this.items = new LinkedHashMap<>();
|
||||
this.hints = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
public ConfigurationMetadata(ConfigurationMetadata metadata) {
|
||||
this.items = new LinkedHashMap<String, List<ItemMetadata>>(metadata.items);
|
||||
this.hints = new LinkedHashMap<String, List<ItemHint>>(metadata.hints);
|
||||
this.items = new LinkedHashMap<>(metadata.items);
|
||||
this.hints = new LinkedHashMap<>(metadata.hints);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +135,7 @@ public class ConfigurationMetadata {
|
||||
private <K, V> void add(Map<K, List<V>> map, K key, V value) {
|
||||
List<V> values = map.get(key);
|
||||
if (values == null) {
|
||||
values = new ArrayList<V>();
|
||||
values = new ArrayList<>();
|
||||
map.put(key, values);
|
||||
}
|
||||
values.add(value);
|
||||
@@ -198,7 +198,7 @@ public class ConfigurationMetadata {
|
||||
}
|
||||
|
||||
private static <T extends Comparable<T>> List<T> flattenValues(Map<?, List<T>> map) {
|
||||
List<T> content = new ArrayList<T>();
|
||||
List<T> content = new ArrayList<>();
|
||||
for (List<T> values : map.values()) {
|
||||
content.addAll(values);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,10 +44,9 @@ public class ItemHint implements Comparable<ItemHint> {
|
||||
|
||||
public ItemHint(String name, List<ValueHint> values, List<ValueProvider> providers) {
|
||||
this.name = toCanonicalName(name);
|
||||
this.values = (values != null ? new ArrayList<ValueHint>(values)
|
||||
: new ArrayList<ValueHint>());
|
||||
this.providers = (providers != null ? new ArrayList<ValueProvider>(providers)
|
||||
: new ArrayList<ValueProvider>());
|
||||
this.values = (values != null ? new ArrayList<>(values) : new ArrayList<>());
|
||||
this.providers = (providers != null ? new ArrayList<>(providers)
|
||||
: new ArrayList<>());
|
||||
}
|
||||
|
||||
private String toCanonicalName(String name) {
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.json.JSONObject;
|
||||
@SuppressWarnings("rawtypes")
|
||||
class JSONOrderedObject extends JSONObject {
|
||||
|
||||
private Set<String> keys = new LinkedHashSet<String>();
|
||||
private Set<String> keys = new LinkedHashSet<>();
|
||||
|
||||
@Override
|
||||
public JSONObject put(String key, Object value) throws JSONException {
|
||||
|
||||
@@ -118,14 +118,14 @@ public class JsonMarshaller {
|
||||
|
||||
private ItemHint toItemHint(JSONObject object) throws Exception {
|
||||
String name = object.getString("name");
|
||||
List<ItemHint.ValueHint> values = new ArrayList<ItemHint.ValueHint>();
|
||||
List<ItemHint.ValueHint> values = new ArrayList<>();
|
||||
if (object.has("values")) {
|
||||
JSONArray valuesArray = object.getJSONArray("values");
|
||||
for (int i = 0; i < valuesArray.length(); i++) {
|
||||
values.add(toValueHint((JSONObject) valuesArray.get(i)));
|
||||
}
|
||||
}
|
||||
List<ItemHint.ValueProvider> providers = new ArrayList<ItemHint.ValueProvider>();
|
||||
List<ItemHint.ValueProvider> providers = new ArrayList<>();
|
||||
if (object.has("providers")) {
|
||||
JSONArray providersObject = object.getJSONArray("providers");
|
||||
for (int i = 0; i < providersObject.length(); i++) {
|
||||
@@ -143,7 +143,7 @@ public class JsonMarshaller {
|
||||
|
||||
private ItemHint.ValueProvider toValueProvider(JSONObject object) throws Exception {
|
||||
String name = object.getString("name");
|
||||
Map<String, Object> parameters = new HashMap<String, Object>();
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
if (object.has("parameters")) {
|
||||
JSONObject parametersObject = object.getJSONObject("parameters");
|
||||
for (Iterator<?> iterator = parametersObject.keys(); iterator.hasNext();) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -296,7 +296,7 @@ public final class Metadata {
|
||||
}
|
||||
|
||||
private <T> List<T> add(List<T> items, T item) {
|
||||
List<T> result = new ArrayList<T>(items);
|
||||
List<T> result = new ArrayList<>(items);
|
||||
result.add(item);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class TestProject {
|
||||
|
||||
private TestCompiler compiler;
|
||||
|
||||
private Set<File> sourceFiles = new LinkedHashSet<File>();
|
||||
private Set<File> sourceFiles = new LinkedHashSet<>();
|
||||
|
||||
public TestProject(TemporaryFolder tempFolder, Class<?>... classes)
|
||||
throws IOException {
|
||||
@@ -74,7 +74,7 @@ public class TestProject {
|
||||
return TestProject.this.sourceFolder;
|
||||
}
|
||||
};
|
||||
Set<Class<?>> contents = new HashSet<Class<?>>(Arrays.asList(classes));
|
||||
Set<Class<?>> contents = new HashSet<>(Arrays.asList(classes));
|
||||
contents.addAll(Arrays.asList(ALWAYS_INCLUDE));
|
||||
copySources(contents);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class AbstractFieldValuesProcessorTests {
|
||||
|
||||
private FieldValuesParser processor;
|
||||
|
||||
private Map<String, Object> values = new HashMap<String, Object>();
|
||||
private Map<String, Object> values = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public synchronized void init(ProcessingEnvironment env) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -56,7 +56,7 @@ public class LombokExplicitProperties {
|
||||
private Integer number = 0;
|
||||
|
||||
@Getter
|
||||
private final List<String> items = new ArrayList<String>();
|
||||
private final List<String> items = new ArrayList<>();
|
||||
|
||||
// Should be ignored if no annotation is set
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,7 +47,7 @@ public class LombokSimpleDataProperties {
|
||||
@Deprecated
|
||||
private Integer number = 0;
|
||||
|
||||
private final List<String> items = new ArrayList<String>();
|
||||
private final List<String> items = new ArrayList<>();
|
||||
|
||||
private final String ignored = "foo";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public class LombokSimpleProperties {
|
||||
@Deprecated
|
||||
private Integer number = 0;
|
||||
|
||||
private final List<String> items = new ArrayList<String>();
|
||||
private final List<String> items = new ArrayList<>();
|
||||
|
||||
private final String ignored = "foo";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,11 +39,11 @@ public class SimpleCollectionProperties {
|
||||
|
||||
private List<Float> floats;
|
||||
|
||||
private final Map<String, Integer> namesToIntegers = new HashMap<String, Integer>();
|
||||
private final Map<String, Integer> namesToIntegers = new HashMap<>();
|
||||
|
||||
private final Collection<Byte> bytes = new LinkedHashSet<Byte>();
|
||||
private final Collection<Byte> bytes = new LinkedHashSet<>();
|
||||
|
||||
private final List<Double> doubles = new ArrayList<Double>();
|
||||
private final List<Double> doubles = new ArrayList<>();
|
||||
|
||||
public Map<Integer, String> getIntegersToNames() {
|
||||
return this.integersToNames;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,11 +42,11 @@ public class GenericConfig<T> {
|
||||
private String name;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
private final Bar<String> bar = new Bar<String>();
|
||||
private final Bar<String> bar = new Bar<>();
|
||||
|
||||
private final Map<String, Bar<Integer>> stringToBar = new HashMap<String, Bar<Integer>>();
|
||||
private final Map<String, Bar<Integer>> stringToBar = new HashMap<>();
|
||||
|
||||
private final Map<String, Integer> stringToInteger = new HashMap<String, Integer>();
|
||||
private final Map<String, Integer> stringToInteger = new HashMap<>();
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
@@ -75,7 +75,7 @@ public class GenericConfig<T> {
|
||||
private String name;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
private final Biz<String> biz = new Biz<String>();
|
||||
private final Biz<String> biz = new Biz<>();
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ public class BuildInfo extends DefaultTask {
|
||||
private String projectName = getProject().getName();
|
||||
|
||||
@Input
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
private Map<String, Object> additionalProperties = new HashMap<>();
|
||||
|
||||
@TaskAction
|
||||
public void generateBuildProperties() {
|
||||
@@ -127,7 +127,7 @@ public class BuildInfo extends DefaultTask {
|
||||
}
|
||||
|
||||
private Map<String, String> coerceToStringValues(Map<String, Object> input) {
|
||||
Map<String, String> output = new HashMap<String, String>();
|
||||
Map<String, String> output = new HashMap<>();
|
||||
for (Entry<String, Object> entry : input.entrySet()) {
|
||||
output.put(entry.getKey(), entry.getValue().toString());
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ class ProjectLibraries implements Libraries {
|
||||
if (configuration == null) {
|
||||
return null;
|
||||
}
|
||||
Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
|
||||
Set<GradleLibrary> libraries = new LinkedHashSet<>();
|
||||
for (ResolvedArtifact artifact : configuration.getResolvedConfiguration()
|
||||
.getResolvedArtifacts()) {
|
||||
libraries.add(new ResolvedArtifactLibrary(artifact, scope));
|
||||
@@ -130,7 +130,7 @@ class ProjectLibraries implements Libraries {
|
||||
|
||||
private Set<GradleLibrary> getLibrariesForFileDependencies(
|
||||
Configuration configuration, LibraryScope scope) {
|
||||
Set<GradleLibrary> libraries = new LinkedHashSet<GradleLibrary>();
|
||||
Set<GradleLibrary> libraries = new LinkedHashSet<>();
|
||||
for (Dependency dependency : configuration.getIncoming().getDependencies()) {
|
||||
if (dependency instanceof FileCollectionDependency) {
|
||||
FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
|
||||
@@ -156,11 +156,11 @@ class ProjectLibraries implements Libraries {
|
||||
if (source == null || toRemove == null) {
|
||||
return source;
|
||||
}
|
||||
Set<File> filesToRemove = new HashSet<File>();
|
||||
Set<File> filesToRemove = new HashSet<>();
|
||||
for (GradleLibrary library : toRemove) {
|
||||
filesToRemove.add(library.getFile());
|
||||
}
|
||||
Set<GradleLibrary> result = new LinkedHashSet<GradleLibrary>();
|
||||
Set<GradleLibrary> result = new LinkedHashSet<>();
|
||||
for (GradleLibrary library : source) {
|
||||
if (!filesToRemove.contains(library.getFile())) {
|
||||
result.add(library);
|
||||
@@ -195,8 +195,8 @@ class ProjectLibraries implements Libraries {
|
||||
}
|
||||
|
||||
private Set<String> getDuplicates(Set<GradleLibrary> libraries) {
|
||||
Set<String> duplicates = new HashSet<String>();
|
||||
Set<String> seen = new HashSet<String>();
|
||||
Set<String> duplicates = new HashSet<>();
|
||||
Set<String> seen = new HashSet<>();
|
||||
for (GradleLibrary library : libraries) {
|
||||
if (library.getFile() != null && !seen.add(library.getFile().getName())) {
|
||||
duplicates.add(library.getFile().getName());
|
||||
|
||||
@@ -193,7 +193,7 @@ public class RepackageTask extends DefaultTask {
|
||||
private boolean isTaskMatch(Jar task, Object withJarTask) {
|
||||
if (withJarTask == null) {
|
||||
if ("".equals(task.getClassifier())) {
|
||||
Set<Object> tasksWithCustomRepackaging = new HashSet<Object>();
|
||||
Set<Object> tasksWithCustomRepackaging = new HashSet<>();
|
||||
for (RepackageTask repackageTask : RepackageTask.this.getProject()
|
||||
.getTasks().withType(RepackageTask.class)) {
|
||||
if (repackageTask.getWithJarTask() != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -67,11 +67,11 @@ public class BootRunTask extends JavaExec {
|
||||
SourceSet mainSourceSet = SourceSets.findMainSourceSet(getProject());
|
||||
final File outputDir = (mainSourceSet == null ? null
|
||||
: mainSourceSet.getOutput().getResourcesDir());
|
||||
final Set<File> resources = new LinkedHashSet<File>();
|
||||
final Set<File> resources = new LinkedHashSet<>();
|
||||
if (mainSourceSet != null) {
|
||||
resources.addAll(mainSourceSet.getResources().getSrcDirs());
|
||||
}
|
||||
List<File> classPath = new ArrayList<File>(getClasspath().getFiles());
|
||||
List<File> classPath = new ArrayList<>(getClasspath().getFiles());
|
||||
classPath.addAll(0, resources);
|
||||
getLogger().info("Adding classpath: " + resources);
|
||||
setClasspath(new SimpleFileCollection(classPath));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public class JarWriter implements LoaderClassesWriter {
|
||||
|
||||
private final JarOutputStream jarOutput;
|
||||
|
||||
private final Set<String> writtenEntries = new HashSet<String>();
|
||||
private final Set<String> writtenEntries = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Create a new {@link JarWriter} instance.
|
||||
@@ -89,7 +89,7 @@ public class JarWriter implements LoaderClassesWriter {
|
||||
private void setExecutableFilePermission(File file) {
|
||||
try {
|
||||
Path path = file.toPath();
|
||||
Set<PosixFilePermission> permissions = new HashSet<PosixFilePermission>(
|
||||
Set<PosixFilePermission> permissions = new HashSet<>(
|
||||
Files.getPosixFilePermissions(path));
|
||||
permissions.add(PosixFilePermission.OWNER_EXECUTE);
|
||||
Files.setPosixFilePermissions(path, permissions);
|
||||
|
||||
@@ -123,7 +123,7 @@ public final class Layouts {
|
||||
private static final Map<LibraryScope, String> SCOPE_DESTINATIONS;
|
||||
|
||||
static {
|
||||
Map<LibraryScope, String> map = new HashMap<LibraryScope, String>();
|
||||
Map<LibraryScope, String> map = new HashMap<>();
|
||||
map.put(LibraryScope.COMPILE, "WEB-INF/lib/");
|
||||
map.put(LibraryScope.CUSTOM, "WEB-INF/lib/");
|
||||
map.put(LibraryScope.RUNTIME, "WEB-INF/lib/");
|
||||
|
||||
@@ -136,7 +136,7 @@ public abstract class MainClassFinder {
|
||||
"Invalid root folder '" + rootFolder + "'");
|
||||
}
|
||||
String prefix = rootFolder.getAbsolutePath() + "/";
|
||||
Deque<File> stack = new ArrayDeque<File>();
|
||||
Deque<File> stack = new ArrayDeque<>();
|
||||
stack.push(rootFolder);
|
||||
while (!stack.isEmpty()) {
|
||||
File file = stack.pop();
|
||||
@@ -275,7 +275,7 @@ public abstract class MainClassFinder {
|
||||
String classesLocation) {
|
||||
classesLocation = (classesLocation != null ? classesLocation : "");
|
||||
Enumeration<JarEntry> sourceEntries = source.entries();
|
||||
List<JarEntry> classEntries = new ArrayList<JarEntry>();
|
||||
List<JarEntry> classEntries = new ArrayList<>();
|
||||
while (sourceEntries.hasMoreElements()) {
|
||||
JarEntry entry = sourceEntries.nextElement();
|
||||
if (entry.getName().startsWith(classesLocation)
|
||||
@@ -319,7 +319,7 @@ public abstract class MainClassFinder {
|
||||
|
||||
private static class ClassDescriptor extends ClassVisitor {
|
||||
|
||||
private final Set<String> annotationNames = new LinkedHashSet<String>();
|
||||
private final Set<String> annotationNames = new LinkedHashSet<>();
|
||||
|
||||
private boolean mainMethodFound;
|
||||
|
||||
@@ -398,7 +398,7 @@ public abstract class MainClassFinder {
|
||||
MainClass(String name, Set<String> annotationNames) {
|
||||
this.name = name;
|
||||
this.annotationNames = Collections
|
||||
.unmodifiableSet(new HashSet<String>(annotationNames));
|
||||
.unmodifiableSet(new HashSet<>(annotationNames));
|
||||
}
|
||||
|
||||
String getName() {
|
||||
@@ -446,7 +446,7 @@ public abstract class MainClassFinder {
|
||||
private static final class SingleMainClassCallback
|
||||
implements MainClassCallback<Object> {
|
||||
|
||||
private final Set<MainClass> mainClasses = new LinkedHashSet<MainClass>();
|
||||
private final Set<MainClass> mainClasses = new LinkedHashSet<>();
|
||||
|
||||
private final String annotationName;
|
||||
|
||||
@@ -461,7 +461,7 @@ public abstract class MainClassFinder {
|
||||
}
|
||||
|
||||
private String getMainClassName() {
|
||||
Set<MainClass> matchingMainClasses = new LinkedHashSet<MainClass>();
|
||||
Set<MainClass> matchingMainClasses = new LinkedHashSet<>();
|
||||
if (this.annotationName != null) {
|
||||
for (MainClass mainClass : this.mainClasses) {
|
||||
if (mainClass.getAnnotationNames().contains(this.annotationName)) {
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Repackager {
|
||||
|
||||
private static final String SPRING_BOOT_APPLICATION_CLASS_NAME = "org.springframework.boot.autoconfigure.SpringBootApplication";
|
||||
|
||||
private List<MainClassTimeoutWarningListener> mainClassTimeoutListeners = new ArrayList<MainClassTimeoutWarningListener>();
|
||||
private List<MainClassTimeoutWarningListener> mainClassTimeoutListeners = new ArrayList<>();
|
||||
|
||||
private String mainClass;
|
||||
|
||||
@@ -236,8 +236,8 @@ public class Repackager {
|
||||
LaunchScript launchScript) throws IOException {
|
||||
JarWriter writer = new JarWriter(destination, launchScript);
|
||||
try {
|
||||
final List<Library> unpackLibraries = new ArrayList<Library>();
|
||||
final List<Library> standardLibraries = new ArrayList<Library>();
|
||||
final List<Library> unpackLibraries = new ArrayList<>();
|
||||
final List<Library> standardLibraries = new ArrayList<>();
|
||||
libraries.doWithLibraries(new LibraryCallback() {
|
||||
|
||||
@Override
|
||||
@@ -270,7 +270,7 @@ public class Repackager {
|
||||
final List<Library> unpackLibraries, final List<Library> standardLibraries)
|
||||
throws IOException {
|
||||
writer.writeManifest(buildManifest(sourceJar));
|
||||
Set<String> seen = new HashSet<String>();
|
||||
Set<String> seen = new HashSet<>();
|
||||
writeNestedLibraries(unpackLibraries, seen, writer);
|
||||
if (this.layout instanceof RepackagingLayout) {
|
||||
writer.writeEntries(sourceJar, new RenamingEntryTransformer(
|
||||
|
||||
@@ -212,7 +212,7 @@ public class DefaultLaunchScriptTests {
|
||||
}
|
||||
|
||||
private Map<?, ?> createProperties(String... pairs) {
|
||||
Map<Object, Object> properties = new HashMap<Object, Object>();
|
||||
Map<Object, Object> properties = new HashMap<>();
|
||||
for (String pair : pairs) {
|
||||
String[] keyValue = pair.split(":");
|
||||
properties.put(keyValue[0], keyValue[1]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -178,7 +178,7 @@ public class MainClassFinderTests {
|
||||
|
||||
private static class ClassNameCollector implements MainClassCallback<Object> {
|
||||
|
||||
private final List<String> classNames = new ArrayList<String>();
|
||||
private final List<String> classNames = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Object doWith(MainClass mainClass) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,7 +68,7 @@ public abstract class ExecutableArchiveLauncher extends Launcher {
|
||||
|
||||
@Override
|
||||
protected List<Archive> getClassPathArchives() throws Exception {
|
||||
List<Archive> archives = new ArrayList<Archive>(
|
||||
List<Archive> archives = new ArrayList<>(
|
||||
this.archive.getNestedArchives(new EntryFilter() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public abstract class Launcher {
|
||||
* @throws Exception if the classloader cannot be created
|
||||
*/
|
||||
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception {
|
||||
List<URL> urls = new ArrayList<URL>(archives.size());
|
||||
List<URL> urls = new ArrayList<>(archives.size());
|
||||
for (Archive archive : archives) {
|
||||
urls.add(archive.getUrl());
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class PropertiesLauncher extends Launcher {
|
||||
|
||||
private final File home;
|
||||
|
||||
private List<String> paths = new ArrayList<String>();
|
||||
private List<String> paths = new ArrayList<>();
|
||||
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
@@ -149,7 +149,7 @@ public class PropertiesLauncher extends Launcher {
|
||||
}
|
||||
|
||||
private void initializeProperties() throws Exception, IOException {
|
||||
List<String> configs = new ArrayList<String>();
|
||||
List<String> configs = new ArrayList<>();
|
||||
if (getProperty(CONFIG_LOCATION) != null) {
|
||||
configs.add(getProperty(CONFIG_LOCATION));
|
||||
}
|
||||
@@ -296,7 +296,7 @@ public class PropertiesLauncher extends Launcher {
|
||||
}
|
||||
|
||||
private List<String> parsePathsProperty(String commaSeparatedPaths) {
|
||||
List<String> paths = new ArrayList<String>();
|
||||
List<String> paths = new ArrayList<>();
|
||||
for (String path : commaSeparatedPaths.split(",")) {
|
||||
path = cleanupPath(path);
|
||||
// Empty path (i.e. the archive itself if running from a JAR) is always added
|
||||
@@ -432,11 +432,11 @@ public class PropertiesLauncher extends Launcher {
|
||||
|
||||
@Override
|
||||
protected List<Archive> getClassPathArchives() throws Exception {
|
||||
List<Archive> lib = new ArrayList<Archive>();
|
||||
List<Archive> lib = new ArrayList<>();
|
||||
for (String path : this.paths) {
|
||||
for (Archive archive : getClassPathArchives(path)) {
|
||||
if (archive instanceof ExplodedArchive) {
|
||||
List<Archive> nested = new ArrayList<Archive>(
|
||||
List<Archive> nested = new ArrayList<>(
|
||||
archive.getNestedArchives(new ArchiveEntryFilter()));
|
||||
nested.add(0, archive);
|
||||
lib.addAll(nested);
|
||||
@@ -452,7 +452,7 @@ public class PropertiesLauncher extends Launcher {
|
||||
|
||||
private List<Archive> getClassPathArchives(String path) throws Exception {
|
||||
String root = cleanupPath(stripFileUrlPrefix(path));
|
||||
List<Archive> lib = new ArrayList<Archive>();
|
||||
List<Archive> lib = new ArrayList<>();
|
||||
File file = new File(root);
|
||||
if (!isAbsolutePath(root)) {
|
||||
file = new File(this.home, root);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ import java.util.jar.Manifest;
|
||||
*/
|
||||
public class ExplodedArchive implements Archive {
|
||||
|
||||
private static final Set<String> SKIPPED_NAMES = new HashSet<String>(
|
||||
private static final Set<String> SKIPPED_NAMES = new HashSet<>(
|
||||
Arrays.asList(".", ".."));
|
||||
|
||||
private final File root;
|
||||
@@ -104,7 +104,7 @@ public class ExplodedArchive implements Archive {
|
||||
|
||||
@Override
|
||||
public List<Archive> getNestedArchives(EntryFilter filter) throws IOException {
|
||||
List<Archive> nestedArchives = new ArrayList<Archive>();
|
||||
List<Archive> nestedArchives = new ArrayList<>();
|
||||
for (Entry entry : this) {
|
||||
if (filter.matches(entry)) {
|
||||
nestedArchives.add(getNestedArchive(entry));
|
||||
@@ -145,7 +145,7 @@ public class ExplodedArchive implements Archive {
|
||||
|
||||
private final boolean recursive;
|
||||
|
||||
private final Deque<Iterator<File>> stack = new LinkedList<Iterator<File>>();
|
||||
private final Deque<Iterator<File>> stack = new LinkedList<>();
|
||||
|
||||
private File current;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -81,7 +81,7 @@ public class JarFileArchive implements Archive {
|
||||
|
||||
@Override
|
||||
public List<Archive> getNestedArchives(EntryFilter filter) throws IOException {
|
||||
List<Archive> nestedArchives = new ArrayList<Archive>();
|
||||
List<Archive> nestedArchives = new ArrayList<>();
|
||||
for (Entry entry : this) {
|
||||
if (filter.matches(entry)) {
|
||||
nestedArchives.add(getNestedArchive(entry));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -240,7 +240,7 @@ public class RandomAccessDataFile implements RandomAccessData {
|
||||
FilePool(int size) {
|
||||
this.size = size;
|
||||
this.available = new Semaphore(size);
|
||||
this.files = new ConcurrentLinkedQueue<RandomAccessFile>();
|
||||
this.files = new ConcurrentLinkedQueue<>();
|
||||
}
|
||||
|
||||
public RandomAccessFile acquire() throws IOException {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,7 @@ class CentralDirectoryParser {
|
||||
|
||||
private int CENTRAL_DIRECTORY_HEADER_BASE_SIZE = 46;
|
||||
|
||||
private final List<CentralDirectoryVisitor> visitors = new ArrayList<CentralDirectoryVisitor>();
|
||||
private final List<CentralDirectoryVisitor> visitors = new ArrayList<>();
|
||||
|
||||
public <T extends CentralDirectoryVisitor> T addVisitor(T visitor) {
|
||||
this.visitors.add(visitor);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,7 +68,7 @@ public class Handler extends URLStreamHandler {
|
||||
private static SoftReference<Map<File, JarFile>> rootFileCache;
|
||||
|
||||
static {
|
||||
rootFileCache = new SoftReference<Map<File, JarFile>>(null);
|
||||
rootFileCache = new SoftReference<>(null);
|
||||
}
|
||||
|
||||
private final Logger logger = Logger.getLogger(getClass().getName());
|
||||
@@ -291,8 +291,8 @@ public class Handler extends URLStreamHandler {
|
||||
static void addToRootFileCache(File sourceFile, JarFile jarFile) {
|
||||
Map<File, JarFile> cache = rootFileCache.get();
|
||||
if (cache == null) {
|
||||
cache = new ConcurrentHashMap<File, JarFile>();
|
||||
rootFileCache = new SoftReference<Map<File, JarFile>>(cache);
|
||||
cache = new ConcurrentHashMap<>();
|
||||
rootFileCache = new SoftReference<>(cache);
|
||||
}
|
||||
cache.put(sourceFile, jarFile);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -172,7 +172,7 @@ public class JarFile extends java.util.jar.JarFile {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
this.manifest = new SoftReference<Manifest>(manifest);
|
||||
this.manifest = new SoftReference<>(manifest);
|
||||
}
|
||||
return manifest;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.boot.loader.data.RandomAccessData.ResourceAccess;
|
||||
*/
|
||||
final class JarURLConnection extends java.net.JarURLConnection {
|
||||
|
||||
private static ThreadLocal<Boolean> useFastExceptions = new ThreadLocal<Boolean>();
|
||||
private static ThreadLocal<Boolean> useFastExceptions = new ThreadLocal<>();
|
||||
|
||||
private static final FileNotFoundException FILE_NOT_FOUND_EXCEPTION = new FileNotFoundException(
|
||||
"Jar file or entry not found");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -89,7 +89,7 @@ public class AbstractExecutableArchiveLauncherTests {
|
||||
}
|
||||
|
||||
protected Set<URL> getUrls(List<Archive> archives) throws MalformedURLException {
|
||||
Set<URL> urls = new HashSet<URL>(archives.size());
|
||||
Set<URL> urls = new HashSet<>(archives.size());
|
||||
for (Archive archive : archives) {
|
||||
urls.add(archive.getUrl());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -188,7 +188,7 @@ public class ExplodedArchiveTests {
|
||||
}
|
||||
|
||||
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
|
||||
Map<String, Archive.Entry> entries = new HashMap<String, Archive.Entry>();
|
||||
Map<String, Archive.Entry> entries = new HashMap<>();
|
||||
for (Archive.Entry entry : archive) {
|
||||
entries.put(entry.getName(), entry);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -121,7 +121,7 @@ public class JarFileArchiveTests {
|
||||
}
|
||||
|
||||
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
|
||||
Map<String, Archive.Entry> entries = new HashMap<String, Archive.Entry>();
|
||||
Map<String, Archive.Entry> entries = new HashMap<>();
|
||||
for (Archive.Entry entry : archive) {
|
||||
entries.put(entry.getName(), entry);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -276,7 +276,7 @@ public class RandomAccessDataFileTests {
|
||||
@Test
|
||||
public void concurrentReads() throws Exception {
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(20);
|
||||
List<Future<Boolean>> results = new ArrayList<Future<Boolean>>();
|
||||
List<Future<Boolean>> results = new ArrayList<>();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
results.add(executorService.submit(new Callable<Boolean>() {
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class CentralDirectoryParserTests {
|
||||
|
||||
private static class Collector implements CentralDirectoryVisitor {
|
||||
|
||||
private List<CentralDirectoryFileHeader> headers = new ArrayList<CentralDirectoryFileHeader>();
|
||||
private List<CentralDirectoryFileHeader> headers = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void visitStart(CentralDirectoryEndRecord endRecord,
|
||||
@@ -111,7 +111,7 @@ public class CentralDirectoryParserTests {
|
||||
|
||||
private static class MockCentralDirectoryVisitor implements CentralDirectoryVisitor {
|
||||
|
||||
private final List<String> invocations = new ArrayList<String>();
|
||||
private final List<String> invocations = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void visitStart(CentralDirectoryEndRecord endRecord,
|
||||
|
||||
@@ -90,7 +90,7 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
|
||||
protected Set<Artifact> filterDependencies(Set<Artifact> dependencies,
|
||||
FilterArtifacts filters) throws MojoExecutionException {
|
||||
try {
|
||||
Set<Artifact> filtered = new LinkedHashSet<Artifact>(dependencies);
|
||||
Set<Artifact> filtered = new LinkedHashSet<>(dependencies);
|
||||
filtered.retainAll(filters.filter(dependencies));
|
||||
return filtered;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -270,7 +270,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
||||
|
||||
private void doRunWithForkedJvm(String startClassName)
|
||||
throws MojoExecutionException, MojoFailureException {
|
||||
List<String> args = new ArrayList<String>();
|
||||
List<String> args = new ArrayList<>();
|
||||
addAgents(args);
|
||||
addJvmArgs(args);
|
||||
addClasspath(args);
|
||||
@@ -392,7 +392,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
||||
|
||||
protected URL[] getClassPathUrls() throws MojoExecutionException {
|
||||
try {
|
||||
List<URL> urls = new ArrayList<URL>();
|
||||
List<URL> urls = new ArrayList<>();
|
||||
addUserDefinedFolders(urls);
|
||||
addResources(urls);
|
||||
addProjectClasses(urls);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ public class ArtifactsLibraries implements Libraries {
|
||||
private static final Map<String, LibraryScope> SCOPES;
|
||||
|
||||
static {
|
||||
Map<String, LibraryScope> scopes = new HashMap<String, LibraryScope>();
|
||||
Map<String, LibraryScope> scopes = new HashMap<>();
|
||||
scopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE);
|
||||
scopes.put(Artifact.SCOPE_RUNTIME, LibraryScope.RUNTIME);
|
||||
scopes.put(Artifact.SCOPE_PROVIDED, LibraryScope.PROVIDED);
|
||||
@@ -85,8 +85,8 @@ public class ArtifactsLibraries implements Libraries {
|
||||
}
|
||||
|
||||
private Set<String> getDuplicates(Set<Artifact> artifacts) {
|
||||
Set<String> duplicates = new HashSet<String>();
|
||||
Set<String> seen = new HashSet<String>();
|
||||
Set<String> duplicates = new HashSet<>();
|
||||
Set<String> seen = new HashSet<>();
|
||||
for (Artifact artifact : artifacts) {
|
||||
String fileName = getFileName(artifact);
|
||||
if (artifact.getFile() != null && !seen.add(fileName)) {
|
||||
|
||||
@@ -242,7 +242,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
|
||||
}
|
||||
|
||||
private ArtifactsFilter[] getAdditionalFilters() {
|
||||
List<ArtifactsFilter> filters = new ArrayList<ArtifactsFilter>();
|
||||
List<ArtifactsFilter> filters = new ArrayList<>();
|
||||
if (this.excludeDevtools) {
|
||||
Exclude exclude = new Exclude();
|
||||
exclude.setGroupId("org.springframework.boot");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,7 +38,7 @@ class RunArguments {
|
||||
}
|
||||
|
||||
RunArguments(String[] args) {
|
||||
this.args = new LinkedList<String>(Arrays.asList(args));
|
||||
this.args = new LinkedList<>(Arrays.asList(args));
|
||||
}
|
||||
|
||||
public LinkedList<String> getArgs() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -132,7 +132,7 @@ public class StartMojo extends AbstractRunMojo {
|
||||
protected RunArguments resolveJvmArguments() {
|
||||
RunArguments jvmArguments = super.resolveJvmArguments();
|
||||
if (isFork()) {
|
||||
List<String> remoteJmxArguments = new ArrayList<String>();
|
||||
List<String> remoteJmxArguments = new ArrayList<>();
|
||||
remoteJmxArguments.add("-Dcom.sun.management.jmxremote");
|
||||
remoteJmxArguments.add("-Dcom.sun.management.jmxremote.port=" + this.jmxPort);
|
||||
remoteJmxArguments.add("-Dcom.sun.management.jmxremote.authenticate=false");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -124,7 +124,7 @@ public class ArtifactsLibrariesTests {
|
||||
given(artifact2.getBaseVersion()).willReturn("1.0");
|
||||
given(artifact2.getFile()).willReturn(new File("a"));
|
||||
given(artifact2.getArtifactHandler()).willReturn(this.artifactHandler);
|
||||
this.artifacts = new LinkedHashSet<Artifact>(Arrays.asList(artifact1, artifact2));
|
||||
this.artifacts = new LinkedHashSet<>(Arrays.asList(artifact1, artifact2));
|
||||
this.libs = new ArtifactsLibraries(this.artifacts, null, mock(Log.class));
|
||||
this.libs.doWithLibraries(this.callback);
|
||||
verify(this.callback, times(2)).library(this.libraryCaptor.capture());
|
||||
|
||||
@@ -148,7 +148,7 @@ public class DependencyFilterMojoTests {
|
||||
|
||||
public Set<Artifact> filterDependencies(Artifact... artifacts)
|
||||
throws MojoExecutionException {
|
||||
Set<Artifact> input = new LinkedHashSet<Artifact>(Arrays.asList(artifacts));
|
||||
Set<Artifact> input = new LinkedHashSet<>(Arrays.asList(artifacts));
|
||||
return filterDependencies(input, getFilters(this.additionalFilters));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -101,7 +101,7 @@ public class ExcludeFilterTests {
|
||||
ExcludeFilter filter = new ExcludeFilter(Arrays.asList(
|
||||
createExclude("com.foo", "bar"), createExclude("com.foo", "bar2"),
|
||||
createExclude("org.acme", "app")));
|
||||
Set<Artifact> artifacts = new HashSet<Artifact>();
|
||||
Set<Artifact> artifacts = new HashSet<>();
|
||||
artifacts.add(createArtifact("com.foo", "bar"));
|
||||
artifacts.add(createArtifact("com.foo", "bar"));
|
||||
Artifact anotherAcme = createArtifact("org.acme", "another-app");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -98,7 +98,7 @@ public class IncludeFilterTests {
|
||||
IncludeFilter filter = new IncludeFilter(Arrays.asList(
|
||||
createInclude("com.foo", "bar"), createInclude("com.foo", "bar2"),
|
||||
createInclude("org.acme", "app")));
|
||||
Set<Artifact> artifacts = new HashSet<Artifact>();
|
||||
Set<Artifact> artifacts = new HashSet<>();
|
||||
artifacts.add(createArtifact("com.foo", "bar"));
|
||||
artifacts.add(createArtifact("com.foo", "bar"));
|
||||
Artifact anotherAcme = createArtifact("org.acme", "another-app");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -93,7 +93,7 @@ public final class Verify {
|
||||
public ArchiveVerifier(ZipFile zipFile) {
|
||||
this.zipFile = zipFile;
|
||||
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||
this.content = new HashMap<String, ZipEntry>();
|
||||
this.content = new HashMap<>();
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry zipEntry = entries.nextElement();
|
||||
this.content.put(zipEntry.getName(), zipEntry);
|
||||
|
||||
Reference in New Issue
Block a user