[jdk9] RFR: 8163517: Various cleanup in java.io code

Claes Redestad claes.redestad at oracle.com
Thu Aug 18 12:25:50 UTC 2016

On 2016-08-16 19:20, Ivan Gerasimov wrote:
>> ObjectStreamClass:
>> I wonder if the entire getPackageName is replaceable with
>> Class.getPackageName()? If so, ditch the method completely and use
>> Class.getPackageName everywhere. This may complicate backporting to JDK
>> 8 though.
> Unfortunately, Class.getPackageName() cannot handle arrays, so I'll 
> leave it as is. 

There are a number of utility methods around that could be reused,
e.g., jdk.internal.reflect.Reflection.isSameClassPackage handles both 
arrays and
primitive types and could replace both packageEquals and getPackageName in
ObjectStreamClass (which already use j.i.r.Reflection for other things). 
isSameClassPackage in Reflection public should be non-controversial, I hope.



More information about the core-libs-dev mailing list