Skip to content

Commit

Permalink
Reorder float and long to match instruction order, fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
liach committed Aug 29, 2024
1 parent 6a26b78 commit 3ab2357
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/java.base/share/classes/java/lang/classfile/TypeKind.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
public enum TypeKind {
// Elements are grouped so frequently used switch ranges such as
// primitives (boolean - double) and computational (int - void) are together.
// This also follows the order of typed opcodes
// Begin primitive types
/**
* The primitive type {@code boolean}. Its {@linkplain ##computational-type
Expand Down Expand Up @@ -96,14 +97,14 @@ public enum TypeKind {
* The primitive type {@code int}.
*/
INT(1, 10),
/**
* The primitive type {@code float}.
*/
FLOAT(1, 6),
/**
* The primitive type {@code long}. It is of {@linkplain #slotSize() category} 2.
*/
LONG(2, 11),
/**
* The primitive type {@code float}.
*/
FLOAT(1, 6),
/**
* The primitive type {@code double}. It is of {@linkplain #slotSize() category} 2.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ public CodeBuilder new_(ClassEntry clazz) {
public CodeBuilder newarray(TypeKind typeKind) {
int atype = typeKind.newarrayCode(); // implicit null check
if (atype < 0)
throw new IllegalArgumentException("Illegal component type: " + typeKind.typeName());
throw new IllegalArgumentException("Illegal component type: ".concat(typeKind.upperBound().displayName()));
writeNewPrimitiveArray(atype);
return this;
}
Expand Down

0 comments on commit 3ab2357

Please sign in to comment.