8263358: Update java.lang to use instanceof pattern variable

Reviewed-by: iris, chegar, mchung, dfuchs
This commit is contained in:
Patrick Concannon 2021-03-24 09:57:22 +00:00
parent ae9af57bf6
commit 329697b02e
18 changed files with 63 additions and 112 deletions

View file

@ -2262,10 +2262,9 @@ public class MethodHandles {
// workaround to read `this_class` using readConst and validate the value
int thisClass = reader.readUnsignedShort(reader.header + 2);
Object constant = reader.readConst(thisClass, new char[reader.getMaxStringLength()]);
if (!(constant instanceof Type)) {
if (!(constant instanceof Type type)) {
throw new ClassFormatError("this_class item: #" + thisClass + " not a CONSTANT_Class_info");
}
Type type = ((Type) constant);
if (!type.getDescriptor().startsWith("L")) {
throw new ClassFormatError("this_class item: #" + thisClass + " not a CONSTANT_Class_info");
}