Skip to content

Commit 65fe677

Browse files
authored
Merge pull request #25 from Over-Run/update
2 parents 21e275a + 93ca089 commit 65fe677

File tree

11 files changed

+50
-303
lines changed

11 files changed

+50
-303
lines changed

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ allprojects {
9393
// add your dependencies
9494
compileOnly("org.jetbrains:annotations:25.0.0")
9595
testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
96+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
9697
testImplementation("io.github.over-run:platform:$platformVersion")
9798
api("io.github.over-run:memstack:$memstackVersion")
9899
}

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ projGroupId=io.github.over-run
1212
projArtifactId=marshal
1313
# The project name should only contain lowercase letters, numbers and hyphen.
1414
projName=marshal
15-
projVersion=0.1.0-alpha.36-jdk23
16-
projDesc=Marshaler of native libraries
15+
projVersion=0.1.0-alpha.37-jdk23
16+
projDesc=Marshal allows you to conveniently create native library bindings with FFM API.
1717
# Uncomment them if you want to publish to maven repository.
1818
projUrl=https://github.com/Over-Run/marshal
1919
projLicenseUrl=https://raw.githubusercontent.com/Over-Run/marshal/main/LICENSE
@@ -34,6 +34,6 @@ jdkEnablePreview=true
3434
# Uncomment it if you need to use EA build of JDK.
3535
#jdkEarlyAccessDoc=jdk23
3636

37-
junitVersion=5.11.0
37+
junitVersion=5.11.3
3838
memstackVersion=0.3.0
3939
platformVersion=1.0.0

src/main/java/overrun/marshal/CanonicalLayouts.java

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

