diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java b/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java
index <HASH>..<HASH> 100644
--- a/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java
+++ b/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java
@@ -2452,7 +2452,9 @@ public interface TypeWriter<T> {
 
                 @Override
                 public int getModifiers() {
-                    return Opcodes.ACC_STATIC | Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC;
+                    return Opcodes.ACC_SYNTHETIC | Opcodes.ACC_STATIC | (instrumentedType.isClassType()
+                            ? Opcodes.ACC_PRIVATE
+                            : Opcodes.ACC_PUBLIC);
                 }
 
                 @Override
Set rebased class initializer method to be public if the class initializer is defined on an interface type.