< prev index next >

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

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
+  * 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

@@ -36,11 +36,11 @@
  import java.util.Optional;
  import java.util.function.Consumer;
  
  public final class FieldImpl
          extends AbstractElement
-         implements FieldModel, Util.Writable {
+         implements FieldModel, WritableField {
  
      private final ClassReader reader;
      private final int startPos, endPos, attributesPos;
      private List<Attribute<?>> attributes;
  

@@ -51,11 +51,11 @@
          this.attributesPos = attributesPos;
      }
  
      @Override
      public AccessFlags flags() {
-         return new AccessFlagsImpl(AccessFlag.Location.FIELD, reader.readU2(startPos));
+         return new AccessFlagsImpl(AccessFlag.Location.FIELD, fieldFlags());
      }
  
      @Override
      public Optional<ClassModel> parent() {
          if (reader instanceof ClassReaderImpl cri)

@@ -72,10 +72,15 @@
      @Override
      public Utf8Entry fieldType() {
          return reader.readEntry(startPos + 4, Utf8Entry.class);
      }
  
+     @Override
+     public int fieldFlags() {
+         return reader.readU2(startPos);
+     }
+ 
      @Override
      public List<Attribute<?>> attributes() {
          if (attributes == null) {
              attributes = BoundAttribute.readAttributes(this, reader, attributesPos, reader.customAttributes());
          }
< prev index next >