src/main/java/com/googlecode/objectify/repackaged/gentyref/TypeFactory.java
public static Type parameterizedInnerClass(Type owner, Class<?> clazz, Type... arguments) {
		// never allow an owner on a class that doesn't have one
		if (clazz.getDeclaringClass() == null && owner != null) {
			throw new IllegalArgumentException("Cannot specify an owner type for a top level class");
		}
		
		Type realOwner = transformOwner(owner, clazz);
		
		if (arguments == null) {
			if (clazz.getTypeParameters().length == 0) {
				// no arguments known, but no needed so just use an empty argument list.
				// (we can still end up with a generic type if the owner is generic)
				arguments = new Type[0];
			} else {
				// missing type arguments, return the raw type
				return clazz;
			}
		} else {
			if (arguments.length != clazz.getTypeParameters().length) {
				throw new IllegalArgumentException("Incorrect number of type arguments for [" + clazz + "]: " +
						"expected " + clazz.getTypeParameters().length + ", but got " + arguments.length);
			}
		}
		
		// if the class and its owner simply have no parameters at all, this is not a parameterized type
		if (!GenericTypeReflector.isMissingTypeParameters(clazz)) {
			return clazz;
		}
		
		// if the owner type is missing type parameters and clazz is non-static, this is a raw type
		if (realOwner != null && !Modifier.isStatic(clazz.getModifiers())
				&& GenericTypeReflector.isMissingTypeParameters(realOwner)) {
			return clazz;
		}
		
		ParameterizedType result = new ParameterizedTypeImpl(clazz, arguments, realOwner);
		checkParametersWithinBound(result);
		return result;
	}
public static Type parameterizedInnerClass(Type owner, Class<?> clazz, Type... arguments) {
		// never allow an owner on a class that doesn't have one
		if (clazz.getDeclaringClass() == null && owner != null) {
			throw new IllegalArgumentException("Cannot specify an owner type for a top level class");
		}
		
		Type realOwner = transformOwner(owner, clazz);
		
		if (arguments == null) {
			if (clazz.getTypeParameters().length == 0) {
				// no arguments known, but no needed so just use an empty argument list.
				// (we can still end up with a generic type if the owner is generic)
				arguments = new Type[0];
			} else {
				// missing type arguments, return the raw type
				return clazz;
			}
		} else {
			if (arguments.length != clazz.getTypeParameters().length) {
				throw new IllegalArgumentException("Incorrect number of type arguments for [" + clazz + "]: " +
						"expected " + clazz.getTypeParameters().length + ", but got " + arguments.length);
			}
		}
		
		// if the class and its owner simply have no parameters at all, this is not a parameterized type
		if (!GenericTypeReflector.isMissingTypeParameters(clazz)) {
			return clazz;
		}
		
		// if the owner type is missing type parameters and clazz is non-static, this is a raw type
		if (realOwner != null && !Modifier.isStatic(clazz.getModifiers())
				&& GenericTypeReflector.isMissingTypeParameters(realOwner)) {
			return clazz;
		}
		
		ParameterizedType result = new ParameterizedTypeImpl(clazz, arguments, realOwner);
		checkParametersWithinBound(result);
		return result;
	}
