This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new aed410e5e1 Utility class modernization
aed410e5e1 is described below
commit aed410e5e180800580a32c230ed65cc0b6bcf416
Author: James Bognar <[email protected]>
AuthorDate: Wed Nov 5 09:11:42 2025 -0500
Utility class modernization
---
.../apache/juneau/common/reflect/ClassInfo.java | 26 +++++-----
.../juneau/common/reflect/ConstructorInfo.java | 14 ++++--
.../juneau/common/reflect/ExecutableInfo.java | 56 +++++++++++++++-------
.../apache/juneau/common/reflect/MethodInfo.java | 56 ++++++++++++++++++++--
.../src/main/java/org/apache/juneau/ClassMeta.java | 6 +--
.../java/org/apache/juneau/swap/AutoListSwap.java | 4 +-
.../java/org/apache/juneau/swap/AutoMapSwap.java | 4 +-
.../org/apache/juneau/swap/AutoNumberSwap.java | 4 +-
.../org/apache/juneau/swap/AutoObjectSwap.java | 4 +-
.../juneau/common/reflect/ClassInfo_Test.java | 16 +++----
.../juneau/common/reflect/ConstructorInfoTest.java | 6 +--
.../juneau/common/reflect/ExecutableInfo_Test.java | 10 ++--
.../juneau/common/reflect/MethodInfo_Test.java | 4 +-
13 files changed, 140 insertions(+), 70 deletions(-)
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
index 34d8292c16..b885b98b92 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ClassInfo.java
@@ -2152,20 +2152,20 @@ public class ClassInfo extends ElementInfo implements
Annotatable {
*
* <h5 class='section'>Examples:</h5>
* <p class='bjava'>
- *
ClassInfo.<jsm>of</jsm>(String.<jk>class</jk>).isParentOfFuzzyPrimitives(String.<jk>class</jk>);
<jc>// true</jc>
- *
ClassInfo.<jsm>of</jsm>(CharSequence.<jk>class</jk>).isParentOfFuzzyPrimitives(String.<jk>class</jk>);
<jc>// true</jc>
- *
ClassInfo.<jsm>of</jsm>(String.<jk>class</jk>).isParentOfFuzzyPrimitives(CharSequence.<jk>class</jk>);
<jc>// false</jc>
- *
ClassInfo.<jsm>of</jsm>(<jk>int</jk>.<jk>class</jk>).isParentOfFuzzyPrimitives(Integer.<jk>class</jk>);
<jc>// true</jc>
- *
ClassInfo.<jsm>of</jsm>(Integer.<jk>class</jk>).isParentOfFuzzyPrimitives(<jk>int</jk>.<jk>class</jk>);
<jc>// true</jc>
- *
ClassInfo.<jsm>of</jsm>(Number.<jk>class</jk>).isParentOfFuzzyPrimitives(<jk>int</jk>.<jk>class</jk>);
<jc>// true</jc>
- *
ClassInfo.<jsm>of</jsm>(<jk>int</jk>.<jk>class</jk>).isParentOfFuzzyPrimitives(Number.<jk>class</jk>);
<jc>// false</jc>
- *
ClassInfo.<jsm>of</jsm>(<jk>int</jk>.<jk>class</jk>).isParentOfFuzzyPrimitives(<jk>long</jk>.<jk>class</jk>);
<jc>// false</jc>
+ *
ClassInfo.<jsm>of</jsm>(String.<jk>class</jk>).isParentOfLenient(String.<jk>class</jk>);
<jc>// true</jc>
+ *
ClassInfo.<jsm>of</jsm>(CharSequence.<jk>class</jk>).isParentOfLenient(String.<jk>class</jk>);
<jc>// true</jc>
+ *
ClassInfo.<jsm>of</jsm>(String.<jk>class</jk>).isParentOfLenient(CharSequence.<jk>class</jk>);
<jc>// false</jc>
+ *
ClassInfo.<jsm>of</jsm>(<jk>int</jk>.<jk>class</jk>).isParentOfLenient(Integer.<jk>class</jk>);
<jc>// true</jc>
+ *
ClassInfo.<jsm>of</jsm>(Integer.<jk>class</jk>).isParentOfLenient(<jk>int</jk>.<jk>class</jk>);
<jc>// true</jc>
+ *
ClassInfo.<jsm>of</jsm>(Number.<jk>class</jk>).isParentOfLenient(<jk>int</jk>.<jk>class</jk>);
<jc>// true</jc>
+ *
ClassInfo.<jsm>of</jsm>(<jk>int</jk>.<jk>class</jk>).isParentOfLenient(Number.<jk>class</jk>);
<jc>// false</jc>
+ *
ClassInfo.<jsm>of</jsm>(<jk>int</jk>.<jk>class</jk>).isParentOfLenient(<jk>long</jk>.<jk>class</jk>);
<jc>// false</jc>
* </p>
*
* @param child The child class.
* @return <jk>true</jk> if this class is a parent or the same as
<c>child</c>.
*/
- public boolean isParentOfFuzzyPrimitives(Class<?> child) {
+ public boolean isParentOfLenient(Class<?> child) {
if (c == null || child == null)
return false;
if (c.isAssignableFrom(child))
@@ -2177,12 +2177,12 @@ public class ClassInfo extends ElementInfo implements
Annotatable {
}
/**
- * Same as {@link #isParentOfFuzzyPrimitives(Class)} but takes in a
{@link ClassInfo}.
+ * Same as {@link #isParentOfLenient(Class)} but takes in a {@link
ClassInfo}.
*
* @param child The child class.
* @return <jk>true</jk> if this class is a parent or the same as
<c>child</c>.
*/
- public boolean isParentOfFuzzyPrimitives(ClassInfo child) {
+ public boolean isParentOfLenient(ClassInfo child) {
if (c == null || child == null)
return false;
if (c.isAssignableFrom(child.inner()))
@@ -2199,9 +2199,9 @@ public class ClassInfo extends ElementInfo implements
Annotatable {
* @param child The child class.
* @return <jk>true</jk> if this class is a parent or the same as
<c>child</c>.
*/
- public boolean isParentOfFuzzyPrimitives(Type child) {
+ public boolean isParentOfLenient(Type child) {
if (child instanceof Class)
- return isParentOfFuzzyPrimitives((Class<?>)child);
+ return isParentOfLenient((Class<?>)child);
return false;
}
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
index 5e66ab1873..5b3596ec6e 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ConstructorInfo.java
@@ -195,16 +195,20 @@ public class ConstructorInfo extends ExecutableInfo
implements Comparable<Constr
}
/**
- * Shortcut for calling the new-instance method on the underlying
constructor.
+ * Shortcut for calling the new-instance method on the underlying
constructor using lenient argument matching.
+ *
+ * <p>
+ * Lenient matching allows arguments to be matched to parameters based
on parameter types.
+ * <br>Arguments can be in any order.
+ * <br>Extra arguments are ignored.
+ * <br>Missing arguments are set to <jk>null</jk>.
*
* @param <T> The constructor class type.
- * @param args the arguments used for the method call.
- * <br>Extra parameters are ignored.
- * <br>Missing parameters are set to null.
+ * @param args The arguments used for the constructor call.
* @return The object returned from the constructor.
* @throws ExecutableException Exception occurred on invoked
constructor/method/field.
*/
- public <T> T newInstanceFuzzy(Object...args) throws ExecutableException
{
+ public <T> T newInstanceLenient(Object...args) throws
ExecutableException {
return
newInstance(ClassUtils.getMatchingArgs(c.getParameterTypes(), args));
}
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ExecutableInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ExecutableInfo.java
index ff3eeaedbf..95302c07e8 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ExecutableInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/ExecutableInfo.java
@@ -76,7 +76,11 @@ public abstract class ExecutableInfo extends AccessibleInfo {
}
/**
- * Returns how well this method matches the specified arg types.
+ * Returns how well this method matches the specified arg types using
lenient matching.
+ *
+ * <p>
+ * Lenient matching allows arguments to be matched to parameters based
on type compatibility,
+ * where arguments can be in any order.
*
* <p>
* The number returned is the number of method arguments that match the
passed in arg types.
@@ -85,11 +89,11 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
* @param argTypes The arg types to check against.
* @return How many parameters match or <c>-1</c> if method cannot
handle one or more of the arguments.
*/
- public final int fuzzyParametersMatch(Class<?>...argTypes) {
+ public final int getLenientParameterMatch(Class<?>...argTypes) {
int matches = 0;
outer: for (var param : getParameters()) {
for (var a : argTypes) {
- if
(param.getParameterType().isParentOfFuzzyPrimitives(a)) {
+ if
(param.getParameterType().isParentOfLenient(a)) {
matches++;
continue outer;
}
@@ -100,7 +104,11 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
}
/**
- * Returns how well this method matches the specified arg types.
+ * Returns how well this method matches the specified arg types using
lenient matching.
+ *
+ * <p>
+ * Lenient matching allows arguments to be matched to parameters based
on type compatibility,
+ * where arguments can be in any order.
*
* <p>
* The number returned is the number of method arguments that match the
passed in arg types.
@@ -109,11 +117,11 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
* @param argTypes The arg types to check against.
* @return How many parameters match or <c>-1</c> if method cannot
handle one or more of the arguments.
*/
- public final int fuzzyParametersMatch(ClassInfo...argTypes) {
+ public final int getLenientParameterMatch(ClassInfo...argTypes) {
int matches = 0;
outer: for (var param : getParameters()) {
for (var a : argTypes) {
- if
(param.getParameterType().isParentOfFuzzyPrimitives(a)) {
+ if
(param.getParameterType().isParentOfLenient(a)) {
matches++;
continue outer;
}
@@ -124,7 +132,11 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
}
/**
- * Returns how well this method matches the specified arg types.
+ * Returns how well this method matches the specified arg types using
lenient matching.
+ *
+ * <p>
+ * Lenient matching allows arguments to be matched to parameters based
on type compatibility,
+ * where arguments can be in any order.
*
* <p>
* The number returned is the number of method arguments that match the
passed in arg types.
@@ -133,7 +145,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
* @param argTypes The arg types to check against.
* @return How many parameters match or <c>-1</c> if method cannot
handle one or more of the arguments.
*/
- public final int fuzzyParametersMatch(Object...argTypes) {
+ public final int getLenientParameterMatch(Object...argTypes) {
int matches = 0;
outer: for (var param : getParameters()) {
for (var a : argTypes) {
@@ -296,23 +308,31 @@ public abstract class ExecutableInfo extends
AccessibleInfo {
public final String getSimpleName() { return isConstructor ?
scn(e.getDeclaringClass()) : e.getName(); }
/**
- * Returns <jk>true</jk> if this method has at most only this arguments
in any order.
+ * Returns <jk>true</jk> if this method has at most only these
arguments using lenient matching.
+ *
+ * <p>
+ * Lenient matching allows arguments to be matched to parameters based
on type compatibility,
+ * where arguments can be in any order.
*
* @param args The arguments to test for.
- * @return <jk>true</jk> if this method has at most only this arguments
in any order.
+ * @return <jk>true</jk> if this method has at most only these
arguments in any order.
*/
- public final boolean hasFuzzyParameterTypes(Class<?>...args) {
- return fuzzyParametersMatch(args) != -1;
+ public final boolean hasParameterTypesLenient(Class<?>...args) {
+ return getLenientParameterMatch(args) != -1;
}
/**
- * Returns <jk>true</jk> if this method has at most only this arguments
in any order.
+ * Returns <jk>true</jk> if this method has at most only these
arguments using lenient matching.
+ *
+ * <p>
+ * Lenient matching allows arguments to be matched to parameters based
on type compatibility,
+ * where arguments can be in any order.
*
* @param args The arguments to test for.
- * @return <jk>true</jk> if this method has at most only this arguments
in any order.
+ * @return <jk>true</jk> if this method has at most only these
arguments in any order.
*/
- public final boolean hasFuzzyParameterTypes(ClassInfo...args) {
- return fuzzyParametersMatch(args) != -1;
+ public final boolean hasParameterTypesLenient(ClassInfo...args) {
+ return getLenientParameterMatch(args) != -1;
}
/**
@@ -324,7 +344,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
public final boolean hasMatchingParameterTypes(Class<?>...args) {
var params = getParameters();
return params.size() == args.length
- && params.stream().allMatch(p ->
stream(args).anyMatch(a -> p.getParameterType().isParentOfFuzzyPrimitives(a)));
+ && params.stream().allMatch(p ->
stream(args).anyMatch(a -> p.getParameterType().isParentOfLenient(a)));
}
/**
@@ -336,7 +356,7 @@ public abstract class ExecutableInfo extends AccessibleInfo
{
public final boolean hasMatchingParameterTypes(ClassInfo...args) {
var params = getParameters();
return params.size() == args.length
- && params.stream().allMatch(p ->
stream(args).anyMatch(a -> p.getParameterType().isParentOfFuzzyPrimitives(a)));
+ && params.stream().allMatch(p ->
stream(args).anyMatch(a -> p.getParameterType().isParentOfLenient(a)));
}
/**
diff --git
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
index bccffcc565..64bdbf712f 100644
---
a/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
+++
b/juneau-core/juneau-common/src/main/java/org/apache/juneau/common/reflect/MethodInfo.java
@@ -235,12 +235,30 @@ public class MethodInfo extends ExecutableInfo implements
Comparable<MethodInfo>
}
/**
- * Returns the number of matching arguments for this method.
+ * Returns <jk>true</jk> if this method has at most only these
parameter types using lenient matching.
+ *
+ * <p>
+ * Lenient matching allows arguments to be matched to parameters based
on type compatibility,
+ * where arguments can be in any order.
+ *
+ * @param args The parameter types to test for.
+ * @return <jk>true</jk> if this method has at most only these
parameter types in any order.
+ */
+ public boolean hasFuzzyParameterTypes(Class<?>...args) {
+ return hasParameterTypesLenient(args);
+ }
+
+ /**
+ * Returns the number of matching arguments for this method using
lenient matching.
+ *
+ * <p>
+ * Lenient matching allows arguments to be matched to parameters based
on type compatibility,
+ * where arguments can be in any order, extra arguments are ignored,
and missing arguments return -1.
*
* @param args The arguments to check.
- * @return the number of matching arguments for this method.
+ * @return The number of matching arguments for this method, or -1 if
not all parameters can be matched.
*/
- public int canAcceptFuzzy(Object...args) {
+ public int canAcceptLenient(Object...args) {
int matches = 0;
outer: for (var param : getParameters()) {
for (var a : args) {
@@ -691,10 +709,10 @@ public class MethodInfo extends ExecutableInfo implements
Comparable<MethodInfo>
}
/**
- * Invokes the specified method using fuzzy-arg matching.
+ * Invokes the specified method using lenient argument matching.
*
* <p>
- * Arguments will be matched to the parameters based on the parameter
types.
+ * Lenient matching allows arguments to be matched to parameters based
on parameter types.
* <br>Arguments can be in any order.
* <br>Extra arguments will be ignored.
* <br>Missing arguments will be left <jk>null</jk>.
@@ -711,8 +729,36 @@ public class MethodInfo extends ExecutableInfo implements
Comparable<MethodInfo>
* @return
* The results of the method invocation.
* @throws ExecutableException Exception occurred on invoked
constructor/method/field.
+ * @deprecated Use {@link #invokeLenient(Object, Object...)}
*/
+ @Deprecated
public Object invokeFuzzy(Object pojo, Object...args) throws
ExecutableException {
+ return invokeLenient(pojo, args);
+ }
+
+ /**
+ * Invokes the specified method using lenient argument matching.
+ *
+ * <p>
+ * Lenient matching allows arguments to be matched to parameters based
on parameter types.
+ * <br>Arguments can be in any order.
+ * <br>Extra arguments will be ignored.
+ * <br>Missing arguments will be left <jk>null</jk>.
+ *
+ * <p>
+ * Note that this only works for methods that have distinguishable
argument types.
+ * <br>It's not going to work on methods with generic argument types
like <c>Object</c>
+ *
+ * @param pojo
+ * The POJO the method is being called on.
+ * <br>Can be <jk>null</jk> for static methods.
+ * @param args
+ * The arguments to pass to the method.
+ * @return
+ * The results of the method invocation.
+ * @throws ExecutableException Exception occurred on invoked
constructor/method/field.
+ */
+ public Object invokeLenient(Object pojo, Object...args) throws
ExecutableException {
try {
return m.invoke(pojo,
ClassUtils.getMatchingArgs(m.getParameterTypes(), args));
} catch (IllegalAccessException | InvocationTargetException e) {
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
index 93282bcacf..0e87ae4a69 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
@@ -201,7 +201,7 @@ public class ClassMeta<T> implements Type {
x -> x.isStatic()
&& x.isNotDeprecated()
&& x.hasName("example")
- &&
x.hasFuzzyParameterTypes(BeanSession.class))
+ &&
x.hasParameterTypesLenient(BeanSession.class))
).map(MethodInfo::inner)
.orElse(null);
// @formatter:on
@@ -243,7 +243,7 @@ public class ClassMeta<T> implements Type {
}
ci.forEachDeclaredMethod(m -> m.hasAnnotation(bc,
Example.class), m -> {
- if (! (m.isStatic() &&
m.hasFuzzyParameterTypes(BeanSession.class) &&
ci.isParentOf(m.getReturnType().inner())))
+ if (! (m.isStatic() &&
m.hasParameterTypesLenient(BeanSession.class) &&
ci.isParentOf(m.getReturnType().inner())))
throw new ClassMetaRuntimeException(c,
"@Example used on invalid method ''{0}''. Must be static and return an
instance of the declaring class.", m.toString());
m.setAccessible();
exampleMethod = m.inner();
@@ -1012,7 +1012,7 @@ public class ClassMeta<T> implements Type {
if (nn(example))
return jpSession.parse(example, this);
if (nn(exampleMethod))
- return
(T)MethodInfo.of(exampleMethod).invokeFuzzy(null, session);
+ return
(T)MethodInfo.of(exampleMethod).invokeLenient(null, session);
if (nn(exampleField))
return (T)exampleField.get(null);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
index 6b5d4cf536..974871cd68 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoListSwap.java
@@ -132,7 +132,7 @@ public class AutoListSwap<T> extends ObjectSwap<T,List<?>> {
&& mi.isVisible(bc.getBeanMethodVisibility())
&& mi.hasAnyName(SWAP_METHOD_NAMES)
&& mi.hasReturnTypeParent(List.class)
- && mi.hasFuzzyParameterTypes(BeanSession.class)
+ && mi.hasParameterTypesLenient(BeanSession.class)
&& mi.hasNoAnnotation(bc, BeanIgnore.class);
// @formatter:on
}
@@ -154,7 +154,7 @@ public class AutoListSwap<T> extends ObjectSwap<T,List<?>> {
&& mi.isStatic()
&& mi.isVisible(bc.getBeanMethodVisibility())
&& mi.hasAnyName(UNSWAP_METHOD_NAMES)
- && mi.hasFuzzyParameterTypes(BeanSession.class,
rt.inner())
+ && mi.hasParameterTypesLenient(BeanSession.class,
rt.inner())
&& mi.hasReturnTypeParent(ci)
&& mi.hasNoAnnotation(bc, BeanIgnore.class);
// @formatter:on
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
index 6884b98c47..d3d9bc42a5 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoMapSwap.java
@@ -132,7 +132,7 @@ public class AutoMapSwap<T> extends ObjectSwap<T,Map<?,?>> {
&& mi.isVisible(bc.getBeanMethodVisibility())
&& mi.hasAnyName(SWAP_METHOD_NAMES)
&& mi.hasReturnTypeParent(Map.class)
- && mi.hasFuzzyParameterTypes(BeanSession.class)
+ && mi.hasParameterTypesLenient(BeanSession.class)
&& mi.hasNoAnnotation(bc, BeanIgnore.class);
// @formatter:on
}
@@ -154,7 +154,7 @@ public class AutoMapSwap<T> extends ObjectSwap<T,Map<?,?>> {
&& mi.isStatic()
&& mi.isVisible(bc.getBeanMethodVisibility())
&& mi.hasAnyName(UNSWAP_METHOD_NAMES)
- && mi.hasFuzzyParameterTypes(BeanSession.class,
rt.inner())
+ && mi.hasParameterTypesLenient(BeanSession.class,
rt.inner())
&& mi.hasReturnTypeParent(ci)
&& mi.hasNoAnnotation(bc, BeanIgnore.class);
// @formatter:on
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
index d5598718b2..5bb4296bc4 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoNumberSwap.java
@@ -157,7 +157,7 @@ public class AutoNumberSwap<T> extends ObjectSwap<T,Number>
{
&& mi.isVisible(bc.getBeanMethodVisibility())
&& (rt.isChildOf(Number.class) || (rt.isPrimitive() &&
rt.isAny(int.class, short.class, long.class, float.class, double.class,
byte.class)))
&& mi.hasAnyName(SWAP_METHOD_NAMES)
- && mi.hasFuzzyParameterTypes(BeanSession.class)
+ && mi.hasParameterTypesLenient(BeanSession.class)
&& mi.hasNoAnnotation(bc, BeanIgnore.class);
// @formatter:on
}
@@ -179,7 +179,7 @@ public class AutoNumberSwap<T> extends ObjectSwap<T,Number>
{
&& mi.isStatic()
&& mi.isVisible(bc.getBeanMethodVisibility())
&& mi.hasAnyName(UNSWAP_METHOD_NAMES)
- && mi.hasFuzzyParameterTypes(BeanSession.class,
rt.inner())
+ && mi.hasParameterTypesLenient(BeanSession.class,
rt.inner())
&& mi.hasReturnTypeParent(ci)
&& mi.hasNoAnnotation(bc, BeanIgnore.class);
// @formatter:on
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
index 5f6dad2a8f..6c158384ff 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swap/AutoObjectSwap.java
@@ -133,7 +133,7 @@ public class AutoObjectSwap<T> extends ObjectSwap<T,Object>
{
&& mi.isNotStatic()
&& mi.isVisible(bc.getBeanMethodVisibility())
&& mi.hasAnyName(SWAP_METHOD_NAMES)
- && mi.hasFuzzyParameterTypes(BeanSession.class)
+ && mi.hasParameterTypesLenient(BeanSession.class)
&& mi.hasNoAnnotation(bc, BeanIgnore.class);
// @formatter:on
}
@@ -155,7 +155,7 @@ public class AutoObjectSwap<T> extends ObjectSwap<T,Object>
{
&& mi.isStatic()
&& mi.isVisible(bc.getBeanMethodVisibility())
&& mi.hasAnyName(UNSWAP_METHOD_NAMES)
- && mi.hasFuzzyParameterTypes(BeanSession.class,
rt.inner())
+ && mi.hasParameterTypesLenient(BeanSession.class,
rt.inner())
&& mi.hasReturnTypeParent(ci)
&& mi.hasNoAnnotation(bc, BeanIgnore.class);
// @formatter:on
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
index 821bcff8e7..a5ed60ae10 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ClassInfo_Test.java
@@ -1604,14 +1604,14 @@ public class ClassInfo_Test extends TestBase {
//-----------------------------------------------------------------------------------------------------------------
@Test void o01_isParentOfFuzzyPrimitives() {
-
assertTrue(ClassInfo.of(String.class).isParentOfFuzzyPrimitives(String.class));
-
assertTrue(ClassInfo.of(CharSequence.class).isParentOfFuzzyPrimitives(String.class));
-
assertFalse(ClassInfo.of(String.class).isParentOfFuzzyPrimitives(CharSequence.class));
-
assertTrue(ClassInfo.of(int.class).isParentOfFuzzyPrimitives(Integer.class));
-
assertTrue(ClassInfo.of(Integer.class).isParentOfFuzzyPrimitives(int.class));
-
assertTrue(ClassInfo.of(Number.class).isParentOfFuzzyPrimitives(int.class));
-
assertFalse(ClassInfo.of(int.class).isParentOfFuzzyPrimitives(Number.class));
-
assertFalse(ClassInfo.of(int.class).isParentOfFuzzyPrimitives(long.class));
+
assertTrue(ClassInfo.of(String.class).isParentOfLenient(String.class));
+
assertTrue(ClassInfo.of(CharSequence.class).isParentOfLenient(String.class));
+
assertFalse(ClassInfo.of(String.class).isParentOfLenient(CharSequence.class));
+
assertTrue(ClassInfo.of(int.class).isParentOfLenient(Integer.class));
+
assertTrue(ClassInfo.of(Integer.class).isParentOfLenient(int.class));
+
assertTrue(ClassInfo.of(Number.class).isParentOfLenient(int.class));
+
assertFalse(ClassInfo.of(int.class).isParentOfLenient(Number.class));
+
assertFalse(ClassInfo.of(int.class).isParentOfLenient(long.class));
}
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ConstructorInfoTest.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ConstructorInfoTest.java
index 93cac4180f..92b2fdf48e 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ConstructorInfoTest.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ConstructorInfoTest.java
@@ -113,13 +113,13 @@ class ConstructorInfoTest extends TestBase {
b_c4 = b.getPublicConstructor(x ->
x.hasParameterTypes(String.class, String.class));
@Test void invoke() throws Exception {
- assertEquals(null, b_c1.newInstanceFuzzy().toString());
- assertEquals("foo", b_c2.newInstanceFuzzy("foo").toString());
+ assertEquals(null, b_c1.newInstanceLenient().toString());
+ assertEquals("foo", b_c2.newInstanceLenient("foo").toString());
}
@Test void accessible() throws Exception {
b_c3.accessible(Visibility.PROTECTED);
- assertEquals(null, b_c3.newInstanceFuzzy(123).toString());
+ assertEquals(null, b_c3.newInstanceLenient(123).toString());
}
@Test void compareTo() {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ExecutableInfo_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ExecutableInfo_Test.java
index 03cac9d33c..c49bdbfacd 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ExecutableInfo_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/ExecutableInfo_Test.java
@@ -390,11 +390,11 @@ class ExecutableInfo_Test extends TestBase {
}
@Test void hasFuzzyArgs() {
- assertTrue(e_hasParams.hasFuzzyParameterTypes(int.class));
- assertTrue(e_hasParams.hasFuzzyParameterTypes(int.class,
long.class));
- assertFalse(e_hasParams.hasFuzzyParameterTypes(long.class));
- assertTrue(e_hasNoParams.hasFuzzyParameterTypes(new Class[0]));
- assertTrue(e_hasNoParams.hasFuzzyParameterTypes(long.class));
+ assertTrue(e_hasParams.hasParameterTypesLenient(int.class));
+ assertTrue(e_hasParams.hasParameterTypesLenient(int.class,
long.class));
+ assertFalse(e_hasParams.hasParameterTypesLenient(long.class));
+ assertTrue(e_hasNoParams.hasParameterTypesLenient(new
Class[0]));
+ assertTrue(e_hasNoParams.hasParameterTypesLenient(long.class));
}
@Test void isDeprecated() {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/MethodInfo_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/MethodInfo_Test.java
index ad23dea2d8..9f5285bc68 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/common/reflect/MethodInfo_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/common/reflect/MethodInfo_Test.java
@@ -482,9 +482,9 @@ class MethodInfo_Test extends TestBase {
@Test void invokeFuzzy() throws Exception {
var e = new E();
- e_a1.invokeFuzzy(e, "foo", 123);
+ e_a1.invokeLenient(e, "foo", 123);
assertEquals("foo", e.f);
- e_a1.invokeFuzzy(e, 123, "bar");
+ e_a1.invokeLenient(e, 123, "bar");
assertEquals("bar", e.f);
}