0
Class A {
    private B bObj;
}

Class B {
    private A aObj;
}

I am trying to generate above classes using bytebuddy using InstrumentedType.Default but getting Invisible field exception. Could someone please explain in detail how to solve.

Below is a reference Byte-buddy: generate classes with cyclic types

David
  • 8,113
  • 2
  • 17
  • 36

1 Answers1

0

Maybe you want to revisit your classes and get rid of the cyclic dependency first. It is not a good design pattern to begin with.

Usually such constructs can be avoided when introducing a 3rd interface/class.