No subject

Brian Goetz brian.goetz at oracle.com
Tue Jan 18 19:51:54 UTC 2022


The full range of accessibilities for interface methods was discussed at 
some length during the design process.  Interfaces were extended to 
support private methods, which leaves questions hanging over whether 
protected and package-private methods could also be supported in 
interfaces.  (Also, it's limiting that private fields/classes are not 
permitted in interfaces, which would be very useful, and this was mostly 
an oversight, which will probably be fixed eventually.)  What you want 
-- protected methods in interfaces -- are more complicated than it might 
first appear, because the semantics of "protected" are also more 
complicated than they first appear.  It is probably possible but would 
surely be a lot of incremental complexity for not as much incremental 
expressivity.





On 1/18/2022 2:25 PM, Nir Lisker wrote:
> I'm not advocating for multiple inheritance or new visibility modifiers
> (though here there is a broader issue where library designers want a
> "protected but not public API" kind of visibilit), but I would like to not
> need to copy-paste the same code everywhere, whatever the solution might
> be. Is there a solution?


More information about the amber-dev mailing list