188188 * Kay Gürtzig 2024-03-14 Bugfix #1139: NullPointerException in analyse_5_7_13() with empty Try
189189 * Kay Gürtzig 2024-04-17 Issues #161, #1161: Improved reachability check (via mayPassControl())
190190 * Kay Gürtzig 2024-10-09 Bugfix #1174: Precaution against NullpPointerException in fetchAuthorDates()
191+ * Kay Gürtzig 2024-11-25 Bugfix #1180: Deep test coverage change on undo/redo propagated
191192 *
192193 ******************************************************************************************************
193194 *
266267import lu .fisch .structorizer .locales .Locales ;
267268import lu .fisch .structorizer .archivar .IRoutinePool ;
268269import lu .fisch .structorizer .arranger .Arranger ;
270+ import lu .fisch .structorizer .executor .Executor ;
269271import lu .fisch .structorizer .executor .Function ;
270272import lu .fisch .structorizer .generators .GeneratorSyntaxChecker ;
271273import lu .fisch .structorizer .gui .*;
@@ -2296,6 +2298,9 @@ public void undo(boolean redoable)
22962298 // START KGU#365 2017-03-19: Enh. #380
22972299 }
22982300 // END KGU#365 2017-03-19
2301+ // START KGU#1036 2024-11-25: Bugfix #1180 Special handling of deep coverage
2302+ boolean wasDeeplyCovered = this .isTestCovered (true );
2303+ // END KGU#1036 2024-11-25
22992304 children = undoList .pop ();
23002305 children .parent = this ;
23012306 // START KGU#120 2016-01-02: Bugfix #85 - restore my StringList attributes from stack
@@ -2345,6 +2350,12 @@ public void undo(boolean redoable)
23452350 }
23462351 }
23472352 // END KGU#703 2019-03-30
2353+ // START KGU#1036 2024-11-25: Bugfix #1180 Special handling of deep coverage
2354+ this .deeplyCovered = this .children .deeplyCovered ;
2355+ if (Element .E_COLLECTRUNTIMEDATA && wasDeeplyCovered != this .isTestCovered (true )) {
2356+ propagateTestCoverage ();
2357+ }
2358+ // END KGU#1036 2024-11-25
23482359 }
23492360 }
23502361
@@ -2370,11 +2381,14 @@ public void adoptAttributes(RootAttributes attributes) {
23702381 */
23712382 public void redo ()
23722383 {
2373- if (redoList .size ()> 0 )
2384+ if (redoList .size () > 0 )
23742385 {
23752386 // START KGU#137 2016-01-11: Bugfix #103 - rely on undoList level comparison
23762387 //this.hasChanged=true;
23772388 // END KGU#137 2016-01-11
2389+ // START KGU#1036 2024-11-25: Bugfix #1180 Special handling of deep coverage
2390+ boolean wasDeeplyCovered = this .isTestCovered (true );
2391+ // END KGU#1036 2024-11-25
23782392 undoList .add ((Subqueue )children .copy ());
23792393 // START KGU#120 2016-01-02: Bugfix #85 - park my StringList attributes on the stack top
23802394 undoList .peek ().setText (this .text .copy ());
@@ -2426,6 +2440,28 @@ public void redo()
24262440 }
24272441 }
24282442 // END KGU#703 2019-03-30
2443+ // START KGU#1036 2024-11-25: Bugfix #1180 Special handling of deep coverage
2444+ this .deeplyCovered = this .children .deeplyCovered ;
2445+ if (Element .E_COLLECTRUNTIMEDATA && wasDeeplyCovered != this .isTestCovered (true )) {
2446+ // Restore the test coverage status of possibly referring Calls and Roots
2447+ propagateTestCoverage ();
2448+ }
2449+ // END KGU#1036 2024-11-25
2450+ }
2451+ }
2452+
2453+ // START KGU#1036 2024-11-25: Bugfix #1180 auxiliary method
2454+ /**
2455+ * Propagates a change of deep test coverage state among potentially referring
2456+ * Roots if this is a subroutine. Will only work if there is an {@link Executor}
2457+ * instance already.
2458+ */
2459+ public void propagateTestCoverage () {
2460+ if (this .isSubroutine ()) {
2461+ Executor exec = Executor .getInstance ();
2462+ if (exec != null ) {
2463+ exec .propagateSubCoverage (this , null );
2464+ }
24292465 }
24302466 }
24312467
@@ -3596,6 +3632,17 @@ public void updateTypeMap(HashMap<String, TypeMapEntry> typeMap)
35963632 }
35973633 }
35983634 // END KGU#261/KGU#332 2017-02-01
3635+
3636+ // START KGU#1036 2024-11-25: Bugfix #1180 Propagate this to potential callers
3637+ @ Override
3638+ public void clearRuntimeData ()
3639+ {
3640+ super .clearRuntimeData ();
3641+ if (Element .E_COLLECTRUNTIMEDATA && this .isSubroutine ()) {
3642+ propagateTestCoverage ();
3643+ }
3644+ }
3645+ // END KGU#1036 2024-11-25
35993646
36003647 // START BFI 2015-12-10
36013648 /**
@@ -6471,12 +6518,12 @@ public int getMinParameterCount()
64716518
64726519 /**
64736520 * Checks whether a call with {@code nArgs} arguments may use this routine diagram. If so,
6474- * returns the number of default values needed to fill all parameters (0 in case o an exact
6521+ * returns the number of default values needed to fill all parameters (0 in case of an exact
64756522 * match), otherwise returns a negative number.
64766523 *
64776524 * @param nArgs - the number of given argument values
64786525 * @return number of available defaults to be used in order to satisfy all parameters, or a
6479- * negative number
6526+ * negative number
64806527 *
64816528 * @see #getMinParameterCount()
64826529 * @see #getParameterNames()
0 commit comments