Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ String toJSON() {
public SourceVersion getSupportedSourceVersion() {
return latestSupported();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ private void setDeclaredField(io.microsphere.beans.ConfigurationProperty configu
String declaredFieldName = field.getSimpleName().toString();
configurationProperty.getMetadata().setDeclaredField(declaredFieldName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ public JavaFileManager getJavaFileManager() {
return processInFiler(filer -> getFieldValue(filer, "fileManager"));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.BiConsumer;
Expand Down Expand Up @@ -244,4 +243,4 @@ public void processInResourceWriter(String resourceName, ThrowableConsumer<Write
public static boolean exists(FileObject resource) {
return resource != null && resource.getLastModified() > 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package io.microsphere.annotation.processor;

import io.microsphere.test.annotation.processing.AbstractAnnotationProcessingTest;

import org.junit.jupiter.api.Test;

import static io.microsphere.util.Assert.assertNotNull;
Expand All @@ -40,4 +41,4 @@ void testResolveMetadataOnEmptySet() {
String json = processor.toJSON();
assertNotNull("[]", json);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ void testSetSourcesOnNoSource() {
visitor.setSources(null, "noSource", null);
assertNotNull(visitor);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ void testGetJavaFileManager() {
JavaFileManager javaFileManager = processor.getJavaFileManager();
assertNotNull(javaFileManager);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@ void testProcessInResourceOnWriterOnFailed() {
void testExistsOnNull() {
assertFalse(exists(null));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.microsphere.beans.ConfigurationProperty.Metadata;
import io.microsphere.metadata.ConfigurationPropertyLoader;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

Expand All @@ -40,7 +41,7 @@ public class TestConfigurationPropertyLoader implements ConfigurationPropertyLoa
public List<ConfigurationProperty> load() throws Throwable {

int size = SIMPLE_TYPES.size();
List<ConfigurationProperty> configurationProperties = newArrayList(size);
ArrayList<ConfigurationProperty> configurationProperties = newArrayList(size);

Random random = new Random();

Expand Down Expand Up @@ -68,4 +69,4 @@ public List<ConfigurationProperty> load() throws Throwable {
}
return configurationProperties;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@
*/
String[] source() default {};

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
*/
String description() default "";

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
@Documented
@Retention(RUNTIME)
public @interface Immutable {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
@javax.annotation.Nonnull
@TypeQualifierNickname
public @interface Nonnull {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
@javax.annotation.Nonnull(when = MAYBE)
@TypeQualifierNickname
public @interface Nullable {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
*/
String value();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
@Target(TYPE)
@Retention(CLASS)
public @interface NotThreadSafe {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
@Target(TYPE)
@Retention(CLASS)
public @interface ThreadSafe {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ void testSources() {
assertEquals("environment-variables", ENVIRONMENT_VARIABLES_SOURCE);
assertEquals("application", APPLICATION_SOURCE);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ class ExperimentalTest {
void test() {
assertNull(ExperimentalTest.class.getAnnotation(Experimental.class));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ class ImmutableTest {
void test() {
assertNotNull(ImmutableTest.class.getAnnotation(Immutable.class));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ class NonnullTest {
void test() {
assertNotNull(NonnullTest.class.getAnnotation(Nonnull.class));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ class NullableTest {
void test() {
assertNotNull(NullableTest.class.getAnnotation(Nullable.class));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ void test() {
assertEquals("microsphere-java-core", since.module());
assertEquals("1.0.0", since.value());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

Expand Down Expand Up @@ -64,7 +65,7 @@ protected BeanMetadata(BeanInfo beanInfo) {
static Map<String, PropertyDescriptor> buildPropertyDescriptorsMap(BeanInfo beanInfo) {
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
int length = propertyDescriptors.length;
Map<String, PropertyDescriptor> propertyDescriptorsMap = newFixedHashMap(length);
HashMap<String, PropertyDescriptor> propertyDescriptorsMap = newFixedHashMap(length);
for (int i = 0; i < length; i++) {
PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
String propertyName = uncapitalize(propertyDescriptor.getName());
Expand Down Expand Up @@ -143,4 +144,4 @@ public static BeanMetadata of(@Nonnull Class<?> beanClass) throws RuntimeExcepti
return new BeanMetadata(beanClass);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ public static BeanProperty of(@Nonnull Object bean, @Nonnull String propertyName
return beanProperty;
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@

import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
Expand Down Expand Up @@ -452,7 +458,7 @@ protected static Map<String, Object> resolvePropertiesAsMap(Object bean, Mutable
Class<?> beanClass = bean.getClass();
BeanMetadata beanMetadata = getBeanMetadata(beanClass);
Map<String, PropertyDescriptor> propertyDescriptorsMap = beanMetadata.getPropertyDescriptorsMap();
Map<String, Object> propertiesMap = newFixedHashMap(propertyDescriptorsMap.size());
HashMap<String, Object> propertiesMap = newFixedHashMap(propertyDescriptorsMap.size());
for (Map.Entry<String, PropertyDescriptor> entry : propertyDescriptorsMap.entrySet()) {
String propertyName = entry.getKey();
PropertyDescriptor propertyDescriptor = entry.getValue();
Expand Down Expand Up @@ -517,35 +523,35 @@ static Object toArray(Object value, Class<?> valueType, MutableInteger resolvedD

static List<?> toList(Object value, Class<?> valueType, MutableInteger resolvedDepth, int maxResolvedDepth) {
List<?> list = (List<?>) value;
List<Object> newList = newArrayList(size(list));
ArrayList<Object> newList = newArrayList(size(list));
addValues(newList, list, resolvedDepth, maxResolvedDepth);
return newList;
}

static Set<?> toSet(Object value, Class<?> valueType, MutableInteger resolvedDepth, int maxResolvedDepth) {
Set<?> set = (Set<?>) value;
Set<Object> newSet = newFixedLinkedHashSet(size(set));
LinkedHashSet<Object> newSet = newFixedLinkedHashSet(size(set));
addValues(newSet, set, resolvedDepth, maxResolvedDepth);
return newSet;
}

static Queue<?> toQueue(Object value, Class<?> valueType, MutableInteger resolvedDepth, int maxResolvedDepth) {
Queue<?> queue = (Queue<?>) value;
Queue<Object> newQueue = newArrayDeque(size(queue));
ArrayDeque<Object> newQueue = newArrayDeque(size(queue));
addValues(newQueue, queue, resolvedDepth, maxResolvedDepth);
return newQueue;
}

static Enumeration<?> toEnumeration(Object value, Class<?> valueType, MutableInteger resolvedDepth, int maxResolvedDepth) {
Enumeration<?> enumeration = (Enumeration<?>) value;
List<Object> newList = newLinkedList();
LinkedList<Object> newList = newLinkedList();
addValues(newList, toIterable(enumeration), resolvedDepth, maxResolvedDepth);
return enumeration(newList);
}

static Object toMap(Object value, Class<?> valueType, MutableInteger resolvedDepth, int maxResolvedDepth) {
Map<?, ?> map = (Map<?, ?>) value;
Map<Object, Object> newMap = newFixedLinkedHashMap(size(map));
LinkedHashMap<Object, Object> newMap = newFixedLinkedHashMap(size(map));
for (Map.Entry<?, ?> entry : map.entrySet()) {
newMap.put(entry.getKey(), resolveProperty(entry.getValue(), resolvedDepth, maxResolvedDepth));
}
Expand All @@ -561,4 +567,4 @@ static void addValues(Collection<Object> targetValues, Iterable<?> sourceValues,

private BeanUtils() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,4 @@ public String toString() {
'}';
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ public final String toString() {
sb.append('}');
return sb.toString();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,4 @@ protected final Field getBaseField() {
protected abstract String getURLClassPathClassName();

protected abstract String getUrlsFieldName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ static Artifact createArtifact(String archiveFileName, URL resourceURL) {
String version = length > 1 ? parts[1] : null;
return create(artifactId, version, resourceURL);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ public String toString() {
'}';
return sb;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.microsphere.logging.Logger;

import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
Expand Down Expand Up @@ -115,7 +116,7 @@
if (size < 1) {
return emptyList();
}
List<Artifact> artifactList = newArrayList(size);
ArrayList<Artifact> artifactList = newArrayList(size);
for (URL classPathURL : classPathURLs) {
Artifact artifact = detect(classPathURL);
if (artifact != null) {
Expand Down Expand Up @@ -148,7 +149,7 @@

protected Set<URL> getClassPathURLs(boolean includedJdkLibraries) {
Set<URL> urls = findAllClassPathURLs(classLoader);
Set<URL> classPathURLs = new LinkedHashSet<>(urls);
LinkedHashSet<URL> classPathURLs = new LinkedHashSet<>(urls);

Check warning on line 152 in microsphere-java-core/src/main/java/io/microsphere/classloading/ArtifactDetector.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the URI class instead.

See more on https://sonarcloud.io/project/issues?id=microsphere-projects_microsphere-java&issues=AZ53Ja24oRufhO6yZ4J0&open=AZ53Ja24oRufhO6yZ4J0&pullRequest=284
if (!includedJdkLibraries) {
removeJdkClassPathURLs(classPathURLs);
}
Expand All @@ -171,4 +172,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ public interface ArtifactResourceResolver extends Prioritized {
*/
@Nullable
Artifact resolve(@Nullable URL resourceURL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void execute() {
}

static List<MavenArtifact> loadBannedArtifactConfigs(ClassLoader classLoader) {
List<MavenArtifact> bannedArtifactConfigs = new LinkedList<>();
LinkedList<MavenArtifact> bannedArtifactConfigs = new LinkedList<>();
try {
Enumeration<URL> configResources = classLoader.getResources(CONFIG_LOCATION);
while (configResources.hasMoreElements()) {
Expand All @@ -109,7 +109,7 @@ static List<MavenArtifact> loadBannedArtifactConfigs(ClassLoader classLoader) {
}

static List<MavenArtifact> loadBannedArtifactConfigs(URL configResource) throws IOException {
List<MavenArtifact> bannedArtifactConfigs = new LinkedList<>();
LinkedList<MavenArtifact> bannedArtifactConfigs = new LinkedList<>();
try (InputStream inputStream = configResource.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, ENCODING))
) {
Expand All @@ -136,4 +136,4 @@ static MavenArtifact loadBannedArtifactConfig(String definition) throws IllegalA
return MavenArtifact.create(groupId, artifactId, version);
}

}
}
Loading
Loading