On Fri, 27 Feb 2026 14:47:41 GMT, Volkan Yazici <[email protected]> wrote:

>> This is to make tests fail if the assertion is fired. Typically an exception 
>> while decoding/parsing would just cause the packet to be skipped. An 
>> assertion here indicates that invariants have been violated (a problem in 
>> our own code which should never happen), not that bad/unexpected bytes were 
>> received. If that happens (assert fired), we want to know about it. 
>> Assertions are typically enabled in testing (they are when running JDK 
>> tests) but not in production.
>
> I see. I'm assuming this is the most economic — in terms of, not just LoC, 
> but also complexity — way to inform tests about this unexpected condition.

yes - otherwise you would have to read the logs in order to notice the stack 
trace there, because simply dropping the packet will typically not make the 
test to fail (it did not in our case, hence the reason it went unnoticed).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/29956#discussion_r2865029762

Reply via email to