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

Need spec clarification of j.l.foreign.*Layout

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • 19
    • core-libs
    • None

        1. ValueLayout.arrayElementVarHandle
        UnsupportedOperationException - if the layout path has one or more elements with incompatible alignment constraints.
        This exception can’t be thrown and the assertion should be removed.
        The condition can’t be constructed.

        2. ValueLayout && all ValueLayout.Of* etc.
        public boolean isPadding()
        the specification of this method is superfluous in ValueLayout and its subclases. This method always return false for them and could be omitted in the spec for ValueLayouts classes as well as for all MemoryLayout subclasses.
        Actually isPadding() method return true only for 20% of layouts.
        Do we need to propagate it everywhere?
        The spec only contians isPadding(), isStruct() and isUnion() for all types of Layouts: ValueLayout, SequenceLayout, GroupLayout: (StructLayout, UnionLayout) and hidden PaddingLayout. From my point of view PaddingLayout can be made public and isPadding removed.

        3. ValueLayout && ValueLayout.Of*
        public ByteOrder order()
        From the other hand the method order() is missing in specification. Although it’s worth to mention it there.

        4. SequenceLayout.SequenceLayout 
        public reshape(long... elementCounts)
        Throws: UnsupportedOperationException - if this sequence layout does not have an element count.
        This exception can’t be thrown and the assertion should be removed. The condition can’t be met.

        5. SequenceLayout.SequenceLayout 
        public flatten()
        Throws:
        UnsupportedOperationException - if this sequence layout, or one of the nested sequence layouts being flattened, does not have an element count.
        This exception can’t be thrown and the assertion should be removed. The condition can’t be met.

        6. SequenceLayout.
        public boolean equals(Object that)
        * two value layouts are considered equal if they have the same byte order (see ValueLayout.order())
        * two group layouts are considered equal if they are of the same kind (see GroupLayout.isStruct(), GroupLayout.isUnion()) and if their member layouts (see GroupLayout.memberLayouts()) are also equal

        These statement should be removed - order(), isStruct(), isUnion() && memberLayouts() are not applicable to SequenceLayout

        7. PathElement.groupElement(null) throws NPE - this should be mentioned in the spec.

              mcimadamore Maurizio Cimadamore
              lkuskov Leonid Kuskov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: