[YANGTOOLS-1122] Refactor ExtensionEffectiveStatementImpl instantiation Created: 03/Jul/20  Updated: 06/Jul/20  Resolved: 06/Jul/20

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: None
Fix Version/s: 5.0.4

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
blocks YANGTOOLS-1121 Cleanup AbstractStatementSupport impl... Resolved
Relates
relates to YANGTOOLS-1065 Minimize EffectiveStatement implement... Resolved

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

 


Generated at Wed Feb 07 20:55:15 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.