Skip to content

Commit ba0c03c

Browse files
authored
Merge pull request #1182 from fesch/bugfix
Version 3.32-24 candidate
2 parents f9369ef + f47d33d commit ba0c03c

62 files changed

Lines changed: 1096 additions & 670 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Structorizer.1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ file.
7070
Write generated program code directly to StdOut instead of eporting it to the default
7171
output file (if \fB-o\fP is also used then the code will be written both to standard
7272
output and to the specified output file). (For export mode.)
73+
.TP
7374
.BI \-\-export " generator"
7475
Same as \-x " generator"
7576
This option must be the first argument.
@@ -157,7 +158,7 @@ Accepted names (case-insensitive) of parsers are:
157158
.br
158159
.B COBOLParser
159160
.br
160-
.B Java-SE8
161+
.B "Java-SE8"
161162
.br
162163
.B JavaParser
163164
.br

buildapp.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
name="Structorizer"
1616
displayname="Structorizer"
1717
identifier="lu.fisch.Structorizer"
18-
shortversion="3.32-23"
19-
version="3.32-23"
18+
shortversion="3.32-24"
19+
version="3.32-24"
2020
icon="icons/Structorizer.icns"
2121
mainclassname="Structorizer"
2222
copyright="Bob Fisch"

src/lu/fisch/structorizer/archivar/IRoutinePool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ public default Set<Root> findIncludingRoots(String includableName, boolean recur
178178
/**
179179
* Retrieves a set of all {@link Root} objects parked in this diagram pool.
180180
* @return the {@link Root} set
181+
*
181182
* @see #findDiagramsByName(String)
182183
* @see #findIncludingRoots(String, boolean)
183184
*/

src/lu/fisch/structorizer/arranger/Arranger.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,10 @@ public void clearExecutionStatus() {
18771877
surface.clearExecutionStatus();
18781878
}
18791879

1880+
/**
1881+
* Updates the visibility or accessibility of the buttons held in the button bar,
1882+
* menus etc. depending on the current state.
1883+
*/
18801884
public void doButtons() {
18811885
btnSetCovered.setEnabled(Element.E_COLLECTRUNTIMEDATA);
18821886
// START KGU#624/KGU#626 2018-12-27: Enh. #655, #657
@@ -1924,6 +1928,7 @@ public static void addToChangeListeners(IRoutinePoolListener _listener)
19241928
/**
19251929
* Statically removes the given {@code _listener} from the set of {@link IRoutinePoolListener}s
19261930
* @param _listener - the listener to be unregistered.
1931+
*
19271932
* @see #removeChangeListener(IRoutinePoolListener)
19281933
* @see #addToChangeListeners(IRoutinePoolListener)
19291934
*/

src/lu/fisch/structorizer/arranger/ArrangerIndex.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
* Kay Gürtzig 2021-01-11 Enh. #910: Menu items disabled if only DiagramController proxies are selected
4949
* Kay Gürtzig 2021-02-23 Issue #901: WAIT_CURSOR now also set on group saving
5050
* Kay Gürtzig 2022-08-17 Issue #1065: Right-click now overrides a previous single selection
51+
* Kay Gürtzig 2024-11-25 Issue #1180: Test coverage display inconsistency fixed
5152
*
5253
******************************************************************************************************
5354
*
@@ -300,7 +301,10 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean
300301
boolean withQualifiers = !showQualifiers.containsKey(tree) || showQualifiers.get(tree);
301302
String s = root.getSignatureString(true, withQualifiers);
302303
// END KGU#408 2021-02-26
303-
boolean covered = Element.E_COLLECTRUNTIMEDATA && root.deeplyCovered;
304+
// START KGU#1036 2024-11-25: Bugfix #1180 We must accept both kinds of markings
305+
//boolean covered = Element.E_COLLECTRUNTIMEDATA && root.deeplyCovered;
306+
boolean covered = Element.E_COLLECTRUNTIMEDATA && root.isTestCovered(true);
307+
// END KGU#1036 2024-11-25
304308
setText(s);
305309
// Enh. #319, #389: show coverage status of (imported) main diagrams
306310
if (root.isProgram()) {

src/lu/fisch/structorizer/arranger/Surface.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
* Kay Gürtzig 2024-03-16 Issue #1138: Provide a better and more usable diagram collision information
137137
* Kay Gürtzig 2024-10-10 Issue #1176: More sensible addition to recent file list after loading an arrz file
138138
* from Arranger button
139+
* Kay Gürtzig 2024-11-25 Issue #1180: deep test coverage consistency defects mended.
139140
*
140141
******************************************************************************************************
141142
*
@@ -2920,7 +2921,7 @@ private void removeDiagram(Diagram diagr)
29202921
notifyChangeListeners(IRoutinePoolListener.RPC_POOL_CHANGED | IRoutinePoolListener.RPC_SELECTION_CHANGED);
29212922
Vector<Mainform> mainforms = activeMainforms();
29222923
if (form != null) {
2923-
if (!mainforms.contains(form) && !form.isStandalone() && (!ask || form.diagram.saveNSD(true))) {
2924+
if (!mainforms.contains(form) && !form.isApplicationMain() && (!ask || form.diagram.saveNSD(true))) {
29242925
// Form doesn't seem necessary any longer
29252926
form.dispose();
29262927
removeChangeListener(form);
@@ -3028,8 +3029,12 @@ public void togglePinned()
30283029
/**
30293030
* Toggles the "covered" status of the subroutine or includable diagrams among the
30303031
* selected diagrams.<br/>
3031-
* If the "covered" flag the selected diagrams differs then all diagrams will be set
3032-
* "covered". Before unsetting the "covered" flag a confirmation dialog will pop up.
3032+
* If the "deeplyCovered" flag of the selected diagrams differs then all diagrams
3033+
* will be set "covered". Before unsetting the "covered" flag a confirmation dialog
3034+
* will pop up.<br/>
3035+
* The coverage changes will be considered across all Roots that contain calls to the
3036+
* affected subroutines.
3037+
*
30333038
* @param frame - the owner for the dialog box.
30343039
*/
30353040
public void setCovered(Frame frame)
@@ -3053,7 +3058,10 @@ public void setCovered(Frame frame)
30533058
boolean someUncovered = false;
30543059
for (Diagram diagr: this.diagramsSelected) {
30553060
if (diagr.root != null && !diagr.root.isProgram()) {
3056-
if (!diagr.root.deeplyCovered) {
3061+
// START KGU#1036 2024-11-25: Bugfix #1180 Inconsistency mended
3062+
//if (!diagr.root.deeplyCovered) {
3063+
if (!diagr.root.isTestCovered(true)) {
3064+
// END KGU#1036 2024-11-25
30573065
someUncovered = true;
30583066
break;
30593067
}
@@ -3063,7 +3071,11 @@ public void setCovered(Frame frame)
30633071
{
30643072
for (Diagram diagr: this.diagramsSelected) {
30653073
if (diagr.root != null && !diagr.root.isProgram()) {
3074+
// Note that this cannot suppress a coverage acquired by execution (children.deeplyCovered)
30663075
diagr.root.deeplyCovered = someUncovered;
3076+
// START KGU#1036 2024-11-25: Bugfix #1180 We must propagate the status change to make sense
3077+
diagr.root.propagateTestCoverage();
3078+
// END KGU#1036 2024-11-25
30673079
}
30683080
}
30693081
// FIXME This is of no good anymore with a multiple selection because selection cannot easily be restored
@@ -3336,7 +3348,7 @@ else if (diagram.root.hasChanged())
33363348
// chance to save their currently maintained Root even if this was not arranged here.
33373349
if (goingToClose) {
33383350
for (Mainform form: mainforms) {
3339-
if (!form.isStandalone() && !handledRoots.contains(form.getRoot())) {
3351+
if (!form.isApplicationMain() && !handledRoots.contains(form.getRoot())) {
33403352
form.diagram.saveNSD(!(goingToClose && Element.E_AUTO_SAVE_ON_CLOSE));
33413353
}
33423354
}
@@ -4558,7 +4570,7 @@ public Set<Root> getAllRoots()
45584570
Diagram diagram = this.diagrams.get(d);
45594571
roots.add(diagram.root);
45604572
}
4561-
}
4573+
}
45624574
return roots;
45634575
}
45644576
// END KGU#258 2016-09-26

src/lu/fisch/structorizer/elements/Call.java

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,55 @@ public String getSignatureString()
367367
}
368368
// END #178 2016-07-19
369369

370+
// // START KGU#1036 2024-11-22: Workaround for bug #1180 (alternative approach, withdrawn 2024-11-24)
371+
// /**
372+
// * Detects shallow or deep test coverage of this element according to the
373+
// * argument _deeply
374+
// * @param _deeply if exhaustive coverage (including subroutines is requested)
375+
// * @return true iff element and all its sub-structure is test-covered
376+
// */
377+
// @Override
378+
// public boolean isTestCovered(boolean _deeply)
379+
// {
380+
// if (_deeply && this.simplyCovered && !this.deeplyCovered && Arranger.hasInstance()) {
381+
// // We have to check if called routine(s) may have turned completely covered meanwhile
382+
// StringList sl = this.getUnbrokenText();
383+
// if (sl.count() > 1) {
384+
// Root myRoot = getRoot(this);
385+
// for (int i = 0; i < sl.count(); i++) {
386+
// Function called = getCalledRoutine(i);
387+
// if (called != null) {
388+
// // The retrieval is restricted to the Arranger pool, which may not be consistent with Executor
389+
// Vector<Root> candidates = Arranger.getInstance()
390+
// .findRoutinesBySignature(called.getName(), called.paramCount(), myRoot, true);
391+
// // If unique then update the deeplyCovered attribute accordingly
392+
// if (candidates.size() != 1 || !candidates.get(0).isTestCovered(true)) {
393+
// return false; // No further check needed
394+
// }
395+
// }
396+
// }
397+
// this.deeplyCovered = true;
398+
// if (this.parent != null) {
399+
// this.parent.checkTestCoverage(true);
400+
// }
401+
// }
402+
// }
403+
// // The following ought to be identical with super
404+
// return _deeply ? this.deeplyCovered : this.simplyCovered;
405+
// }
406+
// // END KGU#1036 2024-11-22
407+
370408
// START KGU#408 2021-02-26: Enh. #410 Differing behaviour in case of a method reference
371409
/**
372410
* Returns a {@link Function} object describing the signature of
373411
* <ul>
374412
* <li> the referred method declaration (in case this obect represents a method reference),</li>
375413
* <li> the called routine if the text complies to the call syntax described in the user guide,</li>
376-
* <li> {@code null} otherwise.</li>
414+
* <li> {@code null} otherwise. (Note that this may be the case if the element consists of more than
415+
* one line!)</li>
377416
* </ul>
378417
* @return Function object or {@code null}.
418+
*
379419
* @see #isFunctionCall(boolean)
380420
* @see #isProcedureCall(boolean)
381421
*/

src/lu/fisch/structorizer/elements/Element.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public String toString()
312312
public static final long E_HELP_FILE_SIZE = 12300000;
313313
public static final String E_DOWNLOAD_PAGE = "https://www.fisch.lu/Php/download.php";
314314
// END KGU#791 2020-01-20
315-
public static final String E_VERSION = "3.32-23";
315+
public static final String E_VERSION = "3.32-24";
316316
public static final String E_THANKS =
317317
"Developed and maintained by\n"+
318318
" - Robert Fisch <robert.fisch@education.lu>\n"+
@@ -1817,9 +1817,9 @@ public void addToExecTotalCount(int _growth, boolean _directly)
18171817
/**
18181818
* In test coverage mode, sets the local tested flag if element is fully covered
18191819
* and then recursively checks test coverage upwards all ancestry if
1820-
* _propagateUpwards is true (otherwise it would be postponed to the termination
1821-
* of the superstructure).
1822-
* @param _propagateUpwards if true then the change is immediately propagated
1820+
* {@code _propagateUpwards} is {@code true} (otherwise it would be postponed to
1821+
* the termination of the superstructure).
1822+
* @param _propagateUpwards if {@code true} then the change is immediately propagated
18231823
*/
18241824
public void checkTestCoverage(boolean _propagateUpwards)
18251825
{

src/lu/fisch/structorizer/elements/Root.java

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
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
*
@@ -266,6 +267,7 @@
266267
import lu.fisch.structorizer.locales.Locales;
267268
import lu.fisch.structorizer.archivar.IRoutinePool;
268269
import lu.fisch.structorizer.arranger.Arranger;
270+
import lu.fisch.structorizer.executor.Executor;
269271
import lu.fisch.structorizer.executor.Function;
270272
import lu.fisch.structorizer.generators.GeneratorSyntaxChecker;
271273
import 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

Comments
 (0)