LogManagerProperties extends Properties { @Override @SuppressWarnings("CloneDoesntCallSuperClone") public synchronized Object clone() { return exportCopy(defaults); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synchronized String getProperty(final String key); @Override String getProperty(final String key, final String def); @Override Object get(final Object key); @Override synchronized Object put(final Object key, final Object value); @Override Object setProperty(String key, String value); @Override boolean containsKey(final Object key); @Override synchronized Object remove(final Object key); @Override Enumeration<?> propertyNames(); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test public void testClone() throws Exception { String prefix = LogManagerPropertiesTest.class.getName(); Properties parent; LogManagerProperties mp; LogManager manager = LogManager.getLogManager(); try { String key = prefix.concat(".dummy"); parent = new Properties(); parent.put(key, "value"); read(manager, parent); parent = new Properties(); mp = new LogManagerProperties(parent, prefix); assertFalse(contains(mp, key, null)); assertEquals("value", mp.getProperty(key)); assertTrue(contains(mp, key, "value")); } finally { manager.reset(); } Properties clone = (Properties) mp.clone(); assertFalse(clone instanceof LogManagerProperties); assertEquals(Properties.class, clone.getClass()); assertNotSame(clone, parent); assertNotSame(clone, mp); assertEquals(mp.size(), clone.size()); assertTrue(clone.equals(mp)); }