RFR: 8298128: runtime/ErrorHandling/TestSigInfoInHsErrFile.java fails to find pattern with slowdebug [v2]

Afshin Zafari duke at openjdk.org
Sun Dec 18 18:01:49 UTC 2022


On Sat, 17 Dec 2022 22:15:00 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8298128: runtime/ErrorHandling/TestSigInfoInHsErrFile.java fails to find pattern with slowdebug
>
> test/hotspot/jtreg/runtime/ErrorHandling/HsErrFileUtils.java line 138:
> 
>> 136:                     throw new RuntimeException("hs-err file incomplete (first missing pattern: " + currentPositivePattern.pattern() + ")");
>> 137:                 } else {
>> 138:                     // Impossible to reach here, where stack is not empty and currentPositivePattern which was peeked from stack is null.
> 
> If this is impossible to reach then why put in the null check? If the impossible were to happen you would get a NPE.

`currentPositivePattern` is null checked before any usage. Therefore, the other parts of the code are guarded against NPE.
For using `currentPositivePattern`, I should also check it against `null`. Then, the `else { ...} ` part became unreachable. I just put this part for future contributors. Maybe the comments only are enough for that.
What is better: remove else part? or improve the comments? or both?

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

PR: https://git.openjdk.org/jdk/pull/11704


More information about the hotspot-dev mailing list