Commit 84faab4
Replace assertions with typed exceptions and remove -ea requirement (#43)
* Add Severity enum, EditorException, and require* utility functions
- Created Severity enum with FATAL, ERROR, WARN levels
- Created EditorException for editor operations and validation errors
- Updated SimulationException to support Severity levels
- Added require* utility functions to replace assert() boilerplate
- Functions include: requireSimulation, requireEditor, requireValidArgument, requireValidState
* Replace assertions in Train.kt and SimpleTrack.kt
- Replaced 15 assertions + 2 NPE throws in Train.kt with require* functions
- Replaced 7 assertions in SimpleTrack.kt with require* functions
- All original error messages and comments preserved
- Legacy null handling maintained
* Replace assertions in AbstractPath.kt and RailSwitch.kt
- Replaced 9 assertions in AbstractPath.kt with require* functions
- Replaced 3 assertions in RailSwitch.kt with require* functions
- All original error messages preserved
- Legacy null handling maintained
* Replace assertion in RailSemaphore.kt
- Replaced 1 assertion in RailSemaphore.kt with requireSimulation
- All original error messages preserved
* Replace assertions in cell classes and add comprehensive analysis
- Replaced 2 assertions in InOut.kt with requireSimulation
- Replaced 1 assertion in OrientedNodeCell.kt with requireSimulationNotNull
- Replaced 1 assertion in TrackBlockPart.kt with requireValidArgument
- Added EXCEPTION_HANDLING_ANALYSIS.md with comprehensive analysis
- All original error messages preserved
* Move exceptions to exceptions package and remove -ea requirement
- Moved SimulationException, PathSeparatorChangeException, TrackOperationException to exceptions package
- Updated all imports to reference new package location
- Fixed RequireFunctions.kt to use proper imports instead of qualified names
- Removed -ea flags from build.gradle.kts (all JavaExec tasks, test tasks)
- Removed -ea flag from GitHub Actions workflow
- Removed -ea requirements from README.md and CLAUDE.md
- Removed -ea from docker-compose.yml and Dockerfile
- Application no longer requires -ea flag to run
* Fix test import for TrackOperationException
- Updated RaceConditionTest.kt to import from exceptions package
* fix build and tests
* Remove EXCEPTION_HANDLING_ANALYSIS.md from repository
- Removed analysis document as requested in review
- Analysis information can be regenerated if needed from code inspection
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Bedřich Hovorka <bedrich.hovorka@gmail.com>1 parent 4114210 commit 84faab4
36 files changed
Lines changed: 531 additions & 267 deletions
File tree
- .github/workflows
- src
- main/kotlin/cz/vutbr/fit/interlockSim
- context
- exceptions
- objects
- cells
- paths
- tracks
- sim
- test/kotlin/cz/vutbr/fit/interlockSim
- context
- objects
- cells
- tracks
- sim
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | 169 | | |
171 | 170 | | |
172 | 171 | | |
| |||
217 | 216 | | |
218 | 217 | | |
219 | 218 | | |
220 | | - | |
| 219 | + | |
221 | 220 | | |
222 | 221 | | |
223 | 222 | | |
224 | 223 | | |
225 | | - | |
| 224 | + | |
226 | 225 | | |
227 | 226 | | |
228 | 227 | | |
| |||
837 | 836 | | |
838 | 837 | | |
839 | 838 | | |
840 | | - | |
| 839 | + | |
841 | 840 | | |
842 | 841 | | |
843 | 842 | | |
844 | 843 | | |
845 | | - | |
| 844 | + | |
846 | 845 | | |
847 | 846 | | |
848 | 847 | | |
| |||
1027 | 1026 | | |
1028 | 1027 | | |
1029 | 1028 | | |
1030 | | - | |
1031 | 1029 | | |
1032 | 1030 | | |
1033 | 1031 | | |
1034 | | - | |
1035 | 1032 | | |
1036 | 1033 | | |
1037 | 1034 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
| 304 | + | |
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
| 309 | + | |
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
| 390 | + | |
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | 122 | | |
128 | 123 | | |
129 | 124 | | |
| |||
180 | 175 | | |
181 | 176 | | |
182 | 177 | | |
183 | | - | |
184 | | - | |
185 | 178 | | |
186 | 179 | | |
187 | 180 | | |
| |||
235 | 228 | | |
236 | 229 | | |
237 | 230 | | |
238 | | - | |
239 | | - | |
240 | 231 | | |
241 | 232 | | |
242 | 233 | | |
| |||
417 | 408 | | |
418 | 409 | | |
419 | 410 | | |
420 | | - | |
421 | | - | |
422 | 411 | | |
423 | 412 | | |
424 | 413 | | |
| |||
434 | 423 | | |
435 | 424 | | |
436 | 425 | | |
437 | | - | |
438 | | - | |
439 | 426 | | |
440 | 427 | | |
441 | 428 | | |
| |||
455 | 442 | | |
456 | 443 | | |
457 | 444 | | |
458 | | - | |
459 | 445 | | |
460 | 446 | | |
461 | 447 | | |
| |||
470 | 456 | | |
471 | 457 | | |
472 | 458 | | |
473 | | - | |
474 | | - | |
475 | 459 | | |
476 | 460 | | |
477 | 461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
Lines changed: 81 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
0 commit comments