.. so only subclasses see the field/method, but no other member of the same package.
Here are my propsed base access descriptors:
private - only that class has access
protected - only that class and subclasses have access
package - any class within the package has access
public - any class in any package has access
Allow package to be specified in addition to private and protected.
Maintain the default access descriptor as "package"
An inner class will have the same access privileges as its outer class.
New keyword? Why not "private protected"?
I'd like to see package be usable in place of the default, and not specifying access give a warning.
Not specifying an access specifier should give a warning and package access should be explicitly assigned.
Wouldn't it be easier to just put the class in its own
(sub)package within the main package.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.