@Test public void testOf_instantiation_fail() { Exception ex = assertThrows(IllegalArgumentException.class, () -> CodePoints.of(AbstractCodePoints.class)); assertThat(ex.getMessage(), is( "exception occurred while initializing")); }
@SuppressWarnings("unchecked") public static <T extends CodePoints> T of(Class<T> clazz) { if (cache.containsKey(clazz)) { return (T) cache.get(clazz); } try { T codePoints = clazz.getDeclaredConstructor().newInstance(); cache.put(clazz, codePoints); return codePoints; } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalArgumentException("public default constructor not found", e); } catch (InstantiationException | InvocationTargetException e) { throw new IllegalArgumentException("exception occurred while initializing", e); } }
CodePoints implements Serializable { @SuppressWarnings("unchecked") public static <T extends CodePoints> T of(Class<T> clazz) { if (cache.containsKey(clazz)) { return (T) cache.get(clazz); } try { T codePoints = clazz.getDeclaredConstructor().newInstance(); cache.put(clazz, codePoints); return codePoints; } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalArgumentException("public default constructor not found", e); } catch (InstantiationException | InvocationTargetException e) { throw new IllegalArgumentException("exception occurred while initializing", e); } } }
CodePoints implements Serializable { @SuppressWarnings("unchecked") public static <T extends CodePoints> T of(Class<T> clazz) { if (cache.containsKey(clazz)) { return (T) cache.get(clazz); } try { T codePoints = clazz.getDeclaredConstructor().newInstance(); cache.put(clazz, codePoints); return codePoints; } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalArgumentException("public default constructor not found", e); } catch (InstantiationException | InvocationTargetException e) { throw new IllegalArgumentException("exception occurred while initializing", e); } } CodePoints(Integer... codePoints);  CodePoints(String... strings);  CodePoints(Collection<Integer> codePoints);  CodePoints(CodePoints codePoints); }
CodePoints implements Serializable { @SuppressWarnings("unchecked") public static <T extends CodePoints> T of(Class<T> clazz) { if (cache.containsKey(clazz)) { return (T) cache.get(clazz); } try { T codePoints = clazz.getDeclaredConstructor().newInstance(); cache.put(clazz, codePoints); return codePoints; } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalArgumentException("public default constructor not found", e); } catch (InstantiationException | InvocationTargetException e) { throw new IllegalArgumentException("exception occurred while initializing", e); } } CodePoints(Integer... codePoints);  CodePoints(String... strings);  CodePoints(Collection<Integer> codePoints);  CodePoints(CodePoints codePoints); boolean containsAll(String s); int firstExcludedCodePoint(String s); Set<Integer> allExcludedCodePoints(String s); CodePoints union(CodePoints codePoints); CodePoints subtract(CodePoints codePoints); CodePoints intersect(CodePoints codePoints); @SuppressWarnings("unchecked") static T of(Class<T> clazz); static boolean containsAllInAnyCodePoints(String s,
            final CodePoints... codePointsList); @Override boolean equals(Object o); @Override int hashCode(); }
CodePoints implements Serializable { @SuppressWarnings("unchecked") public static <T extends CodePoints> T of(Class<T> clazz) { if (cache.containsKey(clazz)) { return (T) cache.get(clazz); } try { T codePoints = clazz.getDeclaredConstructor().newInstance(); cache.put(clazz, codePoints); return codePoints; } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalArgumentException("public default constructor not found", e); } catch (InstantiationException | InvocationTargetException e) { throw new IllegalArgumentException("exception occurred while initializing", e); } } CodePoints(Integer... codePoints);  CodePoints(String... strings);  CodePoints(Collection<Integer> codePoints);  CodePoints(CodePoints codePoints); boolean containsAll(String s); int firstExcludedCodePoint(String s); Set<Integer> allExcludedCodePoints(String s); CodePoints union(CodePoints codePoints); CodePoints subtract(CodePoints codePoints); CodePoints intersect(CodePoints codePoints); @SuppressWarnings("unchecked") static T of(Class<T> clazz); static boolean containsAllInAnyCodePoints(String s,
            final CodePoints... codePointsList); @Override boolean equals(Object o); @Override int hashCode(); static final int NOT_FOUND; }