Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8249829

javac is issuing an incorrect static access error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 16
    • None
    • tools
    • None
    • b08

      this code:

      import java.security.*;

      class Builder {}

      class StaticError {
          static Builder newInstance(Object provider) {
              return new Builder() {
                  private final PrivilegedExceptionAction<KeyStore> action = new PrivilegedExceptionAction<KeyStore>() {
                      public KeyStore run() throws Exception {
                          if (provider == null) {}
                          return null;
                      }
                  };
              };
          }
      }

      is failing with:
      StaticVarBeingAccessed.java:10: error: non-static variable provider cannot be referenced from a static context
                          if (provider == null) {}
                              ^
      1 error

      the recent checks added to fix JDK-8247790 are the cause of this issue

            vromero Vicente Arturo Romero Zaldivar
            vromero Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: