Open sageserpent-open opened 6 years ago
The quick way to fix this is to intercept package private mutators.
Actually, this is supported already by ByteBuddy - the problem is that an override can't be defined by ByteBuddy unless the proxy class exists in the same package as the method being overridden / defined. Need to think about this - what if a class inherits several interfaces that define package-private methods, but the interfaces are in separate packages?
Even then, I'm unsure as to whether ByteBuddy will forward a call to another object from the package-private override it creates. It seems logical that it can do this, but...
This was seen and worked-around in issue #39 . The problem is that if a mutating method calls another mutating method on one of its item arguments, the latter won't be detected as a mutation if the argument's method is package-private.
Given this is a natural way of enforcing relationship invariants on item that can refer to each other cyclically, we should support this.