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

Vicente Romero vicente.romero at oracle.com
Fri Jul 24 15:00:01 UTC 2020

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;


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20200724/351848fa/attachment.htm>

More information about the compiler-dev mailing list