ion-java
ion-java copied to clipboard
IonValue should always have a SymbolTable
IonValue impls currently allow null symbol table reference. This adds complexity all over the place, and I don't think its necessary. At the very least, DOM nodes should have a system symbol table.
We should also allow standalone values to have local symtabs. This makes sense during iteration, as via IonSystem.iterate() as well as when building DOMs from a reader, as via IonSystem.newValue(IonReader). Otherwise these things are too detached from their original context.
When inserting such standalone values, the local symtab should be detached and replaced as appropriate for the new context. Must also check unknown symbols at that point.
Imported from ION-267,IONJAVA-116
Here's a profile that shows how expensive it is for a deeply-nested DOM value to traverse all the way to the top-level in order to resolve its symbol table.
However, as mentioned in the issue description, making the symbol table available to each value without upward traversal (probably via IonContext
) requires extra care to be taken when the value (or any of its parent values) are moved to a different context. This will have tradeoffs that should be measured.