Skip to content

Commit e66a683

Browse files
committed
api: Add set inheritance and redirect chaining docs to RedirectSet
1 parent 82ad8c6 commit e66a683

File tree

1 file changed

+15
-5
lines changed
  • src/api/java/io/github/notstirred/dasm/api/annotations/redirect/sets

1 file changed

+15
-5
lines changed

src/api/java/io/github/notstirred/dasm/api/annotations/redirect/sets/RedirectSet.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
/**
1111
* Marks that an {@code interface} should be used as a redirect set.
1212
* <br/><br/>
13-
* The marked type must be an {@code interface} and must contain only {@code abstract class} definitions marked with {@link TypeRedirect}<br/>
1413
* By convention the marked type's name should end with `RedirectSet`, or `Set`
1514
* <br/><br/>
16-
* A {@link RedirectSet} may contain any number of {@code interface}s, and/or {@code abstract class}es. That <b><i>must</i></b> be annotated with one of: {@link TypeRedirect}, {@link InterOwnerContainer}, or {@link IntraOwnerContainer}<br/>
15+
* A {@link RedirectSet} may contain any number of {@code interface}s, and/or {@code abstract class}es. These <b><i>must</i></b> be annotated with one of: {@link TypeRedirect}, {@link InterOwnerContainer}, or {@link IntraOwnerContainer}<br/>
1716
* <ul>
1817
* <li>An inner type must be an {@code interface} if its destination type is an {@code interface}</li>
1918
* <li>An inner type must be an {@code abstract class} if its destination type is an {@code abstract class}</li>
@@ -25,11 +24,22 @@
2524
* <li>A {@link InterOwnerContainer}'s dst type is {@link InterOwnerContainer#to()}</li>
2625
* <li>A {@link IntraOwnerContainer}'s dst type is {@link IntraOwnerContainer#value()}</li>
2726
* </ul>
28-
* <p>
29-
* <br/><br/>
27+
*
28+
* <h2>Redirect Set Inheritance</h2>
29+
* A {@link RedirectSet} may inherit from one or more {@link RedirectSet}s using java's {@code extends} syntax as normal.
30+
* This results in a derived type inheriting all the redirects from the super type(s).<br/>
31+
* <li>Redirects from an inherited {@link RedirectSet} can be overridden by redefining them within the derived type.</li>
32+
* <li>If {@link RedirectSet} {@code A extends B, C} the redirects from {@code C} will override those in {@code B};
33+
* the resulting redirects will then be overridden by those in {@code A}</li>
34+
*
35+
* <h2>Redirect Chaining</h2>
36+
* All redirects within a {@link RedirectSet} (including all inheritance) apply as a single atomic step. For example if
37+
* {@code A} is redirected to {@code B}, and {@code B} to {@code A} the result will <b>always</b> be A and B swapping
38+
* and will never result in all As or all Bs
39+
*
3040
* <h2>Example</h2>
3141
* <pre>{@code
32-
* @DasmRedirectSet
42+
* @RedirectSet
3343
* interface ExampleSet {
3444
* @TypeRedirect(from = @Ref(Foo.class), to = @Ref(Bar.class))
3545
* abstract class FooToBarRedirects {

0 commit comments

Comments
 (0)