RFR 8071627: Code refactoring to override == operator of Symbol*

John Rose john.r.rose at oracle.com
Wed Apr 8 23:11:35 UTC 2015


P.S. I posted a sketch of a design pattern which can help us tame uses of T*::operator== using a wrapper template.

This does not require a mass rewrite, just introduction of a cast-like operator near every use of T*::operator== that we don't like.

http://cr.openjdk.java.net/~jrose/draft/saferef.cpp

It's probably too clever, though:  Like the proposed mega-change, it would disguise the meaning of the affected operator== occurrences.

It may be better to just rewrite the operator== occurrences as Symbol::identity_equals, and document that engineers should avoid direct uses of Symbol*::operator==.

(Yes, I know that Symbol* has risky aspects in its pointer-ness.  But trying to code in C++ without dealing with the oddities of pointer types is IMO futile.  You end up with an embedded DSL which nobody wants to understand.)



More information about the hotspot-runtime-dev mailing list