< prev index next >
test/jdk/java/lang/Character/UnicodeBlock/OptimalMapSize.java
Print this page
rev 59210 : imported patch 8239383
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -21,11 +21,11 @@
* questions.
*/
/**
* @test
- * @bug 8080535 8191410 8215194 8221431
+ * @bug 8080535 8191410 8215194 8221431 8239383
* @summary Expected size of Character.UnicodeBlock.map is not optimal
* @library /test/lib
* @modules java.base/java.lang:open
* java.base/java.util:open
* @build jdk.test.lib.util.OptimalCapacity
@@ -45,26 +45,27 @@
// After implementing support of Unicode 9 and 10 in Java, there will
// be 638 entries in Character.UnicodeBlock.map.
//
// As of Unicode 11, 667 entries are expected.
// As of Unicode 12.1, 676 entries are expected.
+// As of Unicode 13.0, 684 entries are expected.
//
// Initialization of the map and this test will have to be adjusted
// accordingly then.
//
// Note that HashMap's implementation aligns the initial capacity to
// a power of two size, so it will end up 1024 (and thus succeed) in
-// cases, such as 638, 667, and 676.
+// cases, such as 638, 667, 676, and 684.
public class OptimalMapSize {
public static void main(String[] args) throws Throwable {
// The initial size of Character.UnicodeBlock.map.
// See src/java.base/share/classes/java/lang/Character.java
Field f = Character.UnicodeBlock.class.getDeclaredField("NUM_ENTITIES");
f.setAccessible(true);
int num_entities = f.getInt(null);
- assert num_entities == 676;
+ assert num_entities == 684;
int initialCapacity = (int)(num_entities / 0.75f + 1.0f);
OptimalCapacity.ofHashMap(Character.UnicodeBlock.class,
"map", initialCapacity);
}
< prev index next >