public static Type parameterizedInnerClass ( Type owner , Class < ? > clazz , Type ... arguments ) { // never allow an owner on a class that doesn't have one if ( clazz . getDeclaringClass ( ) == null && owner != null ) { throw new IllegalArgumentException ( "Cannot specify an owner type for a top level class" ) ; } Type realOwner = transformOwner ( owner , clazz ) ; if ( arguments == null ) { if ( clazz . getTypeParameters ( ) . length == 0 ) { // no arguments known, but no needed so just use an empty argument list. // (we can still end up with a generic type if the owner is generic) arguments = new Type [ 0 ] ; } else { // missing type arguments, return the raw type return clazz ; } } else { if ( arguments . length != clazz . getTypeParameters ( ) . length ) { throw new IllegalArgumentException ( "Incorrect number of type arguments for [" + clazz + "]: " + "expected " + clazz . getTypeParameters ( ) . length + ", but got " + arguments . length ) ; } } // if the class and its owner simply have no parameters at all, this is not a parameterized type if ( ! GenericTypeReflector . isMissingTypeParameters ( clazz ) ) { return clazz ; } // if the owner type is missing type parameters and clazz is non-static, this is a raw type if ( realOwner != null && ! Modifier . isStatic ( clazz . getModifiers ( ) ) && GenericTypeReflector . isMissingTypeParameters ( realOwner ) ) { return clazz ; } ParameterizedType result = new ParameterizedTypeImpl ( clazz , arguments , realOwner ) ; checkParametersWithinBound ( result ) ; return result ; }
Creates a type of <tt>clazz</tt> with <tt>arguments</tt> as type arguments, nested in <tt>owner</tt>.
<p>
In the ideal case, this returns a {@link ParameterizedType} with all generic information in it.
If some type arguments are missing or if the resulting type simply doesn't need any type parameters,
it returns the raw <tt>clazz</tt>.
Note that types with some parameters specified and others not, don't exist in Java.
<p>
If the caller does not know the exact <tt>owner</tt> type or <tt>arguments</tt>, <tt>null</tt> should be given
(or {@link #parameterizedClass(Class, Type...)} or {@link #innerClass(Type, Class)} could be used).
If they are not needed (non-generic owner and/or <tt>clazz</tt> has no type parameters), they will be filled in
automatically. If they are needed but are not given, the raw <tt>clazz</tt> is returned.
<p>
The specified <tt>owner</tt> may be any subtype of <tt>clazz.getDeclaringClass()</tt>. It is automatically
converted into the right parameterized version of the declaring class.
If <tt>clazz</tt> is a <tt>static</tt> (nested) class, the owner is not used.

@param owner The owner type. This should be a subtype of <tt>clazz.getDeclaringClass()</tt>,
or <tt>null</tt> if no owner is known.
@param clazz Type class of the type to create
@param arguments Type arguments for the variables of <tt>clazz</tt>, or null if these are not known.
@return A {@link ParameterizedType} if <tt>clazz</tt> or the class declaring <tt>clazz</tt> is generic,
and all the needed type arguments are specified in <tt>owner</tt> and <tt>arguments</tt>.
Otherwise, just returns <tt>clazz</tt>.
@throws IllegalArgumentException if <tt>arguments</tt> (is non-null and) has an incorrect length,
or if one of the <tt>arguments</tt> is not within the bounds declared on the matching type variable,
or if owner is non-null but <tt>clazz</tt> has no declaring class (e.g. is a top-level class),
or if owner is not a a subtype of <tt>clazz.getDeclaringClass()</tt>.
@throws NullPointerException if <tt>clazz</tt> or one of the elements in <tt>arguments</tt> is null.
Creates a type of <tt > clazz< / tt > with <tt > arguments< / tt > as type arguments nested in <tt > owner< / tt > . <p > In the ideal case this returns a { @link ParameterizedType } with all generic information in it . If some type arguments are missing or if the resulting type simply doesn t need any type parameters it returns the raw <tt > clazz< / tt > . Note that types with some parameters specified and others not don t exist in Java . <p > If the caller does not know the exact <tt > owner< / tt > type or <tt > arguments< / tt > <tt > null< / tt > should be given ( or { @link #parameterizedClass ( Class Type ... ) } or { @link #innerClass ( Type Class ) } could be used ) . If they are not needed ( non - generic owner and / or <tt > clazz< / tt > has no type parameters ) they will be filled in automatically . If they are needed but are not given the raw <tt > clazz< / tt > is returned . <p > The specified <tt > owner< / tt > may be any subtype of <tt > clazz . getDeclaringClass () < / tt > . It is automatically converted into the right parameterized version of the declaring class . If <tt > clazz< / tt > is a <tt > static< / tt > ( nested ) class the owner is not used .