mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8310849: Pattern matching for instanceof and arrayType cleanup in j.l.invoke and j.l.reflect
Reviewed-by: mchung, darcy
This commit is contained in:
parent
7ce967a10c
commit
2bd4136bdb
34 changed files with 211 additions and 292 deletions
|
@ -1589,10 +1589,8 @@ public final class Class<T> implements java.io.Serializable,
|
|||
}
|
||||
|
||||
private static Class<?> toClass(Type o) {
|
||||
if (o instanceof GenericArrayType)
|
||||
return Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()),
|
||||
0)
|
||||
.getClass();
|
||||
if (o instanceof GenericArrayType gat)
|
||||
return toClass(gat.getGenericComponentType()).arrayType();
|
||||
return (Class<?>)o;
|
||||
}
|
||||
|
||||
|
@ -3013,8 +3011,8 @@ public final class Class<T> implements java.io.Serializable,
|
|||
// need for a URL connection
|
||||
if (cl == null) {
|
||||
return BootLoader.findResourceAsStream(mn, name);
|
||||
} else if (cl instanceof BuiltinClassLoader) {
|
||||
return ((BuiltinClassLoader) cl).findResourceAsStream(mn, name);
|
||||
} else if (cl instanceof BuiltinClassLoader bcl) {
|
||||
return bcl.findResourceAsStream(mn, name);
|
||||
} else {
|
||||
URL url = cl.findResource(mn, name);
|
||||
return (url != null) ? url.openStream() : null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue