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

@Contended doesn't work correctly with inheritance

    XMLWordPrintable

Details

    • b16
    • b34

    Backports

      Description

        if class annotated by @Contended, its fields must be padded. but they don't padded againts subclasses's fields.

        e.g. offset of T1E.int2 and T1E.int3 must be equal to 272 and 276 respectively:

        @Contended
        class T1 {
            private int int1;
        }

        class T1E extends T1 {
            private int int2;
            private int int3;
        }

        PrintFieldLayout:
        T1: field layout
          @140 --- instance fields start ---
          @140 "int1" I
          @140 --- instance fields end ---
          @272 --- instance ends ---
          @ 88 --- static fields start ---
          @344 --- static fields end ---

        T1E: field layout
          @144 --- instance fields start ---
          @144 "int2" I
          @148 "int3" I
          @144 --- instance fields end ---
          @152 --- instance ends ---
          @ 88 --- static fields start ---
          @ 88 --- static fields end ---

        Attachments

          Issue Links

            Activity

              People

                shade Aleksey Shipilev
                iignatyev Igor Ignatyev (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: