diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java
index 054201ad7ea..a1082f3fb24 100644
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java
@@ -450,7 +450,7 @@ protected void writeField(FieldModel f) {
 
         if (options.verbose)
             writeList(String.format("flags: (0x%04x) ", flags.flagsMask()),
-                    flagsReportUnknown(flags).stream().map(fl -> "ACC_" + fl.toString()).toList(),
+                    flagsReportUnknown(flags).stream().map(fl -> "ACC_" + fl.name()).toList(),
                     "\n");
 
         if (options.showAllAttrs) {
@@ -810,16 +810,16 @@ private Set<String> getClassModifiers(AccessFlags flags) {
         return getModifiers(set);
     }
 
-    private static Set<String> getClassModifiers(AccessFlags flags, int majorVersion, int minorVersion) {
+    private Set<String> getClassModifiers(AccessFlags flags, int majorVersion, int minorVersion) {
         boolean previewClassFile = minorVersion == ClassFile.PREVIEW_MINOR_VERSION;
-        Set<AccessFlag> flagSet = flags.flags();
+        Set<AccessFlag> flagSet = flagsReportUnknown(flags);
         if (flagSet.contains(AccessFlag.INTERFACE)) {
             flagSet = EnumSet.copyOf(flagSet);
             flagSet.remove(AccessFlag.ABSTRACT);
         } else if (Source.isSupported(Source.Feature.VALUE_CLASSES, majorVersion) && previewClassFile) {
-          Set<String> classModifers = getModifiers(flagSet);
-          classModifers.add("value");
-          return classModifers;
+            Set<String> classModifers = getModifiers(flagSet);
+            classModifers.add("value");
+            return classModifers;
         }
         return getModifiers(flagSet);
     }
diff --git a/test/langtools/ProblemList.txt b/test/langtools/ProblemList.txt
index 81d0f3e6bc0..4abbe81138e 100644
--- a/test/langtools/ProblemList.txt
+++ b/test/langtools/ProblemList.txt
@@ -67,7 +67,6 @@ tools/javac/modules/SourceInSymlinkTest.java
 # javap
 
 tools/javap/output/RepeatingTypeAnnotations.java                                8057687    generic-all    emit correct byte code an attributes for type annotations
-tools/javap/UndefinedAccessFlagTest.java                                        8342036    generic-all
 ###########################################################################
 #
 # jdeps
diff --git a/test/langtools/tools/javap/UndefinedAccessFlagTest.java b/test/langtools/tools/javap/UndefinedAccessFlagTest.java
index 822c9e20f35..a87f33d5bdd 100644
--- a/test/langtools/tools/javap/UndefinedAccessFlagTest.java
+++ b/test/langtools/tools/javap/UndefinedAccessFlagTest.java
@@ -92,7 +92,7 @@ void test(TestLocation location) throws Throwable {
                     });
                 case InnerClassesAttribute attr when location == TestLocation.INNER_CLASS -> cb
                     .with(InnerClassesAttribute.of(attr.classes().stream()
-                        .map(ic -> InnerClassInfo.of(ic.innerClass(), ic.outerClass(), ic.innerName(), ic.flagsMask() | 0x0020))
+                        .map(ic -> InnerClassInfo.of(ic.innerClass(), ic.outerClass(), ic.innerName(), ic.flagsMask() | 0x0050))
                         .toList()));
                 default -> cb.with(ce);
             }