----- Original Message -----
From: "Joseph Kesselman" <[EMAIL PROTECTED]>


> Note that final methods also cause problems if/when you need to introduce
> subclassing/polymorphism, and that SUN's own performance team generally
> recommends strongly *AGAINST* trying to use the final keyword as an
> optimization trick.

 Sun's Hotspots has a mechanism by which it essentially infers the final
keyword (often, e.g. if a certain class loaded, it can also "uninfer" it).
The main advantage of a final method is that it can be inlined, thus saving
the overhead of method invocation and late binding. I can't think of any
reason for which not to use final: for variables it promotes constant
propagation (typically at compile time and when the init expression has not
side effects), for methods it promotes inlining.

 This is just my opinion though, I can always contact the performance team
if we want to make sure. Do you have a reference Joe?

-- Santiago



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to