Debugging type level bugs
Aug. 29th, 2020 12:04 pmI don't know, do people really use debuggers for real code?
https://github.com/oracle/helidon/blob/355f646492e6529734a5b1a2aa50422bf8c75a5a/common/reactive/src/main/java/io/helidon/common/reactive/MultiFlatMapPublisher.java#L198-L235 - the bug here, to my mind, is best described as a type-level bug.
Not a variable of the wrong type, more like part of the computation has the wrong type.
I am not sure how a debugger can help, even if one can find a way to coax the code go through the problematic code path. (But first one would need to realize it is problematic, right?..)
The only assurance you can have, is a formal proof. The next best thing is code review.
https://github.com/oracle/helidon/blob/355f646492e6529734a5b1a2aa50422bf8c75a5a/common/reactive/src/main/java/io/helidon/common/reactive/MultiFlatMapPublisher.java#L198-L235 - the bug here, to my mind, is best described as a type-level bug.
Not a variable of the wrong type, more like part of the computation has the wrong type.
I am not sure how a debugger can help, even if one can find a way to coax the code go through the problematic code path. (But first one would need to realize it is problematic, right?..)
The only assurance you can have, is a formal proof. The next best thing is code review.