Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Do not use Optional in yang-data-tree-ri operations
Description
We are using Optional<? extends TreeNode> as baseline metadata against we validate the tree – throughout ModificationApplyOperation – both as an argument and as a return value.
While the return value might be appropriate, the use as arguments is not (as we are not religious about them as some others.
This also leads us to store Optionals as fields, which leaks them to the heap, which means we have some amount of overhead unless the JVM can prove an InMemoryModification does not leak to heap. That always happens by the very design.
Convert use of Optional<? extends TreeNode> to @Nullable TreeNode and explicitly annotate pre-existing uses of plain TreeNode references as @NonNull.
We are using Optional<? extends TreeNode> as baseline metadata against we validate the tree – throughout ModificationApplyOperation – both as an argument and as a return value.
While the return value might be appropriate, the use as arguments is not (as we are not religious about them as some others.
This also leads us to store Optionals as fields, which leaks them to the heap, which means we have some amount of overhead unless the JVM can prove an InMemoryModification does not leak to heap. That always happens by the very design.
Convert use of Optional<? extends TreeNode> to @Nullable TreeNode and explicitly annotate pre-existing uses of plain TreeNode references as @NonNull.