Would Java inline method(s) during optimization?

后端 未结 6 2008
青春惊慌失措
青春惊慌失措 2020-11-29 05:46

I wonder if JVM/javac is smart enough to turn

// This line...
string a = foo();

string foo()
{
  return bar();
}

string bar()
{
  return some-complicated-s         


        
6条回答
  •  渐次进展
    2020-11-29 06:20

    If you thrown an exception in bar() and print the stacktrace you'll see the whole path of calls... I think java honor all of them.

    The second case is the same, debug is just a variable of your system, not a define as in C++, so it is mandatory to evaluate it before.

提交回复
热议问题