[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Method.equals() question

From: Archie Cobbs
Subject: Re: Method.equals() question
Date: Fri, 28 Feb 2003 15:25:25 -0800
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.1) Gecko/20021106

Per Bothner wrote:
I'm assuming here that the VM guarantees that only one Method object
will ever be created for each declared method in a class.

Why are you assuming this?  It is possible the VM internal
data structures are unrelated to java.lang.reflect.Method,
and so it may make sense to create a new one each time it
is requested than try to cache it.

You're right, you could certainly do things that way instead and
in that case my idea of using "this == o" for equals() wouldn't work.

In that case the VM implementor better take a look at Field.equals()
and Constructor.equals() too because that's what they do as well.
So perhaps all three should be annotated with appropriate comments.


Archie Cobbs     *     Precision I/O      *

reply via email to

[Prev in Thread] Current Thread [Next in Thread]