Defer statement initialization in InferredStatementContext
(YANGTOOLS-784)
|
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | 6.0.1, 5.0.8 |
| Type: | Sub-task | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Miroslav Kovac |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
A lot of our logic is implemented in terms of searching effective statements, mostly through StmtContextUtils methods. These go back way to Java 7 and those early days. We currently have Java 11 and possibility of default methods – and since these two reside in the same package the natural thing is to migrate over.
Optional<Boolean> findFirstSubstatementArgument(ConfigurationEffectiveStatement.class);
is what YANGTOOLS-783 is all about, I think. This is a question InferredStatementContext can answer without materializing its substatements – at least for non-SchemaTreeEffectiveStatements we can just forward to prototype. For SchemaTreeEffectiveStatements we do a our->prototype namespace translation (the prototype knows its namespace) and again defer to prototype. Let us also define a: StmtContext.hasSubstatement(Class<? extends EffectiveStatement>) Methods which need to use this method are: StmtContextUtils.containsPresenceSubStmt() StmtContextUtil.hasAncestorOfTypeWithChildOfType() AbstractAugmentStatementSupport.hasWhenSubstatement()
|