1 /*
2 * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
116 * Returns the loaded reference types that
117 * match a given name. The name must be fully qualified
118 * (for example, java.lang.String). The returned list
119 * will contain a {@link ReferenceType} for each class
120 * or interface found with the given name. The search
121 * is confined to loaded classes only; no attempt is made
122 * to load a class of the given name.
123 * <P>
124 * The returned list will include reference types
125 * loaded at least to the point of preparation and
126 * types (like array) for which preparation is
127 * not defined.
128 *
129 * @param className the class/interface name to search for
130 * @return a list of {@link ReferenceType} objects, each
131 * mirroring a type in the target VM with the given name.
132 */
133 List<ReferenceType> classesByName(String className);
134
135 /**
136 * Returns all loaded types. For each loaded type in the target
137 * VM a {@link ReferenceType} will be placed in the returned list.
138 * The list will include ReferenceTypes which mirror classes,
139 * interfaces, and array types.
140 * <P>
141 * The returned list will include reference types
142 * loaded at least to the point of preparation and
143 * types (like array) for which preparation is
144 * not defined.
145 *
146 * @return a list of {@link ReferenceType} objects, each mirroring
147 * a loaded type in the target VM.
148 */
149 List<ReferenceType> allClasses();
150
151 /**
152 * All classes given are redefined according to the
153 * definitions supplied. A method in a redefined class
154 * is called 'equivalent' (to the old version of the
155 * method) if
156 * <UL>
157 * <LI>their bytecodes are the same except for indicies into
158 * the constant pool, and
159 * <LI>the referenced constants are equal.
160 * </UL>
161 * Otherwise, the new method is called 'non-equivalent'.
162 * If a redefined method has active stack frames, those active
163 * frames continue to run the bytecodes of the previous version of the
164 * method. If the new version of such a method is non-equivalent,
165 * then a method from one of these active frames is called 'obsolete' and
166 * {@link Method#isObsolete Method.isObsolete()}
167 * will return true when called on one of these methods.
|
1 /*
2 * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
116 * Returns the loaded reference types that
117 * match a given name. The name must be fully qualified
118 * (for example, java.lang.String). The returned list
119 * will contain a {@link ReferenceType} for each class
120 * or interface found with the given name. The search
121 * is confined to loaded classes only; no attempt is made
122 * to load a class of the given name.
123 * <P>
124 * The returned list will include reference types
125 * loaded at least to the point of preparation and
126 * types (like array) for which preparation is
127 * not defined.
128 *
129 * @param className the class/interface name to search for
130 * @return a list of {@link ReferenceType} objects, each
131 * mirroring a type in the target VM with the given name.
132 */
133 List<ReferenceType> classesByName(String className);
134
135 /**
136 * Returns all {@linkplain ReferenceType loaded types} in the target VM.
137 * <p>
138 * A class or interface creation can be triggered by one of the following:
139 * <ul>
140 * <li>by loading and deriving a class from a `class` file representation
141 * using class loader (see JVMS {@jvms 5.3}).
142 * <li>by invoking {@link java.lang.invoke.MethodHandles.Lookup#defineHiddenClass(byte[], boolean, java.lang.invoke.MethodHandles.Lookup.ClassOption...)
143 * Lookup::defineHiddenClass} that creates a {@link Class#isHidden
144 * hidden class or interface} from a {@code class} file representation.
145 * <li>by invoking methods in certain reflection APIs such as
146 * {@link Class#forName(String) Class::forName}.
147 * </ul>
148 * <p>
149 * An array class is created directly by Java virtual machine. An array
150 * class creation can be triggered by using class loaders or by invoking
151 * methods in certain reflection APIs such as
152 * {@link java.lang.reflect.Array#newInstance(Class, int) Array::newInstance}
153 * and {@link Class#arrayType() Class::arrayType}.
154 * <p>
155 * The returned list includes all reference types, including
156 * {@link Class#isHidden hidden classes or interfaces}, loaded
157 * at least to the point of preparation and types (like array)
158 * for which preparation is not defined.
159 *
160 * @return a list of {@link ReferenceType} objects, each mirroring
161 * a loaded type in the target VM.
162 * @jvms 5.3 Creation and Loading
163 */
164 List<ReferenceType> allClasses();
165
166 /**
167 * All classes given are redefined according to the
168 * definitions supplied. A method in a redefined class
169 * is called 'equivalent' (to the old version of the
170 * method) if
171 * <UL>
172 * <LI>their bytecodes are the same except for indicies into
173 * the constant pool, and
174 * <LI>the referenced constants are equal.
175 * </UL>
176 * Otherwise, the new method is called 'non-equivalent'.
177 * If a redefined method has active stack frames, those active
178 * frames continue to run the bytecodes of the previous version of the
179 * method. If the new version of such a method is non-equivalent,
180 * then a method from one of these active frames is called 'obsolete' and
181 * {@link Method#isObsolete Method.isObsolete()}
182 * will return true when called on one of these methods.
|