Method | Description |
---|---|
java.lang.ClassLoader.getPackage(String) |
REVISED If multiple class loaders delegate to each other and define classes
with the same package name, and one such loader relies on the lookup
behavior of
getPackage to return a Package from
a parent loader, then the properties exposed by the Package
may not be as expected in the rest of the program.
For example, the Package will only expose annotations from the
package-info.class file defined by the parent loader, even if
annotations exist in a package-info.class file defined by
a child loader. A more robust approach is to use the
ClassLoader.getDefinedPackage(java.lang.String) method which returns
a Package for the specified class loader. |
java.lang.Package.getPackage(String) |
REVISED If multiple class loaders delegate to each other and define classes
with the same package name, and one such loader relies on the lookup
behavior of
getPackage to return a Package from
a parent loader, then the properties exposed by the Package
may not be as expected in the rest of the program.
For example, the Package will only expose annotations from the
package-info.class file defined by the parent loader, even if
annotations exist in a package-info.class file defined by
a child loader. A more robust approach is to use the
ClassLoader.getDefinedPackage(java.lang.String) method which returns
a Package for the specified class loader. |
java.lang.reflect.Proxy.getProxyClass(ClassLoader, Class<?>...) |
REVISED Proxy classes generated in a named module are encapsulated
and not accessible to code outside its module.
Constructor.newInstance
will throw IllegalAccessException when it is called on
an inaccessible proxy class.
Use Proxy.newProxyInstance(ClassLoader, Class[], InvocationHandler)
to create a proxy instance instead. |
java.lang.reflect.AccessibleObject.isAccessible() |
REVISED This method is deprecated because its name hints that it checks
if the reflected object is accessible when it actually indicates
if the checks for Java language access control are suppressed.
This method may return
false on a reflected object that is
accessible to the caller. To test if this reflected object is accessible,
it should use AccessibleObject.canAccess(Object) . |
java.lang.ClassLoader.defineClass(byte[], int, int) |
Replaced by
defineClass(String, byte[], int, int) |
java.lang.Class.newInstance() |
This method propagates any exception thrown by the
nullary constructor, including a checked exception. Use of
this method effectively bypasses the compile-time exception
checking that would otherwise be performed by the compiler.
The
Constructor.newInstance method avoids this problem by wrapping
any exception thrown by the constructor in a (checked) InvocationTargetException .
The call
can be replaced by
The latter sequence of calls is inferred to be able to throw
the additional exception types InvocationTargetException and NoSuchMethodException . Both of these exception types are
subclasses of ReflectiveOperationException . |
Constructor | Description |
---|---|
javax.lang.model.util.AbstractElementVisitor6() |
Release 6 is obsolete; update to a visitor for a newer
release level.
|
Copyright © 1993, 2017, Oracle and/or its affiliates · All rights reserved · License