RFR: 8288140: Avoid redundant Hashtable.get call in Signal.handle [v2]

Andrey Turbanov aturbanov at openjdk.java.net
Wed Jun 15 10:37:58 UTC 2022


On Fri, 10 Jun 2022 19:30:05 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8288140: Avoid redundant Hashtable.get call in Signal.handle
>>   apply dmlloyd's suggestion
>
> src/java.base/share/classes/jdk/internal/misc/Signal.java line 181:
> 
>> 179:         } else {
>> 180:             oldHandler = handlers.remove(sig);
>> 181:         }
> 
> A ternary assignment might be an alternative here:
> 
>  Signal.Handler oldHandler = (newH == 2) ? handlers.put(sig, handler) : handlers.remove(sig);

Too much logic in the single line. I like `if` approach more.

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

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


More information about the core-libs-dev mailing list