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

Refactor ExtensionEffectiveStatementImpl instantiation

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Medium
    • Resolution: Done
    • None
    • 5.0.4
    • parser
    • None

    Description

      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).

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: