TypeMap { @SuppressWarnings("PMD.CompareObjectsWithEquals") public void add(Class<?> type) { final String shortName = ClassUtil.withoutPackageName(type.getName()); Class<?> existingType = typesByName.get(shortName); if (existingType == null) { typesByName.put(type.getName(), type); typesByName.put(shortName, type); return; } if (existingType != type) { throw new IllegalArgumentException( "Short name collision between existing " + existingType + " and new " + type); } } TypeMap(int initialSize);  TypeMap(Class<?>... types); @SuppressWarnings("PMD.CompareObjectsWithEquals") void add(Class<?> type); boolean contains(Class<?> type); boolean contains(String typeName); Class<?> typeFor(String typeName); void add(Class<?>... types); Map<Class<?>, String> asInverseWithShortName(); int size();  }
@Test public void testAddClassOfQ() { TypeMap map = new TypeMap(2); map.add(List.class); try { map.add(java.awt.List.class); } catch (IllegalArgumentException ex) { return; } fail("Uncaught error inserting type with same root names"); }