Add support for purely-effective substatements (YANGTOOLS-1372)

[YANGTOOLS-1384] Remove ModelStatement.statementSource() Created: 13/Dec/21  Updated: 15/Dec/21  Resolved: 14/Dec/21

Status: Resolved
Project: yangtools
Component/s: model-api, model-ri, parser
Affects Version/s: None
Fix Version/s: 8.0.0

Type: Sub-task Priority: High
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

ModelStatement.statementSource() is a confusing contract, as it allows for DeclaredStatements which are not StatementOrigin.DECLARATION. A DeclaredStatement is by definition declared, so this does not quite make sense.

Based on historical record, the interface design comes from 2015 (Java 7). In Java 8 world, though, and thus have a consistent way of saying that:

  • DeclaredStatement is always StatementOrigin.DECLARATION
  • EffectiveStatement is either one of the possibilities based on getDeclared() being null (or not)

Remove all ModelStatement.statementSource() implementations in favor of default implementations in DeclaredStatement and EffectiveStatement.



 Comments   
Comment by Robert Varga [ 15/Dec/21 ]

As it turns out, once we implement YANGTOOLS-1372, this method is only useful for EffectiveStatements. Hence we will be moving it there.

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