8263190: Update java.io, java.math, and java.text to use instanceof pattern variable

Reviewed-by: lancea, bpb, darcy, naoto, iris, dfuchs, smarks, redestad
This commit is contained in:
Patrick Concannon 2021-03-09 11:09:06 +00:00
parent 4f0a12ec87
commit 0f2402d0a2
15 changed files with 32 additions and 59 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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
@ -1122,8 +1122,7 @@ public final class CompactNumberFormat extends NumberFormat {
}
Number divisor = matchedValue;
if (count > 0) {
if (matchedValue instanceof BigInteger) {
BigInteger bigValue = (BigInteger) matchedValue;
if (matchedValue instanceof BigInteger bigValue) {
if (bigValue.compareTo(BigInteger.valueOf((long) Math.pow(RANGE_MULTIPLIER, count - 1))) < 0) {
throw new IllegalArgumentException("Invalid Pattern"
+ " [" + compactPatterns[patternIndex]