< prev index next >

src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/PaddingLayout.java

Print this page
@@ -23,14 +23,12 @@
   *  questions.
   *
   */
  package jdk.incubator.foreign;
  
- import java.lang.constant.Constable;
  import java.lang.constant.ConstantDescs;
  import java.lang.constant.DynamicConstantDesc;
- import java.util.Map;
  import java.util.Objects;
  import java.util.Optional;
  import java.util.OptionalLong;
  
  /**

@@ -51,15 +49,15 @@
   * This class is immutable and thread-safe.
   */
  /* package-private */ final class PaddingLayout extends AbstractLayout implements MemoryLayout {
  
      PaddingLayout(long size) {
-         this(size, 1, Map.of());
+         this(size, 1, Optional.empty());
      }
  
-     PaddingLayout(long size, long alignment, Map<String, Constable> attributes) {
-         super(OptionalLong.of(size), alignment, attributes);
+     PaddingLayout(long size, long alignment, Optional<String> name) {
+         super(OptionalLong.of(size), alignment, name);
      }
  
      @Override
      public String toString() {
          return decorateLayoutString("x" + bitSize());

@@ -71,25 +69,24 @@
              return true;
          }
          if (!super.equals(other)) {
              return false;
          }
-         if (!(other instanceof PaddingLayout)) {
+         if (!(other instanceof PaddingLayout p)) {
              return false;
          }
-         PaddingLayout p = (PaddingLayout)other;
          return bitSize() == p.bitSize();
      }
  
      @Override
      public int hashCode() {
          return Objects.hash(super.hashCode(), bitSize());
      }
  
      @Override
-     PaddingLayout dup(long alignment, Map<String, Constable> attributes) {
-         return new PaddingLayout(bitSize(), alignment, attributes);
+     PaddingLayout dup(long alignment, Optional<String> name) {
+         return new PaddingLayout(bitSize(), alignment, name);
      }
  
      @Override
      public boolean hasNaturalAlignment() {
          return true;

@@ -117,14 +114,6 @@
       */
      @Override
      public PaddingLayout withBitAlignment(long alignmentBits) {
          return (PaddingLayout)super.withBitAlignment(alignmentBits);
      }
- 
-     /**
-      * {@inheritDoc}
-      */
-     @Override
-     public PaddingLayout withAttribute(String name, Constable value) {
-         return (PaddingLayout)super.withAttribute(name, value);
-     }
  }
< prev index next >