On Tue, 2 Apr 2024 09:37:52 GMT, Adam Sotona <asot...@openjdk.org> wrote:
> `IllegalArgumentException` thrown by some static factory methods of the > following `java.lang.classfile.instruction` interfaces are not documented: > > - `ArrayLoadInstruction` > - `ArrayStoreInstruction` > - `BranchInstruction` > - `ConvertInstruction` > - `DiscontinuedInstruction` > - `FieldInstruction` > - `InvokeInstruction` > - `LoadInstruction` > - `MonitorInstruction` > - `NewPrimitiveArrayInstruction` > - `OperatorInstruction` > - `ReturnInstruction` > - `StackInstruction` > - `StoreInstruction` > - `TypeCheckInstruction` > > `NewPrimitiveArrayInstruction::of` factory method also does not perform the > check for invalid argument. > > This patch adds all the missing `@throws` Javadoc tags and fixes > `NewPrimitiveArrayInstruction::of` factory method to perform the argument > check. > > Please review. > > Thank you, > Adam src/java.base/share/classes/java/lang/classfile/instruction/NewPrimitiveArrayInstruction.java line 31: > 29: import java.lang.classfile.Instruction; > 30: import java.lang.classfile.TypeKind; > 31: import static java.util.Objects.requireNonNull; Suggestion: src/java.base/share/classes/java/lang/classfile/instruction/NewPrimitiveArrayInstruction.java line 59: > 57: */ > 58: static NewPrimitiveArrayInstruction of(TypeKind typeKind) { > 59: if (requireNonNull(typeKind).newarraycode() < 0) { Suggestion: // Implicit null-check: if (typeKind.newarraycode() < 0) { ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18578#discussion_r1549343564 PR Review Comment: https://git.openjdk.org/jdk/pull/18578#discussion_r1549341918