-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
9
-
generic
-
generic
A DESCRIPTION OF THE REQUEST :
Since modifiers are a bit limited in Java, a way to share methods across packages is restricted to public methods. Sometimes it is dangerous to make a method public, but it needs to be because of the lack of proper modifiers. My solution overcomes this limitation.
The java language specification doesn't currently allow the protected modifier for interface methods. We can take advantage of this fact and use protected for interface methods for this new feature.
If an interface method is marked protected and the interface is implemented by a class in another package, the method would not need to be public, but could also be private or at least package protected. The method is visible, what ever the class declares it to be and additionally visible in the source package of the interface (and sub packages?).
This way we could share certain methods across well known packages.
JUSTIFICATION :
There needs to be a way to make methods visible to other packages other than making it public.
Public methods, that are not meant to be used outside the API, should not pollute the API. The suggestion is a clean way to overcome this limitation.
Since modifiers are a bit limited in Java, a way to share methods across packages is restricted to public methods. Sometimes it is dangerous to make a method public, but it needs to be because of the lack of proper modifiers. My solution overcomes this limitation.
The java language specification doesn't currently allow the protected modifier for interface methods. We can take advantage of this fact and use protected for interface methods for this new feature.
If an interface method is marked protected and the interface is implemented by a class in another package, the method would not need to be public, but could also be private or at least package protected. The method is visible, what ever the class declares it to be and additionally visible in the source package of the interface (and sub packages?).
This way we could share certain methods across well known packages.
JUSTIFICATION :
There needs to be a way to make methods visible to other packages other than making it public.
Public methods, that are not meant to be used outside the API, should not pollute the API. The suggestion is a clean way to overcome this limitation.