javaeclipseperformancejava-synthetic-methods

Do synthetic methods generated for private fields really incur performance penalty?


In Eclipse, there is a optional warning when a private field is accessed from an inner class, saying that a synthetic accessor method will be generated and that performance may be improved by making the field package-private.

Does this synthetic method really incur performance penalty? I thought that accessors are generally inlined at runtime, aren't they?


Solution

  • See this SO question, in short - not much but it raises some interesting class design points