logo separator

[mkgmap-dev] Merge from the multipolygon branch.

From Chris Miller chris.miller at kbcfp.com on Tue Sep 15 00:17:22 BST 2009

As far as I'm aware, declaring a method final doesn't make a whole lot of 
difference to hotspot these days. Hotspot can still inline a method if it's 
not declared final but determines at runtime it's not overriden elsewhere. 
If some new code eventually turns up that does override the method, hotspot 
will 'uninline' the method dynamically.

http://www.java2s.com/Article/Java/JVM/The_Java_HotSpot_Performance_Engine_Method_Inlining_Example.htm

The only real reason that I'm aware of for declaring a method final is to 
deliberately prevent it from being overridden as a design decision.

Chris


>>> Why zap the final? It was there for a reason.
>>> 
>> And what would that reason be?
>> 
MB> It explicitly declares that the method can never be redefined and
MB> therefore is a candidate for inline expansion.
MB> 
MB> Obviously, the method is implicitly final anyway due to it being
MB> private but adding the final means that if the method is ever made
MB> non-private it will still be capable of being optimised.
MB> 
MB> That's my reason, what's yours?
MB> 
MB> Cheers,
MB> 
MB> Mark






More information about the mkgmap-dev mailing list