RFR: 5108778 Too many instances of java.lang.Boolean created in Java application(core-libs)

Aleksey Shipilev aleksey.shipilev at oracle.com
Fri Oct 9 11:16:20 UTC 2015


On 10/08/2015 09:58 PM, Stuart Marks wrote:
> On 10/7/15 12:59 PM, Sebastian Sickelmann wrote:
>> http://cr.openjdk.java.net/~sebastian/5108778/core-libs/webrev.00/
>>
>> jdk:
>> The Boolean constructors are @Deprecated now so that we get
>> compile-warnings for the uses. See also [0] and [1]
>>
>> [0]
>> http://mail.openjdk.java.net/pipermail/discuss/2015-September/003804.html
>> [1]
>> http://mail.openjdk.java.net/pipermail/discuss/2015-October/003805.html
> 
> 
> Hi Sebastian,
> 
> I did suggest adding @Deprecated to the Boolean constructors, but only
> in your own source tree, as a quick means of causing the compiler to
> emit warnings for places where they're used. I don't think we should
> actually go ahead and deprecate them at this time. So, please drop the
> deprecation changes from your patch. Sorry for the misunderstanding.
> 
> (As I've mentioned elsewhere, there is forthcoming work in the area of
> deprecation, so the Boolean constructors will eventually be marked in
> some way so that developers will be advised to update their code.)

Please note that "static final Boolean myBool = new
Boolean(true).booleanValue()" is a spec-recommended way to avoid binary
incompatibilities caused by conditional compilation. See JLS 13.4.9.
Therefore, deprecating Boolean constructors is a spec issue as well.

Thanks,
-Aleksey




More information about the core-libs-dev mailing list