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

[lworld] Missing access checks for inline fields

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P2
    • Resolution: Unresolved
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: hotspot
    • Labels:

      Description

      Access checks are not performed for inline typed fields.

      Example:

      public class OtherClass {
          static primitive class SecretClass {
      byte b = 0;
          }
      }
      public primitive class AccessCheckTest {
          short s = 0;
          OtherClass.SecretClass sc = new OtherClass.SecretClass();

          void print() {
      System.out.println("s="+s+" sc.b="+sc.b);
          }

          public static void main(String[] args) {
      AccessCheckTest[] array = new AccessCheckTest[10];
      array[0].print();
          }
      }

      This code runs normally and prints the value of the fields.
      If the declaration of OtherClass.SecretClass is modified to make it private, and only OtherClass is recompiled, the main method of AccessCheckTest still prints the value of the fields without any access error being reported.



        Attachments

          Activity

            People

            Assignee:
            fparain Frederic Parain
            Reporter:
            fparain Frederic Parain
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: