Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1538

Do not use Optional in yang-data-tree-ri operations


    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 12.0.0, 11.0.4
    • None
    • data-impl

      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.

            rovarga Robert Varga
            rovarga Robert Varga
            0 Vote for this issue
            1 Start watching this issue