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

Refactor ExtensionEffectiveStatementImpl instantiation

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 5.0.4
    • None
    • parser
    • None

      Extension statements have the ugly property of being potentially recursive:

      module foobar {
        prefix fb;
      
        extension foo {
          fb:bar;
        }
      
        extension bar {
          fb:foo;
        }
      }  
      

      Here in order to create effective statements for either foo or bar, we need the other effective statement first – leading to the typical chicken-and-egg problem.

      Our current implementation deals with this problem by using a thread-local object leaker and relies on the constructors invoking StmtContext.buildEffective().

      In order to reign in object lifecycle, we need to eliminate this assumption, so that we do not require leaking an unconstructed object.

      Refactor current implementation to use BaseStatementSupport and provide correct lifecycle hooks so that we realize when we are headed towards recursive creation. Escape from it by creating placeholder objects, which will have their details filled in afterwards (such as substatements).

       

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: