2 ms·
See my reply to the GP. Default virtual is the only thing that makes sense given how the JVM works.
by NavinF 4y ago
See my reply to the GP. Default virtual is the only thing that makes sense given how the JVM works.
- ncmncm 4y agoYou understand the JVM was designed at the same time as the language? It could work any way they liked. And does.
- NavinF 4y agoSure, but if you have the same preferences (throughout over latency), you’ll find that there are no performance benefits to be gained from non-virtual functions in any JITed language. The “final” keyword is just there for documentation.
- ncmncm 4y agoVirtual or not isn't about performance, it is about system architecture. Virtual is structurally about implementation. Exactly to the degree that the public interface matches the inheritance interface, the abstraction is a failure. At least, if you are being object-oriented, which Java tries to force on you. Of course, you are free to violate that expectation, and sometimes must since Java offers no other means of organization; so if you do, more power to you.
- deleted 4y ago[deleted]