Skip to content

Commit 7fa5043

Browse files
committed
parser: Replace Sig types with string references
1 parent 6c27c30 commit 7fa5043

File tree

73 files changed

+236
-455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+236
-455
lines changed

src/api/java/io/github/notstirred/dasm/api/annotations/redirect/redirects/AddFieldToMethodToSets.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import io.github.notstirred.dasm.api.annotations.Dasm;
44
import io.github.notstirred.dasm.api.annotations.redirect.sets.InterOwnerContainer;
55
import io.github.notstirred.dasm.api.annotations.redirect.sets.IntraOwnerContainer;
6-
import io.github.notstirred.dasm.api.annotations.selector.FieldSig;
76
import io.github.notstirred.dasm.api.annotations.selector.Ref;
87

98
import java.lang.annotation.Retention;
@@ -29,7 +28,7 @@
2928
*
3029
* @AddFieldToMethodToSets(
3130
* containers = Bar_redirects.class,
32-
* field = @FieldSig(type = int.class, name = "barX"),
31+
* field = "barX:I",
3332
* setter = "setBarX"
3433
* )
3534
* public int getBarX() {
@@ -53,7 +52,7 @@
5352
/**
5453
* The field to replace
5554
*/
56-
FieldSig field();
55+
String field();
5756

5857
/**
5958
* The <b>name</b> of the setter method, must have the same owner (be in the same class) as the getter method

src/api/java/io/github/notstirred/dasm/api/annotations/redirect/redirects/AddFieldToSets.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import io.github.notstirred.dasm.api.annotations.Dasm;
44
import io.github.notstirred.dasm.api.annotations.redirect.sets.InterOwnerContainer;
55
import io.github.notstirred.dasm.api.annotations.redirect.sets.IntraOwnerContainer;
6-
import io.github.notstirred.dasm.api.annotations.selector.FieldSig;
76
import io.github.notstirred.dasm.api.annotations.selector.Ref;
87

98
import java.lang.annotation.ElementType;
@@ -26,7 +25,7 @@
2625
* public class Foo {
2726
* @AddFieldToSets(
2827
* containers = Bar_to_Foo_redirects.class,
29-
* field = @FieldSig(type = int.class, name = "barX"),
28+
* field = "barX:I",
3029
* )
3130
* private final int x;
3231
* }
@@ -44,7 +43,7 @@
4443
/**
4544
* The field to replace
4645
*/
47-
FieldSig field();
46+
String field();
4847

4948
/**
5049
* The source field's mapping owner.

src/api/java/io/github/notstirred/dasm/api/annotations/redirect/redirects/AddMethodToSets.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import io.github.notstirred.dasm.api.annotations.Dasm;
44
import io.github.notstirred.dasm.api.annotations.redirect.sets.InterOwnerContainer;
55
import io.github.notstirred.dasm.api.annotations.redirect.sets.IntraOwnerContainer;
6-
import io.github.notstirred.dasm.api.annotations.selector.MethodSig;
76
import io.github.notstirred.dasm.api.annotations.selector.Ref;
87

98
import java.lang.annotation.ElementType;
@@ -25,8 +24,8 @@
2524
* @Dasm
2625
* public class Foo {
2726
* @AddMethodToSets(
28-
* containers = Bar_to_Foo_redirects
29-
* method = @MethodSig(name = "getBarX", ret = int.class, args = { }),
27+
* containers = Bar_to_Foo_redirects.class,
28+
* method = "getBarX()I"
3029
* )
3130
* private int getX();
3231
* }
@@ -44,7 +43,7 @@
4443
/**
4544
* The method to replace
4645
*/
47-
MethodSig method();
46+
String method();
4847

4948
/**
5049
* The source method's mapping owner.

src/api/java/io/github/notstirred/dasm/api/annotations/redirect/redirects/ConstructorToFactoryRedirect.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import io.github.notstirred.dasm.api.annotations.redirect.sets.InterOwnerContainer;
44
import io.github.notstirred.dasm.api.annotations.redirect.sets.RedirectSet;
5-
import io.github.notstirred.dasm.api.annotations.selector.ConstructorMethodSig;
65

76
import java.lang.annotation.Retention;
87
import java.lang.annotation.Target;
@@ -28,7 +27,7 @@
2827
* <pre>{@code
2928
* @IntraOwnerContainer(owner = @Ref(Vec3i.class))
3029
* abstract class Vec3i_redirects {
31-
* @ConstructorToFactoryRedirect(@ConstructorMethodSig(args = { @Ref(long.class) }))
30+
* @ConstructorToFactoryRedirect("<init>(J)V)
3231
* static native Vec3i fromLong(long packed);
3332
* }
3433
* }</pre>
@@ -41,9 +40,7 @@
4140
* <pre>{@code
4241
* @InterOwnerContainer(owner = @Ref(Vec3i.class), newOwner = @Ref(Util.class))
4342
* abstract class Vec3i_redirects {
44-
* @ConstructorToFactoryRedirect(
45-
* @ConstructorMethodSig(args = { @Ref(int.class), @Ref(int.class), @Ref(int.class) })
46-
* )
43+
* @ConstructorToFactoryRedirect("<init>(III)V")
4744
* static native Vec3i newVec3i(int x, int y, int z);
4845
* }
4946
* }</pre>
@@ -56,9 +53,7 @@
5653
* <pre>{@code
5754
* @TypeRedirect(from = @Ref(Vec3i.class), to = @Ref(Vec3d.class))
5855
* abstract class Vec3i_redirects {
59-
* @ConstructorToFactoryRedirect(
60-
* @ConstructorMethodSig(args = { @Ref(int.class), @Ref(int.class), @Ref(int.class) })
61-
* )
56+
* @ConstructorToFactoryRedirect("<init>(III)V")
6257
* static native Vec3d of(double x, double y, double z);
6358
* }
6459
*
@@ -81,15 +76,13 @@
8176
*
8277
* @InterOwnerContainer(owner = @Ref(Vec3i.class), newOwner = @Ref(VecUtils.class))
8378
* abstract class Vec3i_to_VecUtils {
84-
* @ConstructorToFactoryRedirect(
85-
* @ConstructorMethodSig(args = { @Ref(int.class), @Ref(int.class), @Ref(int.class) })
86-
* )
79+
* @ConstructorToFactoryRedirect("<init>(III)V")
8780
* static native Vec3d vec3dOf(double x, double y, double z);
8881
* }
8982
* }</pre>
9083
*/
9184
@Target(METHOD)
9285
@Retention(CLASS)
9386
public @interface ConstructorToFactoryRedirect {
94-
ConstructorMethodSig value();
87+
String value();
9588
}

src/api/java/io/github/notstirred/dasm/api/annotations/redirect/redirects/FieldRedirect.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import io.github.notstirred.dasm.api.annotations.redirect.sets.InterOwnerContainer;
44
import io.github.notstirred.dasm.api.annotations.redirect.sets.IntraOwnerContainer;
5-
import io.github.notstirred.dasm.api.annotations.selector.FieldSig;
65
import io.github.notstirred.dasm.api.annotations.selector.Ref;
76

87
import java.lang.annotation.ElementType;
@@ -23,7 +22,7 @@
2322
* <h2>Example:</h2>
2423
* The following field redirect specifies a redirect from {@code int existingFieldName} to {@code int newFieldName}
2524
* <pre>{@code
26-
* @FieldRedirect(type = @Ref(int.class), name = "existingFieldName")
25+
* @FieldRedirect("existingFieldName:I")
2726
* private int newFieldName;
2827
* }</pre>
2928
*/
@@ -33,7 +32,7 @@
3332
/**
3433
* The field to replace
3534
*/
36-
FieldSig value();
35+
String value();
3736

3837
/**
3938
* The source field's mapping owner.

src/api/java/io/github/notstirred/dasm/api/annotations/redirect/redirects/FieldToMethodRedirect.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import io.github.notstirred.dasm.api.annotations.redirect.sets.InterOwnerContainer;
44
import io.github.notstirred.dasm.api.annotations.redirect.sets.IntraOwnerContainer;
5-
import io.github.notstirred.dasm.api.annotations.selector.FieldSig;
65
import io.github.notstirred.dasm.api.annotations.selector.Ref;
76

87
import java.lang.annotation.Retention;
@@ -35,10 +34,10 @@
3534
* <pre>{@code
3635
* @TypeRedirect(from = @Ref(Vec3i.class), to = @Ref(Vec3.class))
3736
* abstract class Vec3i_to_Vec3 {
38-
* @FieldToMethodRedirect(@FieldSig(type = @Ref(int.class), name = "x"), setter = "setX")
37+
* @FieldToMethodRedirect(value = "x:I"), setter = "setX")
3938
* native double getX();
4039
*
41-
* @FieldToMethodRedirect(@FieldSig(type = @Ref(int.class), name = "z"), setter = "setZ")
40+
* @FieldToMethodRedirect(value = "z:I", setter = "setZ")
4241
* native double getZ();
4342
* }
4443
* @TypeRedirect(from = @Ref(int.class), to = @Ref(double.class))
@@ -56,19 +55,21 @@
5655
* <pre>{@code
5756
* @IntraOwnerContainer(owner = @Ref(Vec3i.class))
5857
* abstract class Vec3i_redirects {
59-
* @FieldToMethodRedirect(@FieldSig(type = @Ref(int.class), name = "x"))
58+
* @FieldToMethodRedirect("x:I")
6059
* native int getX();
6160
*
62-
* @FieldToMethodRedirect(@FieldSig(type = @Ref(int.class), name = "z"))
61+
* @FieldToMethodRedirect("z:I")
6362
* native int getZ();
6463
* }
6564
* }</pre>
6665
*/
6766
@Target(METHOD)
6867
@Retention(CLASS)
6968
public @interface FieldToMethodRedirect {
70-
/** The field to replace access to. */
71-
FieldSig value();
69+
/**
70+
* The field to replace access to.
71+
*/
72+
String value();
7273

7374
/**
7475
* The <b>name</b> of the setter method, must have the same owner (be in the same class) as the getter method

src/api/java/io/github/notstirred/dasm/api/annotations/redirect/redirects/MethodRedirect.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import io.github.notstirred.dasm.api.annotations.redirect.sets.InterOwnerContainer;
44
import io.github.notstirred.dasm.api.annotations.redirect.sets.IntraOwnerContainer;
5-
import io.github.notstirred.dasm.api.annotations.selector.MethodSig;
65
import io.github.notstirred.dasm.api.annotations.selector.Ref;
76

87
import java.lang.annotation.Retention;
@@ -27,14 +26,14 @@
2726
* <h3>E1:</h3>
2827
* Specifies a {@code private String} method with the name {@code existingMethodName}, and the new name {@code newMethodName}
2928
* <pre>{@code
30-
* @MethodRedirect(@MethodSig(name = "existingMethodName", args = { }, ret = @Ref(String.class)))
29+
* @MethodRedirect("existingMethodName()Ljava/lang/String;")
3130
* private native String newMethodName();
3231
* }</pre><br/>
3332
* <h3>E2:</h3>
3433
* Specifies a {@code private String} method with the name {@code existingMethodName}, and the new name {@code newMethodName}.<br/>
3534
* Additionally an optional mappings owner is specified, see: {@link MethodRedirect#mappingsOwner()}.
3635
* <pre>{@code
37-
* @MethodRedirect(name = "existingMethodName", mappingsOwner = @Ref(OtherClass.class))
36+
* @MethodRedirect(value = "existingMethodName()Ljava/lang/String;", mappingsOwner = @Ref(OtherClass.class))
3837
* private native String newMethodName();
3938
* }</pre>
4039
*/
@@ -44,7 +43,7 @@
4443
/**
4544
* The method to replace
4645
*/
47-
MethodSig value();
46+
String value();
4847

4948
/**
5049
* The source method's mapping owner.

src/api/java/io/github/notstirred/dasm/api/annotations/selector/ConstructorMethodSig.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/api/java/io/github/notstirred/dasm/api/annotations/selector/FieldSig.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/api/java/io/github/notstirred/dasm/api/annotations/selector/MethodSig.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)