properties - If Getter/Setter are replaced at compile time in java; how can their purpose be fulfilled? -
i'm new java. have been reading getter/setter ( why use getter/setter , getter/setter poor design ). while read on oracle understanding jit . i've 2 questions follows : my question that, if jit replaces getters/setters actual value while compiling code, how purpose of getter/setter being fulfilled? how achieve encapsulation ? if jit replaces getters/setters actual value while compiling code how purpose of getter/setter fulfilled in java particular ? because it's optimization. getters , setters still work expected - , if later change implementation use different fields or other mechanism, jit compiler have change how transforms code well. for part, reasoning program design shouldn't care jit compiler @ - that's implementation detail how program happens executed. may want care achieve better performance, doesn't change whether or not program design still holds up. just because jit may compile code uses getter field directly doesn...