RFR: 8347491: IllegalArgumentationException thrown by ThreadPoolExecutor doesn't have a useful message [v2]
Chen Liang
liach at openjdk.org
Thu Feb 27 21:03:01 UTC 2025
On Wed, 26 Feb 2025 13:40:31 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> He-Pin(kerr) has updated the pull request incrementally with one additional commit since the last revision:
>>
>> chore: update tests
>
> src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java line 1513:
>
>> 1511: } else if (corePoolSize > maximumPoolSize) {
>> 1512: throw new IllegalArgumentException("corePoolSize must be less than or equal to maximumPoolSize, " +
>> 1513: "but got maximumPoolSize:" + maximumPoolSize + " corePoolSize :" + corePoolSize);
>
> Suggestion:
>
> "but got maximumPoolSize: " + maximumPoolSize + ", and corePoolSize : " + corePoolSize);
I wish we can have a bulit-in IAE formatter for `Preconditions` and then we can call `Preconditions.checkIndex(corePoolSize, maximumPoolSize, Precondtions.IAE_FORMATTER);`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23050#discussion_r1974330598
More information about the core-libs-dev
mailing list