private static boolean isSignatureVarargsAssignable( Class<?>[] from, Class<?>[] to ) { if ( to.length == 0 || to.length > from.length + 1 ) return false; int last = to.length - 1; if ( to[last] == null || !to[last].isArray() ) return false; if ( from.length == to.length && from[last] != null && from[last].isArray() && !isJavaAssignable(to[last].getComponentType(), from[last].getComponentType()) ) return false; if ( from.length >= to.length && from[last] != null && !from[last].isArray() ) for ( int i = last; i < from.length; i++ ) if ( !isJavaAssignable(to[last].getComponentType(), from[i]) ) return false; for ( int i = 0; i < last; i++ ) if ( !isJavaAssignable(to[i], from[i]) ) return false; return true; }
if ( Types.isJavaAssignable(Collection.class, toType) ) if ( Types.isJavaAssignable(List.class, toType) || Queue.class == toType ) { if ( Types.isJavaAssignable(toType, ArrayList.class) ) else if ( Types.isJavaAssignable(toType, LinkedList.class) ) } else if ( Types.isJavaAssignable(toType, ArrayDeque.class) ) else if ( Types.isJavaAssignable(toType, LinkedHashSet.class) ) if ( Types.isJavaAssignable(Map.class, toType) ) { if ( Types.isJavaAssignable(Entry.class, Types.arrayElementType(fromType)) ) return mapOfEntries((Entry[]) fromValue); if ( Types.isJavaAssignable(toType, LinkedHashMap.class) ) { int length = Array.getLength(fromValue); Map<Object, Object> map = new LinkedHashMap<>( if ( Types.isJavaAssignable(Entry.class, toType) ) { int length = Array.getLength(fromValue); if ( length == 1 )
if ( Types.isJavaAssignable(Collection.class, baseType) || Types.isJavaAssignable(Map.class, baseType) || Types.isJavaAssignable(Entry.class, baseType) ) baseType = Void.TYPE; if ( Types.isJavaAssignable(Collection.class, originalBaseType) || Types.isJavaAssignable(Map.class, originalBaseType) || Types.isJavaAssignable(Entry.class, originalBaseType) ) try { initializers = Types.castObject(initializers, originalBaseType, Types.CAST); } catch (UtilEvalError e) {
/** Helper class for type suffixes. */ public static class Suffix { private static final Map<String, Class<?>> m = Collections.unmodifiableMap(new HashMap<String, Class<?>>() { private static final long serialVersionUID = 1L; { put("O", Byte.TYPE); put("S", Short.TYPE); put("I", Integer.TYPE); put("L", Long.TYPE); put("W", BigInteger.class); put("w", BigDecimal.class); put("d", Double.TYPE); put("f", Float.TYPE); } }); private static String toUpperKey(Character key) { return key.toString().toUpperCase(); } private static String toLowerKey(Character key) { return key.toString().toLowerCase(); } public static boolean isIntegral(Character key) { return m.containsKey(toUpperKey(key)); } public static Class<?> getIntegralType(Character key) { return m.get(toUpperKey(key));
&& !Types.isJavaAssignable( toType, fromType ) ) { if ( checkOnly )
&& !Types.isJavaAssignable( toType, fromType ) ) { if ( checkOnly )