From 70313d0d209158dcca4b01ddf0d1c0068a8533fa Mon Sep 17 00:00:00 2001 From: Kevin Walls Date: Thu, 16 Jan 2025 13:00:57 +0000 Subject: [PATCH] 8345049: Remove the jmx.tabular.data.hash.map compatibility property --- .../openmbean/TabularDataSupport.java | 11 +---- .../openmbean/TabularDataOrderTest.java | 42 +------------------ 2 files changed, 3 insertions(+), 50 deletions(-) diff --git a/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java b/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java index 94c804d9029a6..d670d2da782f1 100644 --- a/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java +++ b/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,16 +143,9 @@ public TabularDataSupport(TabularType tabularType, int initialCapacity, float lo List tmpNames = tabularType.getIndexNames(); this.indexNamesArray = tmpNames.toArray(new String[tmpNames.size()]); - // Since LinkedHashMap was introduced in SE 1.4, it's conceivable even - // if very unlikely that we might be the server of a 1.3 client. In - // that case you'll need to set this property. See CR 6334663. - boolean useHashMap = Boolean.getBoolean("jmx.tabular.data.hash.map"); - // Construct the empty contents HashMap // - this.dataMap = useHashMap ? - new HashMap<>(initialCapacity, loadFactor) : - new LinkedHashMap<>(initialCapacity, loadFactor); + this.dataMap = new LinkedHashMap<>(initialCapacity, loadFactor); } diff --git a/test/jdk/javax/management/openmbean/TabularDataOrderTest.java b/test/jdk/javax/management/openmbean/TabularDataOrderTest.java index 68e9fefdc7cd8..0a1a02c949ffa 100644 --- a/test/jdk/javax/management/openmbean/TabularDataOrderTest.java +++ b/test/jdk/javax/management/openmbean/TabularDataOrderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,8 +57,6 @@ public class TabularDataOrderTest { private static String failure; - private static final String COMPAT_PROP_NAME = "jmx.tabular.data.hash.map"; - private static final String[] intNames = { "unus", "duo", "tres", "quatuor", "quinque", "sex", "septem", "octo", "novem", "decim", @@ -129,44 +127,6 @@ public static void main(String[] args) throws Exception { if (!ordered) fail("Order not preserved"); - // Now test the undocumented property that causes HashMap to be used - // instead of LinkedHashMap, in case serializing to a 1.3 client. - // We serialize and deserialize in case the implementation handles - // this at serialization time. Then we look at object fields; that's - // not guaranteed to work but at worst it will fail spuriously and - // we'll have to update the test. - System.out.println("Testing compatible behaviour"); - System.setProperty(COMPAT_PROP_NAME, "true"); - td = makeTable(); - System.out.println(td); - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - ObjectOutputStream oout = new ObjectOutputStream(bout); - oout.writeObject(td); - oout.close(); - byte[] bytes = bout.toByteArray(); - ByteArrayInputStream bin = new ByteArrayInputStream(bytes); - ObjectInputStream oin = new ObjectInputStream(bin); - td = (TabularData) oin.readObject(); - boolean found = false; - for (Field f : td.getClass().getDeclaredFields()) { - if (Modifier.isStatic(f.getModifiers())) - continue; - f.setAccessible(true); - Object x = f.get(td); - if (x != null && x.getClass() == HashMap.class) { - found = true; - System.out.println( - x.getClass().getName() + " TabularDataSupport." + - f.getName() + " = " + x); - break; - } - } - if (!found) { - fail("TabularDataSupport does not contain HashMap though " + - COMPAT_PROP_NAME + "=true"); - } - System.clearProperty(COMPAT_PROP_NAME); - System.out.println("Testing MXBean behaviour"); MBeanServer mbs = MBeanServerFactory.newMBeanServer(); ObjectName name = new ObjectName("a:b=c");