378 *
379 * @see #retransformClasses
380 * @see #isRetransformClassesSupported
381 * @see #redefineClasses
382 * @see #isRedefineClassesSupported
383 * @since 1.6
384 */
385 boolean
386 isModifiableClass(Class<?> theClass);
387
388 /**
389 * Returns an array of all classes currently loaded by the JVM.
390 *
391 * @return an array containing all the classes loaded by the JVM, zero-length if there are none
392 */
393 @SuppressWarnings("rawtypes")
394 Class[]
395 getAllLoadedClasses();
396
397 /**
398 * Returns an array of all classes for which <code>loader</code> is an initiating loader.
399 * If the supplied loader is <code>null</code>, classes initiated by the bootstrap class
400 * loader are returned.
401 *
402 * @param loader the loader whose initiated class list will be returned
403 * @return an array containing all the classes for which loader is an initiating loader,
404 * zero-length if there are none
405 */
406 @SuppressWarnings("rawtypes")
407 Class[]
408 getInitiatedClasses(ClassLoader loader);
409
410 /**
411 * Returns an implementation-specific approximation of the amount of storage consumed by
412 * the specified object. The result may include some or all of the object's overhead,
413 * and thus is useful for comparison within an implementation but not between implementations.
414 *
415 * The estimate may change during a single invocation of the JVM.
416 *
417 * @param objectToSize the object to size
418 * @return an implementation-specific approximation of the amount of storage consumed by the specified object
419 * @throws java.lang.NullPointerException if the supplied Object is <code>null</code>.
420 */
421 long
422 getObjectSize(Object objectToSize);
423
|
378 *
379 * @see #retransformClasses
380 * @see #isRetransformClassesSupported
381 * @see #redefineClasses
382 * @see #isRedefineClassesSupported
383 * @since 1.6
384 */
385 boolean
386 isModifiableClass(Class<?> theClass);
387
388 /**
389 * Returns an array of all classes currently loaded by the JVM.
390 *
391 * @return an array containing all the classes loaded by the JVM, zero-length if there are none
392 */
393 @SuppressWarnings("rawtypes")
394 Class[]
395 getAllLoadedClasses();
396
397 /**
398 * Returns an array of all classes which {@code loader} can find by name
399 * via {@link ClassLoader#loadClass(String, boolean) ClassLoader::loadClass},
400 * {@link Class#forName(String) Class::forName} and bytecode linkage.
401 * That is, {@code loader} has been recorded as an initiating loader
402 * of these classes. If the supplied {@code loader} is {@code null},
403 * classes that the bootstrap class loader can find by name are returned.
404 *
405 * <p>
406 * The returned array does not include {@link Class#isHidden()
407 * <em>hidden</em>} classes or interfaces that are created by the invocation of
408 * {@link java.lang.invoke.MethodHandles.Lookup#defineHiddenClass(byte[], boolean, java.lang.invoke.MethodHandles.Lookup.ClassOption...)
409 * Lookup::defineHiddenClass} because:
410 * <ul>
411 * <li>A hidden class or interface cannot be referenced by the constant pools
412 * of other classes and interfaces.
413 * <li>A hidden class or interface cannot be discovered by any class loader.
414 * </ul>
415 * In addition, the returned array does not include array classes whose
416 * {@linkplain Class#componentType() element type} is a
417 * {@link Class#isHidden() hidden class or interface} as they cannot
418 * be discovered by {@code loader}.
419 *
420 * @param loader the loader whose initiated class list will be returned
421 * @return an array containing all classes which {@code loader} can find by name;
422 * zero-length if there are none
423 */
424 @SuppressWarnings("rawtypes")
425 Class[]
426 getInitiatedClasses(ClassLoader loader);
427
428 /**
429 * Returns an implementation-specific approximation of the amount of storage consumed by
430 * the specified object. The result may include some or all of the object's overhead,
431 * and thus is useful for comparison within an implementation but not between implementations.
432 *
433 * The estimate may change during a single invocation of the JVM.
434 *
435 * @param objectToSize the object to size
436 * @return an implementation-specific approximation of the amount of storage consumed by the specified object
437 * @throws java.lang.NullPointerException if the supplied Object is <code>null</code>.
438 */
439 long
440 getObjectSize(Object objectToSize);
441
|