diff --git a/src/main/java/org/mockito/internal/creation/bytebuddy/InlineBytecodeGenerator.java b/src/main/java/org/mockito/internal/creation/bytebuddy/InlineBytecodeGenerator.java index 077bf9780d..10b73c81a2 100644 --- a/src/main/java/org/mockito/internal/creation/bytebuddy/InlineBytecodeGenerator.java +++ b/src/main/java/org/mockito/internal/creation/bytebuddy/InlineBytecodeGenerator.java @@ -252,8 +252,8 @@ private void triggerRetransformation(Set> types, boolean flat) { } else { do { if (mocked.add(type)) { - assureInitialization(type); if (!flatMocked.remove(type)) { + assureInitialization(type); targets.add(type); } addInterfaces(targets, type.getInterfaces()); @@ -356,6 +356,7 @@ private void addInterfaces(Set> types, Class[] interfaces) { for (Class type : interfaces) { if (mocked.add(type)) { if (!flatMocked.remove(type)) { + assureInitialization(type); types.add(type); } addInterfaces(types, type.getInterfaces());