mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8177107: Reduce memory footprint of java.lang.reflect.Constructor/Method
Reviewed-by: darcy, shade, coleenp
This commit is contained in:
parent
ec205f68a8
commit
a385142398
4 changed files with 22 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -42,6 +42,8 @@ import sun.reflect.generics.visitor.Reifier;
|
|||
public abstract class GenericDeclRepository<S extends Signature>
|
||||
extends AbstractRepository<S> {
|
||||
|
||||
public static final TypeVariable<?>[] EMPTY_TYPE_VARS = new TypeVariable<?>[0];
|
||||
|
||||
/** The formal type parameters. Lazily initialized. */
|
||||
private volatile TypeVariable<?>[] typeParameters;
|
||||
|
||||
|
@ -77,6 +79,9 @@ public abstract class GenericDeclRepository<S extends Signature>
|
|||
FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
|
||||
// create array to store reified subtree(s)
|
||||
int length = ftps.length;
|
||||
if (length == 0) {
|
||||
return EMPTY_TYPE_VARS;
|
||||
}
|
||||
TypeVariable<?>[] typeParameters = new TypeVariable<?>[length];
|
||||
// reify all subtrees
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue