@@ -36,6 +36,7 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class AnnotatedTypeScanner implements ResourceLoaderAware, EnvironmentAware {
|
||||
|
||||
@@ -111,7 +112,7 @@ public class AnnotatedTypeScanner implements ResourceLoaderAware, EnvironmentAwa
|
||||
|
||||
if (beanClassName == null) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Unable to obtain bean class name from bean definition %s!", definition));
|
||||
String.format("Unable to obtain bean class name from bean definition %s", definition));
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.ReflectionUtils.FieldCallback;
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class AnnotationDetectionFieldCallback implements FieldCallback {
|
||||
|
||||
@@ -81,7 +82,7 @@ public class AnnotationDetectionFieldCallback implements FieldCallback {
|
||||
Field field = this.field;
|
||||
|
||||
if (field == null) {
|
||||
throw new IllegalStateException(String.format("No field found for annotation %s!", annotationType));
|
||||
throw new IllegalStateException(String.format("No field found for annotation %s", annotationType));
|
||||
}
|
||||
|
||||
return field;
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class AnnotationDetectionMethodCallback<A extends Annotation> implements MethodCallback {
|
||||
|
||||
@@ -83,7 +84,7 @@ public class AnnotationDetectionMethodCallback<A extends Annotation> implements
|
||||
Method method = this.foundMethod;
|
||||
|
||||
if (method == null) {
|
||||
throw new IllegalStateException(String.format("No method with annotation %s found!", annotationType));
|
||||
throw new IllegalStateException(String.format("No method with annotation %s found", annotationType));
|
||||
}
|
||||
|
||||
return method;
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.lang.Nullable;
|
||||
* wrapped does not use accessor methods.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class DirectFieldAccessFallbackBeanWrapper extends BeanWrapperImpl {
|
||||
|
||||
@@ -52,7 +53,7 @@ public class DirectFieldAccessFallbackBeanWrapper extends BeanWrapperImpl {
|
||||
|
||||
if (field == null) {
|
||||
throw new NotReadablePropertyException(getWrappedClass(), propertyName,
|
||||
"Could not find field for property during fallback access!");
|
||||
"Could not find field for property during fallback access");
|
||||
}
|
||||
|
||||
makeAccessible(field);
|
||||
@@ -71,7 +72,7 @@ public class DirectFieldAccessFallbackBeanWrapper extends BeanWrapperImpl {
|
||||
|
||||
if (field == null) {
|
||||
throw new NotWritablePropertyException(getWrappedClass(), propertyName,
|
||||
"Could not find field for property during fallback access!", e);
|
||||
"Could not find field for property during fallback access", e);
|
||||
}
|
||||
|
||||
makeAccessible(field);
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.lang.Nullable;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.3
|
||||
* @see org.springframework.core.KotlinDetector#isKotlinReflectPresent()
|
||||
*/
|
||||
@@ -125,7 +126,7 @@ public final class KotlinReflectionUtils {
|
||||
KFunction<?> kotlinFunction = KotlinReflectionUtils.findKotlinFunction(method);
|
||||
|
||||
if (kotlinFunction == null) {
|
||||
throw new IllegalArgumentException(String.format("Cannot resolve %s to a KFunction!", method));
|
||||
throw new IllegalArgumentException(String.format("Cannot resolve %s to a KFunction", method));
|
||||
}
|
||||
|
||||
return JvmClassMappingKt.getJavaClass(KTypesJvm.getJvmErasure(kotlinFunction.getReturnType()));
|
||||
@@ -143,13 +144,13 @@ public final class KotlinReflectionUtils {
|
||||
Method method = parameter.getMethod();
|
||||
|
||||
if (method == null) {
|
||||
throw new IllegalStateException(String.format("Cannot obtain method from parameter %s!", parameter));
|
||||
throw new IllegalStateException(String.format("Cannot obtain method from parameter %s", parameter));
|
||||
}
|
||||
|
||||
KFunction<?> kotlinFunction = findKotlinFunction(method);
|
||||
|
||||
if (kotlinFunction == null) {
|
||||
throw new IllegalArgumentException(String.format("Cannot resolve %s to a Kotlin function!", parameter));
|
||||
throw new IllegalArgumentException(String.format("Cannot resolve %s to a Kotlin function", parameter));
|
||||
}
|
||||
|
||||
// Special handling for Coroutines
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Henning Rohlfs
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
*/
|
||||
public class Lazy<T> implements Supplier<T> {
|
||||
@@ -112,7 +113,7 @@ public class Lazy<T> implements Supplier<T> {
|
||||
T value = getNullable();
|
||||
|
||||
if (value == null) {
|
||||
throw new IllegalStateException("Expected lazy evaluation to yield a non-null value but got null!");
|
||||
throw new IllegalStateException("Expected lazy evaluation to yield a non-null value but got null");
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
|
||||
* API to record method invocations via method references on a proxy.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.2
|
||||
* @soundtrack The Intersphere - Don't Think Twice (The Grand Delusion)
|
||||
*/
|
||||
@@ -203,7 +204,7 @@ public class MethodInvocationRecorder {
|
||||
.map(it -> it.getPropertyName(invokedMethod)) //
|
||||
.findFirst() //
|
||||
.orElseThrow(() -> new IllegalArgumentException(
|
||||
String.format("No property name found for method %s!", invokedMethod)));
|
||||
String.format("No property name found for method %s", invokedMethod)));
|
||||
}
|
||||
|
||||
public Recorded<?> getRecorded() {
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.util.ReflectionUtils.FieldFilter;
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.5
|
||||
*/
|
||||
public final class ReflectionUtils {
|
||||
@@ -223,7 +224,7 @@ public final class ReflectionUtils {
|
||||
Field result = org.springframework.util.ReflectionUtils.findField(type, name);
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalArgumentException(String.format("Unable to find field %s on %s!", name, type));
|
||||
throw new IllegalArgumentException(String.format("Unable to find field %s on %s", name, type));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -440,7 +441,7 @@ public final class ReflectionUtils {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("Primitive type %s not supported!", type));
|
||||
throw new IllegalArgumentException(String.format("Primitive type %s not supported", type));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,6 +51,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @author Mark Paluch
|
||||
* @author Jürgen Diez
|
||||
* @author Alessandro Nistico
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
|
||||
@@ -415,7 +416,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
|
||||
TypeInformation<?> superTypeInformation = target.getSuperTypeInformation(getType());
|
||||
|
||||
return superTypeInformation == null ? false : superTypeInformation.equals(this);
|
||||
return superTypeInformation != null && superTypeInformation.equals(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.lang.Nullable;
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Alessandro Nistico
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public interface TypeInformation<S> {
|
||||
|
||||
@@ -68,7 +69,7 @@ public interface TypeInformation<S> {
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Could not find required property %s on %s!", property, getType()));
|
||||
String.format("Could not find required property %s on %s", property, getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +106,7 @@ public interface TypeInformation<S> {
|
||||
return componentType;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Can't resolve required component type for %s!", getType()));
|
||||
throw new IllegalStateException(String.format("Can't resolve required component type for %s", getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +142,7 @@ public interface TypeInformation<S> {
|
||||
return mapValueType;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Can't resolve required map value type for %s!", getType()));
|
||||
throw new IllegalStateException(String.format("Can't resolve required map value type for %s", getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +198,7 @@ public interface TypeInformation<S> {
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"Expected to be able to resolve a type but got null! This usually stems from types implementing raw Map or Collection interfaces!");
|
||||
"Expected to be able to resolve a type but got null! This usually stems from types implementing raw Map or Collection interfaces");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -244,7 +245,7 @@ public interface TypeInformation<S> {
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Can't retrieve super type information for %s! Does current type really implement the given one?",
|
||||
"Can't retrieve super type information for %s! Does current type really implement the given one",
|
||||
superType));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user