@@ -106,17 +106,18 @@ pub inline fn boolToJboolean(b: bool) jboolean {
106
106
/// Exports all functions with C calling convention from the provided `func_struct` type to be
107
107
/// accessible from Java using the JNI.
108
108
pub fn exportJNI (comptime class_name : []const u8 , comptime func_struct : type ) void {
109
- inline for (@typeInfo (func_struct ).Struct .decls ) | decl | {
109
+ inline for (@typeInfo (func_struct ).@ "struct" .decls ) | decl | {
110
110
const func = comptime @field (func_struct , decl .name );
111
111
const func_type = @TypeOf (func );
112
112
113
113
// If it is not a function, skip.
114
- if (! std . mem . startsWith ( u8 , @typeName ( @TypeOf ( func )), "fn" ) ) {
114
+ if (@typeInfo ( func_type ) != .@ "fn" ) {
115
115
continue ;
116
116
}
117
117
118
+
118
119
// If it is not a function with calling convention .C, skip.
119
- if (@typeInfo (func_type ).Fn .calling_convention != .C ) {
120
+ if (! @typeInfo (func_type ).@ "fn" .calling_convention . eql ( .c ) ) {
120
121
continue ;
121
122
}
122
123
@@ -127,7 +128,7 @@ pub fn exportJNI(comptime class_name: []const u8, comptime func_struct: type) vo
127
128
128
129
_ = comptime std .mem .replace (u8 , tmp_name , "." , "_" , export_name [0.. ]);
129
130
130
- @export (func , .{
131
+ @export (& func , .{
131
132
.name = export_name [0.. ],
132
133
.linkage = .strong ,
133
134
});
@@ -148,8 +149,8 @@ inline fn valueLen(comptime ArgsType: type) comptime_int {
148
149
const args_type_info = @typeInfo (ArgsType );
149
150
150
151
return switch (args_type_info ) {
151
- .Struct = > args_type_info . Struct .fields .len ,
152
- .Void = > 0 ,
152
+ .@"struct" = > | s | s .fields .len ,
153
+ .@"void" = > 0 ,
153
154
else = > 1 ,
154
155
};
155
156
}
@@ -170,7 +171,7 @@ pub fn toJValues(args: anytype) [valueLen(@TypeOf(args))]jvalue {
170
171
const ArgsType = @TypeOf (args );
171
172
const args_type_info = @typeInfo (ArgsType );
172
173
173
- if (args_type_info != .Struct ) {
174
+ if (args_type_info != .@"struct" ) {
174
175
return switch (ArgsType ) {
175
176
jboolean = > [1 ]jvalue {.{ .z = args }},
176
177
jbyte = > [1 ]jvalue {.{ .b = args }},
@@ -190,7 +191,7 @@ pub fn toJValues(args: anytype) [valueLen(@TypeOf(args))]jvalue {
190
191
};
191
192
}
192
193
193
- const fields = args_type_info .Struct .fields ;
194
+ const fields = args_type_info .@ "struct" .fields ;
194
195
var output : [fields .len ]jvalue = undefined ;
195
196
196
197
inline for (fields , 0.. ) | field , i | {
0 commit comments