src/main/java/overrun/marshal/DowncallFactory.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ private static void popStack(Throwable t) {
125125
/// @param ref ref
126126
/// @param sized sized
127127
/// @param charset charset
128-
/// @param canonicalType canonicalType
129128
/// @return the created [DowncallMethodParameter]
130129
public static DowncallMethodParameter createDowncallMethodParameter(
131130
MethodHandles.Lookup lookup,
@@ -135,10 +134,9 @@ public static DowncallMethodParameter createDowncallMethodParameter(
135134
boolean byValue,
136135
boolean ref,
137136
long sized,
138-
String charset,
139-
String canonicalType
137+
String charset
140138
) {
141-
return new DowncallMethodParameter(parameterType, byValue, ref, sized, charset, canonicalType);
139+
return new DowncallMethodParameter(parameterType, byValue, ref, sized, charset);
142140
}
143141

144142
/// BSM for [DowncallMethodType]
@@ -152,7 +150,6 @@ public static DowncallMethodParameter createDowncallMethodParameter(
152150
/// @param criticalAllowHeapAccess criticalAllowHeapAccess
153151
/// @param sized sized
154152
/// @param charset charset
155-
/// @param canonicalType canonicalType
156153
/// @param args parameters
157154
/// @return the created [DowncallMethodType]
158155
public static DowncallMethodType createDowncallMethodType(
@@ -165,7 +162,6 @@ public static DowncallMethodType createDowncallMethodType(
165162
boolean criticalAllowHeapAccess,
166163
long sized,
167164
String charset,
168-
String canonicalType,
169165
Object... args
170166
) {
171167
return new DowncallMethodType(entrypoint,
@@ -175,8 +171,7 @@ public static DowncallMethodType createDowncallMethodType(
175171
critical,
176172
criticalAllowHeapAccess,
177173
sized,
178-
charset,
179-
canonicalType);
174+
charset);
180175
}
181176

182177
/// BSM for [ConvertedClassType]

src/main/java/overrun/marshal/gen/CType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* @since 0.1.0
3131
*/
3232
@Documented
33-
@Target(ElementType.TYPE_USE)
33+
@Target({ElementType.METHOD, ElementType.PARAMETER})
3434
@Retention(RetentionPolicy.SOURCE)
3535
public @interface CType {
3636
/**

src/main/java/overrun/marshal/gen/CanonicalType.java

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

src/main/java/overrun/marshal/gen/DowncallMethodParameter.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,37 +31,33 @@
3131
/// @param ref `true` if returns from native function
3232
/// @param sized value of [Sized]
3333
/// @param charset value of [StrCharset]
34-
/// @param canonicalType value of [CanonicalType]
3534
/// @author squid233
3635
/// @since 0.1.0
3736
public record DowncallMethodParameter(
3837
ConvertedClassType type,
3938
boolean byValue,
4039
boolean ref,
4140
long sized,
42-
String charset,
43-
String canonicalType
41+
String charset
4442
) implements Constable {
4543
/// Creates a downcall method parameter from the given parameter.
4644
///
4745
/// @param parameter the parameter
4846
/// @return the downcall method parameter
4947
public static DowncallMethodParameter of(Parameter parameter) {
50-
CanonicalType anCanonicalType = parameter.getDeclaredAnnotation(CanonicalType.class);
5148
Sized anSized = parameter.getDeclaredAnnotation(Sized.class);
5249
StrCharset anStrCharset = parameter.getDeclaredAnnotation(StrCharset.class);
5350

5451
return new DowncallMethodParameter(ConvertedClassType.parameterType(parameter),
5552
parameter.getDeclaredAnnotation(ByValue.class) != null,
5653
parameter.getDeclaredAnnotation(Ref.class) != null,
5754
anSized != null ? anSized.value() : -1,
58-
anStrCharset != null ? anStrCharset.value() : null,
59-
anCanonicalType != null ? anCanonicalType.value() : null);
55+
anStrCharset != null ? anStrCharset.value() : null);
6056
}
6157

6258
@Override
6359
public Optional<Desc> describeConstable() {
64-
return Optional.of(new Desc(type.describeConstable().orElseThrow(), byValue, ref, sized, charset, canonicalType));
60+
return Optional.of(new Desc(type.describeConstable().orElseThrow(), byValue, ref, sized, charset));
6561
}
6662

6763
@Override
@@ -70,9 +66,6 @@ public String toString() {
7066
if (byValue) {
7167
sb.append("[ByValue]");
7268
}
73-
if (canonicalType != null) {
74-
sb.append("[CanonicalType=").append(canonicalType).append(']');
75-
}
7669
if (ref) {
7770
sb.append("[Ref]");
7871
}
@@ -93,7 +86,6 @@ public static final class Desc extends DynamicConstantDesc<DowncallMethodParamet
9386
private final boolean ref;
9487
private final long sized;
9588
private final String charset;
96-
private final String canonicalType;
9789

9890
/// constructor
9991
///
@@ -102,28 +94,25 @@ public static final class Desc extends DynamicConstantDesc<DowncallMethodParamet
10294
/// @param ref ref
10395
/// @param sized sized
10496
/// @param charset charset
105-
/// @param canonicalType canonicalType
106-
public Desc(ConvertedClassType.Desc type, boolean byValue, boolean ref, long sized, String charset, String canonicalType) {
97+
public Desc(ConvertedClassType.Desc type, boolean byValue, boolean ref, long sized, String charset) {
10798
super(Constants.BSM_DowncallFactory_createDowncallMethodParameter,
10899
ConstantDescs.DEFAULT_NAME,
109100
Constants.CD_DowncallMethodParameter,
110101
type,
111102
byValue ? ConstantDescs.TRUE : ConstantDescs.FALSE,
112103
ref ? ConstantDescs.TRUE : ConstantDescs.FALSE,
113104
sized,
114-
charset != null ? charset : ConstantDescs.NULL,
115-
canonicalType != null ? canonicalType : ConstantDescs.NULL);
105+
charset != null ? charset : ConstantDescs.NULL);
116106
this.type = type;
117107
this.byValue = byValue;
118108
this.ref = ref;
119109
this.sized = sized;
120110
this.charset = charset;
121-
this.canonicalType = canonicalType;
122111
}
123112

124113
@Override
125114
public DowncallMethodParameter resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException {
126-
return new DowncallMethodParameter(type.resolveConstantDesc(lookup), byValue, ref, sized, charset, canonicalType);
115+
return new DowncallMethodParameter(type.resolveConstantDesc(lookup), byValue, ref, sized, charset);
127116
}
128117
}
129118
}

0 commit comments

Comments
 (0)