On Mon, 13 Mar 2023 18:54:11 GMT, Adam Sotona <asot...@openjdk.org> wrote:

> jdk/classfile/CorpusTest.java rarely fails in 1 of 6754 parametrised parallel 
> junit tests
> 
> The root cause seems to be thread-unsafe lazy initialisation of 
> `TypeKind.newarraycodeToTypeTag` in `TypeKind::fromNewArrayCode`. Provided 
> patch replaces that lazy-initialized helper array with switch expression.
> 
> Please review.
> 
> Thanks,
> Adam

src/java.base/share/classes/jdk/internal/classfile/TypeKind.java line 112:

> 110:             case 10 -> TypeKind.IntType;
> 111:             case 11 -> TypeKind.LongType;
> 112:             default -> throw new IllegalStateException("Bad new array 
> code: " + newarraycode);

Should throw `IllegalArgumentException` to be more informative

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

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

Reply via email to