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

Remove redundant MemoryLayout::is* methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • repo-panama
    • core-libs

      Now that the `MemoryLayout` sealed hierarchy provides the same information, these redundant methods should be removed for reasons of consistency, symmetry, brevity and simplicity.

      Here are the proposed replacements in user code:

      layout.isPadding() -> layout instanceof PaddingLayout
      layout.isUnion() -> layout instanceof UnionLayout
      layout.isStruct() -> layout instanceof StructLayout

      or in pattern matching:

      switch (layout) {
          case PaddingLayout padding ->
          case UnionLayout union ->
          case StructLayout struct ->
          // more here
      }

      The proposed changes will affect the API which is in *preview*.

            pminborg Per-Ake Minborg
            pminborg Per-Ake Minborg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: