AdvantageKit
AdvantageKit copied to clipboard
Support LogTable.get for mutable measures
This PR aims to address the inability to restore mutable measures from replay logs via LogTable.get as discussed in issue 222
The approach is to create, via reflection, an object of the same type as the provided default value. This makes some assumptions about available constructors; specifically, it assumes the existence of a constructor (double, double, Unit) where Unit is the unit of the default value.
Side note: teams use mutable measures in an attempt to reduce GC pressure. The implementation of LogTable.get fully replaces the mutable object with a new one. Conceivably, the object could be updated in place (this would require changes to the annotation processor, I believe.)