TypeUtils { static String toLongString(final TypeVariable<?> var) { Validation.notNull(var, "var"); final StringBuilder buf = new StringBuilder(); final GenericDeclaration d = var.getGenericDeclaration(); if (d instanceof Class<?>) { Class<?> c = (Class<?>) d; while (true) { if (c.getEnclosingClass() == null) { buf.insert(0, c.getName()); break; } buf.insert(0, c.getSimpleName()).insert(0, '.'); c = c.getEnclosingClass(); } } else if (d instanceof Type) { buf.append(toString((Type) d)); } else { buf.append(d); } return buf.append(':').append(typeVariableToString(var)).toString(); } private  TypeUtils(); static boolean isAssignable(final Type type, final Type toType); static Type[] normalizeUpperBounds(final Type[] bounds); static boolean equals(final Type t1, final Type t2); static String toString(final Type type); static int[] add(int[] array, int element);  }
@Test public void testToLongString() { assertEquals(getClass().getName() + ":B", TypeUtils.toLongString(getClass().getTypeParameters()[0])); }