I think your suspicion is correct that the anonymous inner Object is used 
rather than new Object so that it can be distinguished more easily in heap 
dumps or via other tools. I would be fine with using Integer(0) as the sentinel 
value. I've always used new String("something useful") rather than new Object 
for sentinel values.

Neil, do you have a strong reason or preference for using an anonymous inner 
Object?

Mike

On Mar 29 2011, at 13:57 , Jason Mehrens wrote:

> Is it necessary for 'NULL' in EnumMap to have hashCode of zero?  If so, would 
> using new Integer(0) be better than creating a subclass with regards to 
> footprint and classloading?
> A similar issue was brought up before: 
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-March/006154.html
>  
> Jason
>  
>  
> > The updated changeset passes all the jtreg regression tests. I have updated 
> > the webrev:
> > 
> > http://cr.openjdk.java.net/~mduigou/6312706/1/webrev/
> > 
> > I don't have any remaining concerns with this patch. My residual anxiety 
> > regarding possible performance slowdown is fading. :-)
> > 
> > If there are no objections I will commit this changeset on Wednesday March 
> > 30th, 2011.
> > 
> > Mike
> 

Reply via email to