User Tools

Site Tools


tutorial:accesswideners

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorial:accesswideners [2022/01/23 02:59] – Fix spelling from "descriptior" to "descriptor", and fixed capitalization of "classname" in the method description froyotutorial:accesswideners [2022/07/12 10:27] – Add AW validation, stop suggesting mixin as an alternative technici4n
Line 3: Line 3:
 Access wideners provide a way to loosen the access limits of classes, methods or fields. Access wideners are similar to the commonly known Access Transformers. Access wideners provide a way to loosen the access limits of classes, methods or fields. Access wideners are similar to the commonly known Access Transformers.
  
-Access wideners should **only** be used where mixin does not currently provide a means to do so. +Access wideners may be used instead of accessor mixins, and there are currently 2 cases where the functionality provided by mixin is not sufficient:
-There are currently only 2 cases where mixins are not sufficient:+
   * Needing to access a (package) private class, especially for the purpose of shadowing or accessing a field or method in a mixin.   * Needing to access a (package) private class, especially for the purpose of shadowing or accessing a field or method in a mixin.
   * 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, wideners are a good choice.     * If you want to subclass a class with only (package) private constructors, wideners are a good choice.
  
Line 132: Line 130:
 ... ...
 </code> </code>
 +
 +===== Validating the file =====
 +By default, accesswidener entries that don't exist are ignored.
 +On recent versions of Loom, you can run ''gradlew validateAccessWidener'' to check that all the classes, fields and methods specified in the accesswidener file exist.
tutorial/accesswideners.txt · Last modified: 2024/06/09 05:33 by haykam