I have a private final field
in one class and then I want to address that field in a subclass. I want to change field access/visibility modifier from private
to protected
, so I don't have to call getField()
method from subclass and I can instead address that field directly (which is more clear and cohessive). Will there be any side effects or complications if I change private
to protected
for a final
field?
UPDATE: from logical point of view, it's obvious that descendant should be able to directly access all predecessor fields, right? But there are certain constraints that are imposed on private final
fields by JVM, like 100% initialization guarantee after construction phase(useful for concurrency) and so on. So I would like to know, by changing from private
to protected
, won't that or any other constraints be compromised?