They can readily inline them in the same class (so all private methods qualify). Otherwise, you don't really know what the code will be until the class is loaded. A sufficiently-clever classloader can do amazing things, but usually this sort of trick is done later, Just-In-Time compilers that compile down to bytecode.
I don't know much about DalvikVM, specifically. Supposedly, per Wikipedia, there's a JIT compiler in the source, not currently enabled. I think it's reasonably safe to assume that for the moment, anyway, there's probably no inlining except within a class. It's unclear what the performance characteristics would be, anyway. Still, it's advisable to make methods private when they're not needed by other classes (including subclasses), and final when they are needed by others but won't be subclassed. ('final' is redundant for 'private"). This has the dual benefit of a creating a simpler interface (you know the code you need to look at is here, not in some subclass, and you know it's only used here, not in some other class), and also allowing the compiler the possibility of optimizing. On Jan 29, 3:49 pm, Kevin Duffey <andjar...@gmail.com> wrote: > I am a bit rusty on the use of final methods.. I do know they cant be > extended.. but I also thought that modern JVMs "inline" final methods or > something..to help speed them up? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en