RFR: 8027470: AnnotationSupport uses == rather than .equals to compare Class objects

Stephen Colebourne scolebourne at joda.org
Fri Nov 15 12:56:17 UTC 2013


On 15 November 2013 03:21, Joseph Darcy <joe.darcy at oracle.com> wrote:
> Catching up on email, the specification of java.lang.Class does not
> explicitly promise that its notion of equality must be identity for all
> time. Therefore, while not required for today's implementations, I would
> prefer that new code we write in the JDK use equals rather than == when
> comparing classes.

I've used == for Class for many years. I expect many other developers
have done the same. I think that changing Class so identity was not
respected would break a *lot* of code.

Stephen



More information about the core-libs-dev mailing list