@Test @SuppressWarnings("unchecked") public void testMixedTypes() { List<Object> input = Arrays.<Object> asList(null, true, 1, 1.0, "Hello world", ElementType.METHOD, Arrays.asList(1, 2, 3), Collections.singletonMap("a", "b")); List<Object> output = Protected.object(input); assertEquals(input, output); try { ((List<Object>) output.get(6)).set(0, 0); fail(); } catch (UnsupportedOperationException expected) {} try { ((Map<Object, Object>) output.get(7)).put(0, 0); fail(); } catch (UnsupportedOperationException expected) {} }
public static <J extends JsonDdlObject<J>> J object(J value) { if (value instanceof JsonDdlObject.Builder) { return ((JsonDdlObject.Builder<J>) value).build(); } return value; }
Protected { public static <J extends JsonDdlObject<J>> J object(J value) { if (value instanceof JsonDdlObject.Builder) { return ((JsonDdlObject.Builder<J>) value).build(); } return value; } }
Protected { public static <J extends JsonDdlObject<J>> J object(J value) { if (value instanceof JsonDdlObject.Builder) { return ((JsonDdlObject.Builder<J>) value).build(); } return value; }  }
Protected { public static <J extends JsonDdlObject<J>> J object(J value) { if (value instanceof JsonDdlObject.Builder) { return ((JsonDdlObject.Builder<J>) value).build(); } return value; }  static J object(J value); static List<T> object(List<T> values); static Map<K, V> object(Map<K, V> values); @SuppressWarnings("unchecked") static T object(T value); }
Protected { public static <J extends JsonDdlObject<J>> J object(J value) { if (value instanceof JsonDdlObject.Builder) { return ((JsonDdlObject.Builder<J>) value).build(); } return value; }  static J object(J value); static List<T> object(List<T> values); static Map<K, V> object(Map<K, V> values); @SuppressWarnings("unchecked") static T object(T value);  }