< prev index next >

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

Print this page
*** 23,14 ***
   *  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;
  
  /**
--- 23,12 ---

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

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

*** 117,14 ***
       */
      @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);
-     }
  }
--- 114,6 ---
< prev index next >