Review Request CR#7118743 : Alternative Hashing for String with Hash-based Maps [private fields]
Vitaly Davidovich
vitalyd at gmail.com
Fri May 25 22:36:27 UTC 2012
Agreed on JDK code, but since accessors are also generated for access to
outer class' private fields/methods from inner class, wouldn't want people
to increase visibility of those fields/methods just to get rid of the
accessors in their own code thinking that there are serious problems
associated with them.
Anyway, we're in agreement. :)
Sent from my phone
On May 25, 2012 6:18 PM, "Rémi Forax" <forax at univ-mlv.fr> wrote:
> On 05/26/2012 12:09 AM, Vitaly Davidovich wrote:
>
>>
>> Yes, methods/constructors as well - I should've pointed that out but only
>> answered the field question that was originally asked.
>>
>> Valid points on metadata and stack pollution, although a bit pedantic for
>> real code :).
>>
>>
> given that this code is in java.lang, thus use by millions,
> I have no problem to agree that when I review this kind of code,
> I switch myself in pedandic-mode.
>
> Thanks
>>
>>
> cheers,
> Rémi
>
> Sent from my phone
>>
>> On May 25, 2012 6:03 PM, "Rémi Forax" <forax at univ-mlv.fr <mailto:
>> forax at univ-mlv.fr>> wrote:
>>
>> On 05/25/2012 11:50 PM, Vitaly Davidovich wrote:
>>
>> This is specific to private fields in inner classes -
>>
>>
>> and methods and constructors
>>
>> java allows access to
>> them from the outer class, but the JVM doesn't so javac
>> generates synthetic
>> accessor methods for them. Don't think it's a problem for JIT
>> compiler
>> though as it should inline them.
>>
>>
>> yes, there are unconditionally inlined so performance is not the
>> problem.
>> The issues are more that the compiler generates unnecessary code,
>> unnecessary class metadata, stack pollution and stacktrace
>> pollution too.
>>
>> Rémi
>>
>>
>> Sent from my phone
>> On May 25, 2012 5:23 PM, "Ulf Zibis"<Ulf.Zibis at gmx.de
>> <mailto:Ulf.Zibis at gmx.de>> wrote:
>>
>> Am 25.05.2012 22 <tel:25.05.2012%2022>:30, schrieb Jeff Hain:
>>
>> Hello.
>>
>> In HashMap, the class Holder should not declare the
>> static final fields
>>
>> 'private' because the compiler will generate an
>> accessor in that case,
>>
>> I wasn't aware that making fields private could have a
>> downside
>> (other than making them non-visible).
>>
>> Could you, or anyone, please give (a link to) more
>> info about this?
>>
>> I'm interested too.
>>
>> -Ulf
>>
>>
>>
>>
>
More information about the core-libs-dev
mailing list