< prev index next >

src/java.base/share/classes/jdk/internal/classfile/impl/DirectFieldBuilder.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this
--- 1,7 ---
  /*
!  * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

*** 34,11 ***
  
  import static java.util.Objects.requireNonNull;
  
  public final class DirectFieldBuilder
          extends AbstractDirectBuilder<FieldModel>
!         implements TerminalFieldBuilder, Util.Writable {
      private final Utf8Entry name;
      private final Utf8Entry desc;
      private int flags;
  
      public DirectFieldBuilder(SplitConstantPool constantPool,
--- 34,11 ---
  
  import static java.util.Objects.requireNonNull;
  
  public final class DirectFieldBuilder
          extends AbstractDirectBuilder<FieldModel>
!         implements TerminalFieldBuilder, WritableField {
      private final Utf8Entry name;
      private final Utf8Entry desc;
      private int flags;
  
      public DirectFieldBuilder(SplitConstantPool constantPool,

*** 82,6 ***
--- 82,22 ---
      @Override
      public void writeTo(BufWriterImpl buf) {
          buf.writeU2U2U2(flags, buf.cpIndex(name), buf.cpIndex(desc));
          attributes.writeTo(buf);
      }
+ 
+     // These values must only be accessed after the field is definitely configured
+     @Override
+     public Utf8Entry fieldName() {
+         return name;
+     }
+ 
+     @Override
+     public Utf8Entry fieldType() {
+         return desc;
+     }
+ 
+     @Override
+     public int fieldFlags() {
+         return flags;
+     }
  }
< prev index next >