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

javac is issuing an incorrect static access error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 16
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b08

      Description

      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

        Attachments

          Activity

            People

            Assignee:
            vromero Vicente Arturo Romero Zaldivar
            Reporter:
            vromero Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: