/** * Method for creating an instance that has same bindings as this object, * plus an indicator for additional type variable that may be unbound within * this context; this is needed to resolve recursive self-references. * * @since 1.3 (renamed from "withAdditionalBinding" in 1.2) */ public TypeBindings withUnboundVariable(String name) { int len = (_unboundVariables == null) ? 0 : _unboundVariables.length; String[] names = (len == 0) ? new String[1] : Arrays.copyOf(_unboundVariables, len+1); names[len] = name; return new TypeBindings(_names, _types, names); }
/** * Method for creating an instance that has same bindings as this object, * plus an indicator for additional type variable that may be unbound within * this context; this is needed to resolve recursive self-references. * * @since 1.3 (renamed from "withAdditionalBinding" in 1.2) */ public TypeBindings withUnboundVariable(String name) { int len = (_unboundVariables == null) ? 0 : _unboundVariables.length; String[] names = (len == 0) ? new String[1] : Arrays.copyOf(_unboundVariables, len+1); names[len] = name; return new TypeBindings(_names, _types, names); }
public static TypeBindings create(Class<?> erasedType, ResolvedType[] types) { if (types == null) { types = NO_TYPES; } TypeVariable<?>[] vars = erasedType.getTypeParameters(); String[] names; if (vars == null || vars.length == 0) { names = NO_STRINGS; } else { int len = vars.length; names = new String[len]; for (int i = 0; i < len; ++i) { names[i] = vars[i].getName(); } } // Check here to give better error message if (names.length != types.length) { throw new IllegalArgumentException("Can not create TypeBinding for class "+erasedType.getName() +" with "+types.length+" type parameter" +((types.length == 1) ? "" : "s")+": class expects "+names.length); } return new TypeBindings(names, types, null); }
public static TypeBindings create(Class<?> erasedType, ResolvedType[] types) { if (types == null) { types = NO_TYPES; } TypeVariable<?>[] vars = erasedType.getTypeParameters(); String[] names; if (vars == null || vars.length == 0) { names = NO_STRINGS; } else { int len = vars.length; names = new String[len]; for (int i = 0; i < len; ++i) { names[i] = vars[i].getName(); } } // Check here to give better error message if (names.length != types.length) { throw new IllegalArgumentException("Can not create TypeBinding for class "+erasedType.getName() +" with "+types.length+" type parameter" +((types.length == 1) ? "" : "s")+": class expects "+names.length); } return new TypeBindings(names, types, null); }