Is there a way to force the compiler to call an ob...
# announcements
n
Is there a way to force the compiler to call an object method before this object is passed as a parameter to another method or returned to the caller? The concrete use case is a Builder for which
applyBindings()
(a normal method of that builder) must be called before it's passed on. We currently do that manually, but this of course leads to bugs where this call was forgotten.
x
This is typically the kind of use case for an Aspect weaving. There are some tools that allow you to inject code automatically at certain points. In theory it is possible in Kotlin (Spring uses that).
n
interesting idea. I will see if that can work for me