Is there any complications or side effects for changing final field access/visibility modifier from private to protected?

Posted by Software Engeneering Learner on Programmers See other posts from Programmers or by Software Engeneering Learner
Published on 2012-12-03T11:41:36Z Indexed on 2012/12/03 11:54 UTC
Read the original article Hit count: 183

Filed under:

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?

© Programmers or respective owner

Related posts about java