src/main/java/com/googlecode/objectify/repackaged/gentyref/TypeFactory.java
private static void checkParametersWithinBound(ParameterizedType type) {
		Type[] arguments = type.getActualTypeArguments();
		TypeVariable<?>[] typeParameters = ((Class<?>)type.getRawType()).getTypeParameters();
		
		// a map of type arguments in the type, to fill in variables in the bounds 
		VarMap varMap = new VarMap(type);
		
		// for every bound on every parameter
		for (int i = 0; i < arguments.length; i++) {
			for (Type bound : typeParameters[i].getBounds()) {
				// replace type variables in the bound by their value
				Type replacedBound = varMap.map(bound);
				
				
				if (arguments[i] instanceof WildcardType) {
					WildcardType wildcardTypeParameter = (WildcardType) arguments[i];
					
					// Check if a type satisfying both the bounds of the variable and of the wildcard could exist
					
					// upper bounds must not be mutually exclusive
					for (Type wildcardUpperBound : wildcardTypeParameter.getUpperBounds()) {
						if (!couldHaveCommonSubtype(replacedBound, wildcardUpperBound)) {
							throw new TypeArgumentNotInBoundException(arguments[i], typeParameters[i], bound);
						}
					}
					// a lowerbound in the wildcard must satisfy every upperbound 
					for (Type wildcardLowerBound : wildcardTypeParameter.getLowerBounds()) {
						if (!GenericTypeReflector.isSuperType(replacedBound, wildcardLowerBound)) {
							throw new TypeArgumentNotInBoundException(arguments[i], typeParameters[i], bound);
						}
					}
				} else {
					if (! GenericTypeReflector.isSuperType(replacedBound, arguments[i])) {
						throw new TypeArgumentNotInBoundException(arguments[i], typeParameters[i], bound);
					}
				}
			}
		}
	}
private static void checkParametersWithinBound(ParameterizedType type) {
		Type[] arguments = type.getActualTypeArguments();
		TypeVariable<?>[] typeParameters = ((Class<?>)type.getRawType()).getTypeParameters();
		
		// a map of type arguments in the type, to fill in variables in the bounds 
		VarMap varMap = new VarMap(type);
		
		// for every bound on every parameter
		for (int i = 0; i < arguments.length; i++) {
			for (Type bound : typeParameters[i].getBounds()) {
				// replace type variables in the bound by their value
				Type replacedBound = varMap.map(bound);
				
				
				if (arguments[i] instanceof WildcardType) {
					WildcardType wildcardTypeParameter = (WildcardType) arguments[i];
					
					// Check if a type satisfying both the bounds of the variable and of the wildcard could exist
					
					// upper bounds must not be mutually exclusive
					for (Type wildcardUpperBound : wildcardTypeParameter.getUpperBounds()) {
						if (!couldHaveCommonSubtype(replacedBound, wildcardUpperBound)) {
							throw new TypeArgumentNotInBoundException(arguments[i], typeParameters[i], bound);
						}
					}
					// a lowerbound in the wildcard must satisfy every upperbound 
					for (Type wildcardLowerBound : wildcardTypeParameter.getLowerBounds()) {
						if (!GenericTypeReflector.isSuperType(replacedBound, wildcardLowerBound)) {
							throw new TypeArgumentNotInBoundException(arguments[i], typeParameters[i], bound);
						}
					}
				} else {
					if (! GenericTypeReflector.isSuperType(replacedBound, arguments[i])) {
						throw new TypeArgumentNotInBoundException(arguments[i], typeParameters[i], bound);
					}
				}
			}
		}
	}
private static void checkParametersWithinBound ( ParameterizedType type ) { Type [ ] arguments = type . getActualTypeArguments ( ) ; TypeVariable < ? > [ ] typeParameters = ( ( Class < ? > ) type . getRawType ( ) ) . getTypeParameters ( ) ; // a map of type arguments in the type, to fill in variables in the bounds  VarMap varMap = new VarMap ( type ) ; // for every bound on every parameter for ( int i = 0 ; i < arguments . length ; i ++ ) { for ( Type bound : typeParameters [ i ] . getBounds ( ) ) { // replace type variables in the bound by their value Type replacedBound = varMap . map ( bound ) ; if ( arguments [ i ] instanceof WildcardType ) { WildcardType wildcardTypeParameter = ( WildcardType ) arguments [ i ] ; // Check if a type satisfying both the bounds of the variable and of the wildcard could exist // upper bounds must not be mutually exclusive for ( Type wildcardUpperBound : wildcardTypeParameter . getUpperBounds ( ) ) { if ( ! couldHaveCommonSubtype ( replacedBound , wildcardUpperBound ) ) { throw new TypeArgumentNotInBoundException ( arguments [ i ] , typeParameters [ i ] , bound ) ; } } // a lowerbound in the wildcard must satisfy every upperbound  for ( Type wildcardLowerBound : wildcardTypeParameter . getLowerBounds ( ) ) { if ( ! GenericTypeReflector . isSuperType ( replacedBound , wildcardLowerBound ) ) { throw new TypeArgumentNotInBoundException ( arguments [ i ] , typeParameters [ i ] , bound ) ; } } } else { if ( ! GenericTypeReflector . isSuperType ( replacedBound , arguments [ i ] ) ) { throw new TypeArgumentNotInBoundException ( arguments [ i ] , typeParameters [ i ] , bound ) ; } } } } }
Check if the type arguments of the given type are within the bounds declared on the type parameters.
Only the type arguments of the type itself are checked, the possible owner type is assumed to be valid.
<p>
It does not follow the checks defined in the
<a href="http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.5">JLS</a> because there are
several problems with those (see http://stackoverflow.com/questions/7003009 for one).
Instead, this applies some intuition and follows what Java compilers seem to do.

@param type possibly inconsistent type to check.
@throws IllegalArgumentException if the type arguments are not within the bounds
Check if the type arguments of the given type are within the bounds declared on the type parameters . Only the type arguments of the type itself are checked the possible owner type is assumed to be valid . <p > It does not follow the checks defined in the <a href = http : // java . sun . com / docs / books / jls / third_edition / html / typesValues . html#4 . 5 > JLS< / a > because there are several problems with those ( see http : // stackoverflow . com / questions / 7003009 for one ) . Instead this applies some intuition and follows what Java compilers seem to do .