Sometimes constraints are questionable

Stuart Marks stuart.marks at oracle.com
Wed Jun 10 22:24:14 UTC 2020


On 6/5/20 1:48 PM, James Laskey wrote:
> I’m fixing the two in java.base. The other two are in different modules and would require changes to export. So you can file on those.

I've filed

     https://bugs.openjdk.java.net/browse/JDK-8247373

to enhance the exception message, docs, and to add a test for 
ArraysSupport.newLength.

There's a separate discussion of whether various things in the JDK should be 
refactored to use this utility method. ArraysSupport is in jdk.internal.util, 
which is not exported, and I'm fairly reluctant to add a qualified export just 
for this. So perhaps things outside of java.base can live with doing their own 
calculations.

For other cases, let's wait until after your OOME message fix (JDK-8230744) goes 
in, since it seems like it might take care of a couple right away. Then we can 
revisit the various cases and file bugs individually for them. In particular, 
the use of Math.addExact et. al. and catch/rethrow of ArithmeticException can 
probably be replaced with a call to ArraysSupport.newLength, but individual 
cases will have to be looked at carefully.

s'marks


More information about the core-libs-dev mailing list