mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8263358: Update java.lang to use instanceof pattern variable
Reviewed-by: iris, chegar, mchung, dfuchs
This commit is contained in:
parent
ae9af57bf6
commit
329697b02e
18 changed files with 63 additions and 112 deletions
|
@ -147,12 +147,10 @@ final class MemberName implements Member, Cloneable {
|
|||
|
||||
// type is not a MethodType yet. Convert it thread-safely.
|
||||
synchronized (this) {
|
||||
if (type instanceof String) {
|
||||
String sig = (String) type;
|
||||
if (type instanceof String sig) {
|
||||
MethodType res = MethodType.fromDescriptor(sig, getClassLoader());
|
||||
type = res;
|
||||
} else if (type instanceof Object[]) {
|
||||
Object[] typeInfo = (Object[]) type;
|
||||
} else if (type instanceof Object[] typeInfo) {
|
||||
Class<?>[] ptypes = (Class<?>[]) typeInfo[1];
|
||||
Class<?> rtype = (Class<?>) typeInfo[0];
|
||||
MethodType res = MethodType.makeImpl(rtype, ptypes, true);
|
||||
|
@ -235,8 +233,7 @@ final class MemberName implements Member, Cloneable {
|
|||
|
||||
// type is not a Class yet. Convert it thread-safely.
|
||||
synchronized (this) {
|
||||
if (type instanceof String) {
|
||||
String sig = (String) type;
|
||||
if (type instanceof String sig) {
|
||||
MethodType mtype = MethodType.fromDescriptor("()"+sig, getClassLoader());
|
||||
Class<?> res = mtype.returnType();
|
||||
type = res;
|
||||
|
@ -938,8 +935,7 @@ final class MemberName implements Member, Cloneable {
|
|||
} else {
|
||||
Module m;
|
||||
Class<?> plc;
|
||||
if (from instanceof MethodHandles.Lookup) {
|
||||
MethodHandles.Lookup lookup = (MethodHandles.Lookup)from;
|
||||
if (from instanceof MethodHandles.Lookup lookup) {
|
||||
from = lookup.lookupClass();
|
||||
m = lookup.lookupClass().getModule();
|
||||
plc = lookup.previousLookupClass();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue