@@ -1441,6 +1441,9 @@ public static NumericShaper getShaper(Range singleRange) {
14411441 * EUROPEAN digits are encountered before any strong directional
14421442 * text in the string, the context is presumed to be EUROPEAN, and
14431443 * so the digits will not shape.
1444+ * Any bit set in the {@code ranges} bitmask which is not a
1445+ * recognised value is discarded. Similarly if two bits are
1446+ * specified where one takes precedence, the lesser one is discarded.
14441447 * @param ranges the specified Unicode ranges
14451448 * @return a shaper for the specified ranges
14461449 */
@@ -1460,6 +1463,9 @@ public static NumericShaper getContextualShaper(int ranges) {
14601463 * directional text in the string, the context is presumed to be
14611464 * EUROPEAN, and so the digits will not shape.
14621465 *
1466+ * If two ranges are specified where one takes precedence over the
1467+ * other the lesser range is discarded.
1468+ *
14631469 * @param ranges the specified Unicode ranges
14641470 * @return a contextual shaper for the specified ranges
14651471 * @throws NullPointerException if {@code ranges} is {@code null}.
@@ -1499,6 +1505,9 @@ public static NumericShaper getContextualShaper(int ranges, int defaultContext)
14991505 * range is one of the provided ranges. The shaper uses {@code
15001506 * defaultContext} as the starting context.
15011507 *
1508+ * If two ranges are specified where one takes precedence over the
1509+ * other the lesser range is discarded.
1510+ *
15021511 * @param ranges the specified Unicode ranges
15031512 * @param defaultContext the starting context, such as
15041513 * {@code NumericShaper.Range.EUROPEAN}
@@ -1522,7 +1531,7 @@ public static NumericShaper getContextualShaper(Set<Range> ranges,
15221531 */
15231532 private NumericShaper (int key , int mask ) {
15241533 this .key = key ;
1525- this .mask = mask ;
1534+ this .mask = mask & ( CONTEXTUAL_MASK | ALL_RANGES ) ;
15261535 if (((this .mask & ARABIC ) != 0 ) && ((this .mask & EASTERN_ARABIC ) != 0 )) {
15271536 this .mask &= ~ARABIC ;
15281537 }
0 commit comments