DATACMNS-601 - Fixes for most of the SonarQube warnings.
This commit is contained in:
@@ -94,16 +94,16 @@ public class AnnotationDetectionMethodCallback<A extends Annotation> implements
|
||||
return;
|
||||
}
|
||||
|
||||
A annotation = AnnotationUtils.findAnnotation(method, annotationType);
|
||||
A foundAnnotation = AnnotationUtils.findAnnotation(method, annotationType);
|
||||
|
||||
if (annotation != null) {
|
||||
if (foundAnnotation != null) {
|
||||
|
||||
if (foundMethod != null && enforceUniqueness) {
|
||||
throw new IllegalStateException(String.format(MULTIPLE_FOUND, annotation.getClass().getName(), foundMethod,
|
||||
throw new IllegalStateException(String.format(MULTIPLE_FOUND, foundAnnotation.getClass().getName(), foundMethod,
|
||||
method));
|
||||
}
|
||||
|
||||
this.annotation = annotation;
|
||||
this.annotation = foundAnnotation;
|
||||
this.foundMethod = method;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DirectFieldAccessFallbackBeanWrapper extends BeanWrapperImpl {
|
||||
|
||||
if (field == null) {
|
||||
throw new NotWritablePropertyException(getWrappedClass(), propertyName,
|
||||
"Could not find field for property during fallback access!");
|
||||
"Could not find field for property during fallback access!", e);
|
||||
}
|
||||
|
||||
makeAccessible(field);
|
||||
|
||||
@@ -200,15 +200,15 @@ class ParameterizedTypeInformation<T> extends ParentTypeAwareTypeInformation<T>
|
||||
return resolved;
|
||||
}
|
||||
|
||||
Type[] types = type.getActualTypeArguments();
|
||||
Type[] typeArguments = type.getActualTypeArguments();
|
||||
|
||||
if (types.length == 0) {
|
||||
if (typeArguments.length == 0) {
|
||||
return cacheAndReturn(false);
|
||||
}
|
||||
|
||||
for (Type type : types) {
|
||||
for (Type typeArgument : typeArguments) {
|
||||
|
||||
TypeInformation<?> info = createInfo(type);
|
||||
TypeInformation<?> info = createInfo(typeArgument);
|
||||
|
||||
if (info instanceof ParameterizedTypeInformation) {
|
||||
if (!((ParameterizedTypeInformation<?>) info).isResolvedCompletely()) {
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.util.ReflectionUtils.FieldFilter;
|
||||
* @author Oliver Gierke
|
||||
* @since 1.5
|
||||
*/
|
||||
public class ReflectionUtils {
|
||||
public abstract class ReflectionUtils {
|
||||
|
||||
private ReflectionUtils() {}
|
||||
|
||||
|
||||
@@ -159,8 +159,8 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
Assert.notNull(constructor);
|
||||
List<TypeInformation<?>> result = new ArrayList<TypeInformation<?>>();
|
||||
|
||||
for (Type type : constructor.getGenericParameterTypes()) {
|
||||
result.add(createInfo(type));
|
||||
for (Type parameterType : constructor.getGenericParameterTypes()) {
|
||||
result.add(createInfo(parameterType));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -201,14 +201,14 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
*/
|
||||
private TypeInformation<?> getPropertyInformation(String fieldname) {
|
||||
|
||||
Class<?> type = getType();
|
||||
Field field = ReflectionUtils.findField(type, fieldname);
|
||||
Class<?> rawType = getType();
|
||||
Field field = ReflectionUtils.findField(rawType, fieldname);
|
||||
|
||||
if (field != null) {
|
||||
return createInfo(field.getGenericType());
|
||||
}
|
||||
|
||||
PropertyDescriptor descriptor = findPropertyDescriptor(type, fieldname);
|
||||
PropertyDescriptor descriptor = findPropertyDescriptor(rawType, fieldname);
|
||||
return descriptor == null ? null : createInfo(getGenericType(descriptor));
|
||||
}
|
||||
|
||||
@@ -417,8 +417,8 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
Type[] parameterTypes = method.getGenericParameterTypes();
|
||||
List<TypeInformation<?>> result = new ArrayList<TypeInformation<?>>(parameterTypes.length);
|
||||
|
||||
for (Type type : parameterTypes) {
|
||||
result.add(createInfo(type));
|
||||
for (Type parameterType : parameterTypes) {
|
||||
result.add(createInfo(parameterType));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -430,9 +430,9 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
*/
|
||||
public TypeInformation<?> getSuperTypeInformation(Class<?> superType) {
|
||||
|
||||
Class<?> type = getType();
|
||||
Class<?> rawType = getType();
|
||||
|
||||
if (!superType.isAssignableFrom(type)) {
|
||||
if (!superType.isAssignableFrom(rawType)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -442,11 +442,11 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
|
||||
List<Type> candidates = new ArrayList<Type>();
|
||||
|
||||
Type genericSuperclass = type.getGenericSuperclass();
|
||||
Type genericSuperclass = rawType.getGenericSuperclass();
|
||||
if (genericSuperclass != null) {
|
||||
candidates.add(genericSuperclass);
|
||||
}
|
||||
candidates.addAll(Arrays.asList(type.getGenericInterfaces()));
|
||||
candidates.addAll(Arrays.asList(rawType.getGenericInterfaces()));
|
||||
|
||||
for (Type candidate : candidates) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user