tutorial:mixin_examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:mixin_examples [2021/01/12 14:13] – ytg1234 | tutorial:mixin_examples [2021/08/07 07:08] – Add "modifying a constant" example fracturedcode | ||
---|---|---|---|
Line 359: | Line 359: | ||
+ | + | ||
double d2 = doSomething4(); | double d2 = doSomething4(); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Modifying a constant ===== | ||
+ | Mixin: | ||
+ | <code java> | ||
+ | @ModifyConstant(method = " | ||
+ | private int injected(int value) { | ||
+ | return ++value; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Result: | ||
+ | <code diff> | ||
+ | public void foo() { | ||
+ | - for (int i = 0; i < 4; i++) { | ||
+ | + for (int i = 0; i < 5; i++) { | ||
+ | doSomething(i); | ||
+ | } | ||
} | } | ||
</ | </ |
tutorial/mixin_examples.txt · Last modified: 2024/01/13 15:02 by arkosammy12