[Top][All Lists]

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

Re: Method.equals() question

From: Mark Wielaard
Subject: Re: Method.equals() question
Date: 01 Mar 2003 16:40:18 +0100


On Fri, 2003-02-28 at 21:58, Archie Cobbs 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.

I used to think that this would be the optimal thing todo for a VM. But
in reality each Method object returned should actually be unique. The
reason is that Method, Field and Constructor are AccessibleObjects.
AccessibleObjects have an setAccessible() method that should only
operate on that instance of the Method/Field but not on other
Method/Field objects which might refer to the same reflected field,
method or constructor.

I have wanted to add some Mauve tests for this since it is an easy thing
to overlook. Have put that a bit higher on the TODO list now :)

As a consequence some of the reflect classes have to be carefully
examined to make sure that they do not make the assumption that equals
means same reference. (Note that in contrast each Class object should
have the property they are unique.)



reply via email to

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