Clarification on JDK-8038975
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Jun 4 09:10:40 UTC 2014
On 03/06/14 23:57, Alex Buckley wrote:
> I believe the code should compile. The body of OuterImpl certainly has
> access to the protected member class Inner. Nothing is accessed via
> qualified names that would cause additional protected rules to kick
> in. The fact that 'Inner' is an accessible type for the formal
> parameter 'inner' indicates everything should be well with
> 'inner.iterator()'.
I believe this might be another instance of [1, 2]. Vicente and I did
some rework [3] of the enhanced for loop logic sometime ago (as that was
causing duplicate CP entries in the resulting bytecode) and this work
has bitten back with few accessibility related regressions. This might
well be another one.
[1] - https://bugs.openjdk.java.net/browse/JDK-8013394
[2] - https://bugs.openjdk.java.net/browse/JDK-8011432
[3] - https://bugs.openjdk.java.net/browse/JDK-5053846
Maurizio
>
> Alex
>
> On 6/3/2014 1:35 PM, Paul Govereau wrote:
>> Hello,
>>
>> I have recently fixed
>>
>> https://bugs.openjdk.java.net/browse/JDK-8038975 .
>>
>> Which is a difference in access enforcement for inner classes depending
>> on if an enhanced-for is used or not.
>>
>> However, now the reviewers and I are having doubts that this is a bug.
>> Perhaps javac is correctly handling the enhanced-for and the
>> "diminished" for is not handled correctly.
>>
>> Can anyone help clarify the spec in regard to this issue?
>>
>> Thanks,
>> Paul
More information about the compiler-dev
mailing list