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

[lworld] Missing access checks for inline fields

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P2 P2
    • repo-valhalla
    • repo-valhalla
    • hotspot

      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.



            fparain Frederic Parain
            fparain Frederic Parain
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: