tutorial:accesswideners
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:accesswideners [2020/06/22 14:13] – Clarify the circumstances where an access widener should and should not be used earthcomputer | tutorial:accesswideners [2020/08/08 01:27] – add missing word upcraftlp | ||
---|---|---|---|
Line 5: | Line 5: | ||
Access wideners should **only** be used where mixin does not currently provide a means to do so. | Access wideners should **only** be used where mixin does not currently provide a means to do so. | ||
There are currently only 2 cases where mixins are not sufficient: | There are currently only 2 cases where mixins are not sufficient: | ||
- | * Needing to access a private class, especially for the purpose of shadowing or accessing a field or method in a mixin. | + | * Needing to access a (package) |
* Being able to override final methods or subclass final classes. | * Being able to override final methods or subclass final classes. | ||
+ | * Before you consider overriding final methods, try mixin injecting in final methods first! | ||
+ | * If you want to subclass a class with only (package) private constructors, | ||
===== Requirements ===== | ===== Requirements ===== | ||
Line 25: | Line 27: | ||
<code [enable_line_numbers=" | <code [enable_line_numbers=" | ||
- | # Comments like this are supported, as well at the end of the line | + | # Comments like this are supported, as well as at the end of the line |
</ | </ | ||
Line 111: | Line 113: | ||
... | ... | ||
- | " | + | " |
... | ... | ||
</ | </ |
tutorial/accesswideners.txt · Last modified: 2024/04/29 21:00 by ayutac