[MDSAL-780] MD-SAL needs to be AOT-friendly Created: 01/Nov/22 Updated: 09/Jan/24 |
|
| Status: | Confirmed |
| Project: | mdsal |
| Component/s: | Binding runtime |
| Affects Version/s: | None |
| Fix Version/s: | 14.0.0 |
| Type: | Epic | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Name: | AOT friendliness |
| Description |
|
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. |