4 ms·
It rarely ever seems to be useful, though?
by Tichy 16y ago
It rarely ever seems to be useful, though?
- loumf 16y agoI've used it for unit-testing -- gives the test class a little more access.
- thomas11 16y agoExactly. To elaborate a bit for those who never used it in that way: you want to separate your unit tests from your app code. But you still want to give your tests access to non-public methods in order to test them independently. The solution is to put app code and tests in different folders, but in the same packages, and make everything you want to test package-scoped.
- tripa 16y agoMight be a vicious circle: no one knows about it -> no cool uses of it are found -> no one uses it -> loop.
- chopin 16y agoMost of my classes are package private. It is just a matter of information hiding. Especially when using factory patterns I hand out only public interfaces whereas the implementations are kept package private.
- kaffeinecoma 16y agoIronically, it's quite commonly in use in Google's code base. GWT in particular.