Aivar
Aivar

Reputation: 7042

How does Java compiler handle statically resolvable calls to non-static methods?

Do java compilers (javac or eclipse) try to compile method calls as static when the target method is known statically (even if it's not a static method). Eg.

class A { 
    void foo() { doStuff(); }
}
...
A a = new A();
a.foo(); // is this compiled as virtual call or static call?

Upvotes: 0

Views: 229

Answers (1)

gpeche
gpeche

Reputation: 22514

See my response at How to find out what optimizations the JVM applied to my code?

Upvotes: 1

Related Questions