-
Epic
-
Resolution: Unresolved
-
Medium
-
None
-
AOT friendliness
MD-SAL components are designed for Java 8, when the distinction between compile-time and run-time was very much shifted to the runtime.
With the advent of class data sharing and project Graal AOT, the reliance on run-time should be diminished: as of Java 9 we have a new link-time processing phase, which feeds into the runtime image.
Most of the time (disregarding OSGi) we end up with a compile-time (or really link-time) bounded view of what YANG models look like.
mdsal-binding-dom-adapter and mdsal-binding-dom-codec rely on runtime information to construct binding-to-dom view of things.
For link-time arrangements we should generate static mdsal-binding-dom-codec classes (and perhaps mdsal-binding-dom-adapter dependecies), which feed in into AOT construction, such that the translation can be fully static and does not rely on java.lang.reflect.
The reason for this being java.lang.reflect is inherently a run-time thing and therefore if we know the binding at link-time, we should be generate a static binding and rely on it – throwing LinkageError when we encounter something weird.