In regards to Java, I'm very accustomed to declaring all of my variables as private and generating public getters and setters to hold true to common convention.
I find it curious, though: in relation to getters and setters with no functionality outside of assigning and returning the requested value, is there no performance hit for calling methods like:
String getValue() {
return value;
}
instead of:
classInstance.value;
Does the compiler do something here to help keep the function call from adding an extra cycle? If not, then doesn't this theoretical hit snowball into a large hit in more robust applications?
Edit:: For clarification, this question is not asking why you should or shouldn't use accessor methods, the question is whether or not you take a performance hit by using accessors.