RFR: JDK-8249829: javac is issuing an incorrect static access error

Vicente Romero vicente.romero at oracle.com
Mon Jul 27 14:06:32 UTC 2020


thanks for the review,
Vicente

On 7/27/20 6:53 AM, Jan Lahoda wrote:
> Looks OK.
>
> Jan
>
> On 24. 07. 20 17:00, Vicente Romero wrote:
>> Please review fix for [1] at [2]. This is a follow up of JDK-8247790, 
>> the checks added to forbid local static types to access type and 
>> local variables defined out of theirs scope was not totally correct 
>> and was issuing an error for code like:
>>
>> import java.security.*;
>> class Test {
>>      static Test newInstance(Object provider) {
>>          return new Test() {
>>              private final PrivilegedExceptionAction<KeyStore> action 
>> =new PrivilegedExceptionAction<KeyStore>() {
>>                  public KeyStore run()throws Exception {
>>                      if (provider ==null) {}  <-------- compiler was 
>> issuing an error because of this access
>>                      return null;
>>                  }
>>              };
>>          };
>>      }
>> }
>>
>> Thanks,
>> Vicente
>>
>> https://bugs.openjdk.java.net/browse/JDK-8249829
>> http://cr.openjdk.java.net/~vromero/8249829/webrev.00/



More information about the compiler-dev mailing list