Java Reference
In-Depth Information
interface order matters because two interfaces in the list can potentially
have methods with the same name and signature. If this happens, the
Method
object passed to
invoke
will have a declaring class of the first in-
terface listed that declares that method (defined by a depth-first search
of interfaces and superinterfaces).
The declaring class for the public non-final methods of
Objectequals
,
hashCode
, and
toString
is always
Object.class
. The other methods of
Object
are not "proxied"; their methods are handled directly by the proxy ob-
ject itself, not via a call to
invoke
. Most importantly, this means that a
lock on a proxy object is just thata lock on the proxy. Whatever object
or objects the proxy uses to do its work (for example, in our case the
underlying object whose methods are being traced) is not involved in
the lock, including any uses of
wait
,
notifyAll
, or
notify
.
You can ask if a
Class
object represents a dynamically generated proxy
class using the static
Proxy.isProxyClass
method.