mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8303910: jdk/classfile/CorpusTest.java failed 1 of 6754 tests
Reviewed-by: jpai
This commit is contained in:
parent
b6d70f2c49
commit
43eca1dcb1
1 changed files with 12 additions and 10 deletions
|
@ -50,8 +50,6 @@ public enum TypeKind {
|
|||
/** void */
|
||||
VoidType("void", "V", -1);
|
||||
|
||||
private static TypeKind[] newarraycodeToTypeTag;
|
||||
|
||||
private final String name;
|
||||
private final String descriptor;
|
||||
private final int newarraycode;
|
||||
|
@ -102,13 +100,17 @@ public enum TypeKind {
|
|||
* @param newarraycode the operand of the {@code newarray} instruction
|
||||
*/
|
||||
public static TypeKind fromNewArrayCode(int newarraycode) {
|
||||
if (newarraycodeToTypeTag == null) {
|
||||
newarraycodeToTypeTag = new TypeKind[12];
|
||||
for (TypeKind tag : TypeKind.values()) {
|
||||
if (tag.newarraycode > 0) newarraycodeToTypeTag[tag.newarraycode] = tag;
|
||||
}
|
||||
}
|
||||
return newarraycodeToTypeTag[newarraycode];
|
||||
return switch (newarraycode) {
|
||||
case 4 -> TypeKind.BooleanType;
|
||||
case 5 -> TypeKind.CharType;
|
||||
case 6 -> TypeKind.FloatType;
|
||||
case 7 -> TypeKind.DoubleType;
|
||||
case 8 -> TypeKind.ByteType;
|
||||
case 9 -> TypeKind.ShortType;
|
||||
case 10 -> TypeKind.IntType;
|
||||
case 11 -> TypeKind.LongType;
|
||||
default -> throw new IllegalArgumentException("Bad new array code: " + newarraycode);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,7 +129,7 @@ public enum TypeKind {
|
|||
case 'J' -> TypeKind.LongType;
|
||||
case 'D' -> TypeKind.DoubleType;
|
||||
case 'V' -> TypeKind.VoidType;
|
||||
default -> throw new IllegalStateException("Bad type: " + s);
|
||||
default -> throw new IllegalArgumentException("Bad type: " + s);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue