├── .gitignore ├── README.md ├── src ├── bindings.zig ├── jui.zig ├── descriptors.zig └── Reflector.zig ├── test ├── src │ └── com │ │ └── jui │ │ ├── JNIExample.java │ │ └── TypesTest.java └── demo.zig ├── LICENSE.md ├── tools ├── loadfn.zig └── class2zig.zig ├── .github └── workflows │ └── tests.yml └── examples └── guessing-game ├── main.zig └── gen └── java ├── io ├── InputStream.zig └── PrintStream.zig └── util └── Scanner.zig /.gitignore: -------------------------------------------------------------------------------- 1 | /zig-cache 2 | /zig-out 3 | /**/*.class 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jui 2 | 3 | jui or the Java Universal Interface is a set of Zig-intuitive bindings for JNI, the Java Native Interface. 4 | 5 | ## Taking jui for a spin 6 | 7 | ```bash 8 | # Build the demo 9 | zig build 10 | 11 | # Run the demo 12 | java -Djava.library.path="zig-out/lib" test/src/com/jui/JNIExample.java 13 | ``` 14 | -------------------------------------------------------------------------------- /src/bindings.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const jui = @import("jui"); 3 | 4 | fn returnTypeLookup(comptime descriptor: []const u8, comptime descriptor_table: []const []const u8, comptime return_type: []const type) type { 5 | inline for (descriptor_table) |desc, i| { 6 | if (std.mem.eql(u8, desc, descriptor)) { 7 | return return_type[i]; 8 | } 9 | } 10 | @compileError("Return Type Lookup: No descriptor " ++ descriptor ++ " found in descriptor_table"); 11 | } 12 | -------------------------------------------------------------------------------- /test/src/com/jui/JNIExample.java: -------------------------------------------------------------------------------- 1 | package com.jui; 2 | 3 | public final class JNIExample { 4 | static { 5 | System.loadLibrary("jni_example"); 6 | } 7 | 8 | public static native String greet(String name); 9 | 10 | public static void main(String[] args) { 11 | try { 12 | System.out.println(greet("abc")); 13 | } catch (Exception e) { 14 | System.out.println("Big bad Zig error handled in Java >:("); 15 | e.printStackTrace(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 jui Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tools/loadfn.zig: -------------------------------------------------------------------------------- 1 | pub fn load(env: *jui.JNIEnv) !void {{ 2 | struct {{ 3 | var runner = std.once(_runner); 4 | var _env: *jui.JNIEnv = undefined; 5 | var _err: ?Error = null; 6 | 7 | const Error = 8 | jui.JNIEnv.FindClassError || 9 | jui.JNIEnv.NewReferenceError || 10 | jui.JNIEnv.GetFieldIdError || 11 | jui.JNIEnv.GetMethodIdError || 12 | jui.JNIEnv.GetStaticFieldIdError || 13 | jui.JNIEnv.GetStaticMethodIdError; 14 | 15 | fn _load(arg: *jui.JNIEnv) !void {{ 16 | _env = arg; 17 | runner.call(); 18 | if (_err) |e| return e; 19 | }} 20 | 21 | fn _runner() void {{ 22 | _run(_env) catch |e| {{ _err = e; }}; 23 | }} 24 | 25 | fn _run(inner_env: *jui.JNIEnv) !void {{ 26 | const class_local = try inner_env.findClass(classpath); 27 | class_global = try inner_env.newReference(.global, class_local); 28 | const class = class_global orelse return error.NoClassDefFoundError; 29 | // {[load_entry]s} 30 | }} 31 | }}._load(env) catch |e| return e; 32 | }} 33 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Matrix Build 2 | on: 3 | push: 4 | branches: [ main ] 5 | pull_request: 6 | branches: [ main ] 7 | schedule: 8 | - cron: 0 9 * * * 9 | jobs: 10 | test: 11 | runs-on: ${{ matrix.os }} 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | java: [ '11', '17' ] 16 | os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] 17 | name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample 18 | steps: 19 | - name: Force Line Endings for Windows 20 | if: ${{ matrix.os == 'windows-latest' }} 21 | run: | 22 | git config --global core.autocrlf false 23 | git config --global core.eol lf 24 | 25 | - name: Checkout 26 | uses: actions/checkout@v3 27 | 28 | - name: Setup Zig 29 | uses: goto-bus-stop/setup-zig@v1 30 | with: 31 | version: master 32 | 33 | - name: Setup java 34 | uses: actions/setup-java@v3 35 | with: 36 | distribution: 'temurin' 37 | java-version: ${{ matrix.java }} 38 | 39 | - name: Install DyLib 40 | if: ${{ matrix.os == 'macos-latest' }} 41 | run: | 42 | ln -s $JAVA_HOME/lib/server/libjvm.dylib /usr/local/lib/libjvm.dylib 43 | otool -L /usr/local/lib/libjvm.dylib 44 | 45 | - name: Run Tests 46 | run: | 47 | zig version 48 | zig build test -------------------------------------------------------------------------------- /test/demo.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const jui = @import("jui"); 3 | 4 | const Reflector = jui.Reflector; 5 | const String = Reflector.String; 6 | 7 | var reflector: Reflector = undefined; 8 | 9 | fn onLoad(vm: *jui.JavaVM) !jui.jint { 10 | const version = jui.JNIVersion{ .major = 10, .minor = 0 }; 11 | reflector = Reflector.init(std.heap.page_allocator, try vm.getEnv(version)); 12 | return @bitCast(jui.jint, version); 13 | } 14 | 15 | fn onUnload(vm: *jui.JavaVM) void { 16 | _ = vm; 17 | } 18 | 19 | fn greet(env: *jui.JNIEnv, this_object: jui.jobject, string: String) !jui.jstring { 20 | _ = this_object; 21 | 22 | defer string.release(); 23 | 24 | var buf: [256]u8 = undefined; 25 | return try env.newStringUTF(try std.fmt.bufPrintZ(&buf, "Hey {s}!", .{string.chars.utf8[0..]})); 26 | } 27 | 28 | comptime { 29 | const wrapped = struct { 30 | fn onLoadWrapped(vm: *jui.JavaVM) callconv(.C) jui.jint { 31 | return jui.wrapErrors(onLoad, .{vm}); 32 | } 33 | 34 | fn onUnloadWrapped(vm: *jui.JavaVM) callconv(.C) void { 35 | return jui.wrapErrors(onUnload, .{vm}); 36 | } 37 | 38 | fn greetWrapped(env: *jui.JNIEnv, class: jui.jclass, string: jui.jstring) callconv(.C) jui.jstring { 39 | return jui.wrapErrors(greet, .{ env, class, String.fromObject(&reflector, string) catch unreachable }); 40 | } 41 | }; 42 | 43 | jui.exportUnder("com.jui.JNIExample", .{ 44 | .onLoad = wrapped.onLoadWrapped, 45 | .onUnload = wrapped.onUnloadWrapped, 46 | .greet = wrapped.greetWrapped, 47 | }); 48 | } 49 | -------------------------------------------------------------------------------- /examples/guessing-game/main.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const jui = @import("jui"); 3 | const Scanner = @import("gen/java/util/Scanner.zig").Scanner; 4 | const InputStream = @import("gen/java/io/InputStream.zig").InputStream; 5 | const PrintStream = @import("gen/java/io/PrintStream.zig").PrintStream; 6 | 7 | const Descriptor = jui.descriptors.Descriptor; 8 | 9 | const System = opaque { 10 | var class_global: ?jui.jclass = null; 11 | var static_fields: struct { 12 | in: jui.jfieldID, 13 | out: jui.jfieldID, 14 | } = undefined; 15 | 16 | pub fn load(env: *jui.JNIEnv) !void { 17 | struct { 18 | var runner = std.once(_runner); 19 | var _env: *jui.JNIEnv = undefined; 20 | var _err: ?Error = null; 21 | 22 | const Error = 23 | jui.JNIEnv.FindClassError || 24 | jui.JNIEnv.NewReferenceError || 25 | jui.JNIEnv.GetFieldIdError || 26 | jui.JNIEnv.GetMethodIdError || 27 | jui.JNIEnv.GetStaticFieldIdError || 28 | jui.JNIEnv.GetStaticMethodIdError; 29 | 30 | fn _load(arg: *jui.JNIEnv) !void { 31 | _env = arg; 32 | runner.call(); 33 | if (_err) |e| return e; 34 | } 35 | 36 | fn _runner() void { 37 | const class_local = _env.findClass("java/lang/System") catch |e| { 38 | _err = e; 39 | return; 40 | }; 41 | class_global = _env.newReference(.global, class_local) catch |e| { 42 | _err = e; 43 | return; 44 | }; 45 | if (class_global) |class| { 46 | static_fields = .{ 47 | .in = _env.getStaticFieldId(class, "in", "Ljava/io/InputStream;") catch |e| { 48 | _err = e; 49 | return; 50 | }, 51 | .out = _env.getStaticFieldId(class, "out", "Ljava/io/PrintStream;") catch |e| { 52 | _err = e; 53 | return; 54 | }, 55 | }; 56 | } else { 57 | _err = error.NoClassDefFoundError; 58 | } 59 | } 60 | }._load(env) catch |e| return e; 61 | } 62 | 63 | pub fn unload(env: *jui.JNIEnv) void { 64 | if (class_global) |class| { 65 | env.deleteReference(.global, class); 66 | class_global = null; 67 | } 68 | } 69 | 70 | pub fn getIn(env: *jui.JNIEnv) !*InputStream { 71 | try load(env); 72 | const class = class_global orelse return error.ClassNotFound; 73 | return @ptrCast(*InputStream, env.getStaticField(.object, class, static_fields.in)); 74 | } 75 | 76 | pub fn getOut(env: *jui.JNIEnv) !*PrintStream { 77 | try load(env); 78 | const class = class_global orelse return error.ClassNotFound; 79 | return @ptrCast(*PrintStream, env.getStaticField(.object, class, static_fields.out)); 80 | } 81 | }; 82 | 83 | pub fn main() !void { 84 | // Construct vm... 85 | const JNI_1_10 = jui.JNIVersion{ .major = 10, .minor = 0 }; 86 | const args = jui.JavaVMInitArgs{ 87 | .version = JNI_1_10, 88 | .options = &.{}, 89 | .ignore_unrecognized = true, 90 | }; 91 | var result = jui.JavaVM.createJavaVM(&args) catch |err| { 92 | std.debug.panic("Cannot create JVM {!}", .{err}); 93 | }; 94 | 95 | var env = result.env; 96 | var jvm = try env.getJavaVM(); 97 | var created_jvm = try jui.JavaVM.getCreatedJavaVM(); 98 | 99 | std.debug.assert(created_jvm != null); 100 | std.debug.assert(jvm == created_jvm.?); 101 | 102 | try jniMain(env); 103 | } 104 | 105 | pub fn jniMain(env: *jui.JNIEnv) !void { 106 | // Load classes 107 | try System.load(env); 108 | try Scanner.load(env); 109 | try PrintStream.load(env); 110 | try InputStream.load(env); 111 | 112 | // Use the classes! 113 | const in = try System.getIn(env); 114 | const out = try System.getOut(env); 115 | 116 | var scanner = try Scanner.@"(Ljava/io/InputStream;)V"(env, @ptrCast(jui.jobject, in)); 117 | try out.@"print(Ljava/lang/Object;)V"(env, @ptrCast(jui.jobject, scanner)); 118 | 119 | const int = try scanner.@"nextInt()I"(env); 120 | try out.@"print(I)V"(env, int); 121 | } 122 | -------------------------------------------------------------------------------- /test/src/com/jui/TypesTest.java: -------------------------------------------------------------------------------- 1 | package com.jui; 2 | 3 | import java.nio.ByteOrder; 4 | 5 | public class TypesTest { 6 | 7 | public interface Interface { 8 | } 9 | 10 | public static abstract class Abstract { 11 | public Abstract() { 12 | } 13 | } 14 | 15 | public static final class SubClass extends Abstract { 16 | public SubClass() { 17 | super(); 18 | } 19 | } 20 | 21 | public boolean booleanValue; 22 | public byte byteValue; 23 | public char charValue; 24 | public short shortValue; 25 | public int intValue; 26 | public long longValue; 27 | public float floatValue; 28 | public double doubleValue; 29 | public Object objectValue; 30 | 31 | public static boolean staticBooleanValue; 32 | public static byte staticByteValue; 33 | public static char staticCharValue; 34 | public static short staticShortValue; 35 | public static int staticIntValue; 36 | public static long staticLongValue; 37 | public static float staticFloatValue; 38 | public static double staticDoubleValue; 39 | public static Object staticObjectValue; 40 | 41 | public TypesTest() { 42 | } 43 | 44 | public TypesTest(boolean value) { 45 | booleanValue = value; 46 | } 47 | 48 | public TypesTest(byte value) { 49 | byteValue = value; 50 | } 51 | 52 | public TypesTest(char value) { 53 | charValue = value; 54 | } 55 | 56 | public TypesTest(short value) { 57 | shortValue = value; 58 | } 59 | 60 | public TypesTest(int value) { 61 | intValue = value; 62 | } 63 | 64 | public TypesTest(long value) { 65 | longValue = value; 66 | } 67 | 68 | public TypesTest(float value) { 69 | floatValue = value; 70 | } 71 | 72 | public TypesTest(double value) { 73 | doubleValue = value; 74 | } 75 | 76 | public TypesTest(Object value) { 77 | objectValue = value; 78 | } 79 | 80 | public void initialize(boolean z, byte b, char c, short s, int i, long j, float f, double d, Object l) { 81 | booleanValue = z; 82 | byteValue = b; 83 | charValue = c; 84 | shortValue = s; 85 | intValue = i; 86 | longValue = j; 87 | floatValue = f; 88 | doubleValue = d; 89 | objectValue = l; 90 | } 91 | 92 | public boolean getBooleanValue() { 93 | return booleanValue; 94 | } 95 | 96 | public byte getByteValue() { 97 | return byteValue; 98 | } 99 | 100 | public char getCharValue() { 101 | return charValue; 102 | } 103 | 104 | public short getShortValue() { 105 | return shortValue; 106 | } 107 | 108 | public int getIntValue() { 109 | return intValue; 110 | } 111 | 112 | public long getLongValue() { 113 | return longValue; 114 | } 115 | 116 | public float getFloatValue() { 117 | return floatValue; 118 | } 119 | 120 | public double getDoubleValue() { 121 | return doubleValue; 122 | } 123 | 124 | public Object getObjectValue() { 125 | return objectValue; 126 | } 127 | 128 | public static void staticInitialize(boolean z, byte b, char c, short s, int i, long j, float f, double d, 129 | Object l) { 130 | staticBooleanValue = z; 131 | staticByteValue = b; 132 | staticCharValue = c; 133 | staticShortValue = s; 134 | staticIntValue = i; 135 | staticLongValue = j; 136 | staticFloatValue = f; 137 | staticDoubleValue = d; 138 | staticObjectValue = l; 139 | } 140 | 141 | public static boolean getStaticBooleanValue() { 142 | return staticBooleanValue; 143 | } 144 | 145 | public static byte getStaticByteValue() { 146 | return staticByteValue; 147 | } 148 | 149 | public static char getStaticCharValue() { 150 | return staticCharValue; 151 | } 152 | 153 | public static short getStaticShortValue() { 154 | return staticShortValue; 155 | } 156 | 157 | public static int getStaticIntValue() { 158 | return staticIntValue; 159 | } 160 | 161 | public static long getStaticLongValue() { 162 | return staticLongValue; 163 | } 164 | 165 | public static float getStaticFloatValue() { 166 | return staticFloatValue; 167 | } 168 | 169 | public static double getStaticDoubleValue() { 170 | return staticDoubleValue; 171 | } 172 | 173 | public static Object getStaticObjectValue() { 174 | return staticObjectValue; 175 | } 176 | 177 | public void fail() throws Exception { 178 | throw new Exception("FAILED FROM JAVA"); 179 | } 180 | 181 | public static java.nio.ByteBuffer getDirectBuffer() { 182 | final int len = 32; 183 | var buffer = java.nio.ByteBuffer.allocateDirect(len).order(ByteOrder.nativeOrder()); 184 | for (byte i = 0; i < len; i++) { 185 | buffer.put(i); 186 | } 187 | 188 | return buffer; 189 | } 190 | 191 | public static boolean checkReversedBuffer(java.nio.ByteBuffer buffer) { 192 | if (buffer.capacity() != 32) 193 | return false; 194 | buffer.position(0); 195 | byte value = 32; 196 | while (true) { 197 | var read = buffer.get(); 198 | value -= 1; 199 | 200 | if (read != value) 201 | return false; 202 | if (value == 0) 203 | break; 204 | } 205 | 206 | return true; 207 | } 208 | } -------------------------------------------------------------------------------- /src/jui.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const builtin = @import("builtin"); 3 | 4 | pub const bindings = @import("bindings.zig"); 5 | pub const descriptors = @import("descriptors.zig"); 6 | pub const Reflector = @import("Reflector.zig"); 7 | const types = @import("types.zig"); 8 | 9 | // We support Zig 0.9.1 (old stable), 0.10.0 (current stable) and 0.11.0-dev (latest master). 10 | // We also support both stage1 and stage2 compilers. 11 | // This can be simplified once we drop support for Zig 0.9.1 and stage1: 12 | pub const is_zig_9_1 = builtin.zig_version.major >= 0 and builtin.zig_version.minor == 9; 13 | pub const is_zig_master = builtin.zig_version.major >= 0 and builtin.zig_version.minor >= 11; 14 | pub const is_stage2 = @hasDecl(builtin, "zig_backend") and builtin.zig_backend != .stage1; 15 | 16 | pub usingnamespace types; 17 | 18 | pub fn exportAs(comptime name: []const u8, function: anytype) void { 19 | var z: [name.len]u8 = undefined; 20 | for (name) |v, i| z[i] = switch (v) { 21 | '.' => '_', 22 | else => v, 23 | }; 24 | 25 | @export(function, .{ .name = "Java_" ++ &z, .linkage = .Strong }); 26 | } 27 | 28 | pub fn exportUnder(comptime class_name: []const u8, functions: anytype) void { 29 | inline for (std.meta.fields(@TypeOf(functions))) |field| { 30 | const z = @field(functions, field.name); 31 | 32 | if (std.mem.eql(u8, field.name, "onLoad")) 33 | @export(z, .{ .name = "JNI_OnLoad", .linkage = .Strong }) 34 | else if (std.mem.eql(u8, field.name, "onUnload")) 35 | @export(z, .{ .name = "JNI_OnUnload", .linkage = .Strong }) 36 | else 37 | exportAs(class_name ++ "." ++ field.name, z); 38 | } 39 | } 40 | 41 | fn printSourceAtAddressJava(allocator: std.mem.Allocator, debug_info: *std.debug.DebugInfo, writer: anytype, address: usize) !void { 42 | const module = debug_info.getModuleForAddress(address) catch |err| switch (err) { 43 | error.MissingDebugInfo, error.InvalidDebugInfo => { 44 | return try writer.writeAll((" " ** 8) ++ "at unknown (missing/invalud debug info)"); 45 | }, 46 | else => return err, 47 | }; 48 | 49 | const symbol_info = if (comptime is_zig_master) 50 | try module.getSymbolAtAddress(allocator, address) 51 | else 52 | try module.getSymbolAtAddress(address); 53 | 54 | defer if (comptime is_zig_master) symbol_info.deinit(allocator) else symbol_info.deinit(); 55 | 56 | if (symbol_info.line_info) |li| { 57 | try writer.print((" " ** 8) ++ "at {s}({s}:{d}:{d})", .{ symbol_info.symbol_name, li.file_name, li.line, li.column }); 58 | } else { 59 | try writer.print((" " ** 8) ++ "at {s}({s}:unknown)", .{ symbol_info.symbol_name, symbol_info.compile_unit_name }); 60 | } 61 | } 62 | 63 | fn writeStackTraceJava( 64 | allocator: std.mem.Allocator, 65 | stack_trace: std.builtin.StackTrace, 66 | writer: anytype, 67 | debug_info: *std.debug.DebugInfo, 68 | ) !void { 69 | if (builtin.strip_debug_info) return error.MissingDebugInfo; 70 | 71 | var frame_index: usize = 0; 72 | var frames_left: usize = std.math.min(stack_trace.index, stack_trace.instruction_addresses.len); 73 | 74 | while (frames_left != 0) : ({ 75 | frames_left -= 1; 76 | frame_index = (frame_index + 1) % stack_trace.instruction_addresses.len; 77 | }) { 78 | const return_address = stack_trace.instruction_addresses[frame_index]; 79 | try printSourceAtAddressJava(allocator, debug_info, writer, return_address - 1); 80 | if (frames_left != 1) try writer.writeByte('\n'); 81 | } 82 | } 83 | 84 | fn formatStackTraceJava(writer: anytype, trace: std.builtin.StackTrace) !void { 85 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); 86 | defer arena.deinit(); 87 | const debug_info = std.debug.getSelfDebugInfo() catch return; 88 | try writer.writeAll("\n"); 89 | writeStackTraceJava(arena.allocator(), trace, writer, debug_info) catch |err| { 90 | try writer.print("Unable to print stack trace: {s}\n", .{@errorName(err)}); 91 | }; 92 | } 93 | 94 | // --- Code ~~stolen~~ adapted from debug.zig ends here --- 95 | 96 | fn splitError(comptime T: type) struct { error_set: ?type = null, payload: type } { 97 | return switch (@typeInfo(T)) { 98 | .ErrorUnion => |u| .{ .error_set = u.error_set, .payload = u.payload }, 99 | else => .{ .payload = T }, 100 | }; 101 | } 102 | 103 | /// NOTE: This is sadly required as @Type for Fn is not implemented so we cannot autowrap functions 104 | pub fn wrapErrors(function: anytype, args: anytype) splitError(@typeInfo(@TypeOf(function)).Fn.return_type.?).payload { 105 | const se = splitError(@typeInfo(@TypeOf(function)).Fn.return_type.?); 106 | var env: *types.JNIEnv = undefined; 107 | 108 | switch (@TypeOf(args[0])) { 109 | *types.JNIEnv => env = args[0], 110 | *types.JavaVM => env = args[0].getEnv(types.JNIVersion{ .major = 10, .minor = 0 }) catch unreachable, 111 | else => unreachable, 112 | } 113 | 114 | if (se.error_set) |_| { 115 | return @call(.auto, function, args) catch |err| { 116 | var maybe_ert = @errorReturnTrace(); 117 | if (maybe_ert) |ert| { 118 | var err_buf = std.ArrayList(u8).init(std.heap.page_allocator); 119 | defer err_buf.deinit(); 120 | 121 | err_buf.writer().writeAll(@errorName(err)) catch unreachable; 122 | formatStackTraceJava(err_buf.writer(), ert.*) catch unreachable; 123 | err_buf.writer().writeByte(0) catch unreachable; 124 | 125 | env.throwGeneric(@ptrCast([*c]const u8, err_buf.items)) catch unreachable; 126 | } else { 127 | var buf: [512]u8 = undefined; 128 | var msg = std.fmt.bufPrintZ(&buf, "{s}", .{@errorName(err)}) catch unreachable; 129 | env.throwGeneric(msg) catch unreachable; 130 | } 131 | 132 | // Even though an exception technically kills execution we 133 | // must still return something; just return undefined 134 | return undefined; 135 | }; 136 | } else { 137 | return @call(.auto, function, args); 138 | } 139 | } 140 | 141 | test { 142 | std.testing.refAllDecls(@This()); 143 | } 144 | -------------------------------------------------------------------------------- /src/descriptors.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const jui = @import("jui.zig"); 3 | 4 | pub const MethodDescriptor = struct { 5 | const Self = @This(); 6 | 7 | parameters: []const *Descriptor, 8 | return_type: *Descriptor, 9 | 10 | pub fn stringify(self: Self, writer: anytype) anyerror!void { 11 | try writer.writeByte('('); 12 | for (self.parameters) |param| try param.stringify(writer); 13 | try writer.writeByte(')'); 14 | try self.return_type.stringify(writer); 15 | } 16 | 17 | pub fn deinit(self: *const Self, allocator: std.mem.Allocator) void { 18 | for (self.parameters) |param| param.deinit(allocator); 19 | allocator.free(self.parameters); 20 | self.return_type.deinit(allocator); 21 | } 22 | 23 | pub fn toStringArrayList(self: Self, buf: *std.ArrayList(u8)) !void { 24 | try buf.ensureCapacity(0); 25 | try self.stringify(buf.writer()); 26 | } 27 | }; 28 | 29 | pub const Descriptor = union(enum) { 30 | const Self = @This(); 31 | 32 | byte, 33 | char, 34 | 35 | int, 36 | long, 37 | short, 38 | 39 | float, 40 | double, 41 | 42 | boolean: void, 43 | 44 | object: []const u8, 45 | array: *const Descriptor, 46 | method: MethodDescriptor, 47 | 48 | /// Only valid for method `return_type`s 49 | void: void, 50 | 51 | pub fn stringify(self: Self, writer: anytype) anyerror!void { 52 | switch (self) { 53 | .byte => try writer.writeByte('B'), 54 | .char => try writer.writeByte('C'), 55 | 56 | .int => try writer.writeByte('I'), 57 | .long => try writer.writeByte('J'), 58 | .short => try writer.writeByte('S'), 59 | 60 | .float => try writer.writeByte('F'), 61 | .double => try writer.writeByte('D'), 62 | 63 | .boolean => try writer.writeByte('Z'), 64 | .void => try writer.writeByte('V'), 65 | 66 | .object => |o| try writer.print("L{s};", .{o}), 67 | .array => |a| { 68 | try writer.writeByte('['); 69 | try a.stringify(writer); 70 | }, 71 | .method => |m| try m.stringify(writer), 72 | } 73 | } 74 | 75 | pub fn toStringArrayList(self: Self, buf: *std.ArrayList(u8)) !void { 76 | try buf.ensureCapacity(0); 77 | try self.stringify(buf.writer()); 78 | } 79 | 80 | pub fn humanStringify(self: Self, writer: anytype) anyerror!void { 81 | try switch (self) { 82 | .byte => _ = try writer.writeAll("byte"), 83 | .char => _ = try writer.writeAll("char"), 84 | 85 | .int => _ = try writer.writeAll("int"), 86 | .long => _ = try writer.writeAll("long"), 87 | .short => _ = try writer.writeAll("short"), 88 | 89 | .float => _ = try writer.writeAll("float"), 90 | .double => _ = try writer.writeAll("double"), 91 | 92 | .boolean => _ = try writer.writeAll("boolean"), 93 | .void => _ = try writer.writeAll("void"), 94 | 95 | .object => |o| { 96 | var i: usize = 0; 97 | var tc = std.mem.count(u8, o, "/"); 98 | var t = std.mem.tokenize(u8, o, "/"); 99 | while (t.next()) |z| : (i += 1) { 100 | _ = try writer.writeAll(z); 101 | if (i != tc) try writer.writeByte('.'); 102 | } 103 | }, 104 | .array => |a| { 105 | try a.humanStringify(writer); 106 | _ = try writer.writeAll("[]"); 107 | }, 108 | .method => error.NotImplemented, 109 | }; 110 | } 111 | 112 | pub fn toHumanStringArrayList(self: Self, buf: *std.ArrayList(u8)) !void { 113 | try buf.ensureCapacity(0); 114 | try self.humanStringify(buf.writer()); 115 | } 116 | 117 | pub fn humanStringifyConst(self: Self) ![]const u8{ 118 | return switch (self) { 119 | .byte => "byte", 120 | .char => "char", 121 | .int => "int", 122 | .short => "short", 123 | .long => "long", 124 | .float => "float", 125 | .double => "double", 126 | .boolean => "boolean", 127 | .void => "void", 128 | .object => "object", 129 | .array => "array", 130 | .method => "method", 131 | }; 132 | } 133 | 134 | pub fn deinit(self: *const Self, allocator: std.mem.Allocator) void { 135 | switch (self.*) { 136 | .object => |*o| allocator.free(o.*), 137 | .array => |*a| a.*.deinit(allocator), 138 | .method => |*m| m.*.deinit(allocator), 139 | 140 | else => {}, 141 | } 142 | allocator.destroy(self); 143 | } 144 | }; 145 | 146 | fn c(allocator: std.mem.Allocator, d: Descriptor) !*Descriptor { 147 | var x = try allocator.create(Descriptor); 148 | x.* = d; 149 | return x; 150 | } 151 | 152 | fn parse_(allocator: std.mem.Allocator, reader: anytype) anyerror!?*Descriptor { 153 | var kind = try reader.readByte(); 154 | switch (kind) { 155 | 'B' => return try c(allocator, .byte), 156 | 'C' => return try c(allocator, .char), 157 | 158 | 'I' => return try c(allocator, .int), 159 | 'J' => return try c(allocator, .long), 160 | 'S' => return try c(allocator, .short), 161 | 162 | 'F' => return try c(allocator, .float), 163 | 'D' => return try c(allocator, .double), 164 | 165 | 'Z' => return try c(allocator, .boolean), 166 | 167 | 'V' => return try c(allocator, .void), 168 | 169 | 'L' => { 170 | var x = try allocator.create(Descriptor); 171 | x.* = .{ .object = try reader.readUntilDelimiterAlloc(allocator, ';', 256) }; 172 | return x; 173 | }, 174 | '[' => { 175 | var x = try allocator.create(Descriptor); 176 | x.* = .{ .array = try parse(allocator, reader) }; 177 | return x; 178 | }, 179 | '(' => { 180 | var params = std.ArrayList(*Descriptor).init(allocator); 181 | defer params.deinit(); 182 | 183 | while (try parse_(allocator, reader)) |k| { 184 | try params.append(k); 185 | } 186 | 187 | var returnd = (try parse_(allocator, reader)).?; 188 | 189 | var x = try allocator.create(Descriptor); 190 | x.* = if (jui.is_zig_master) .{ 191 | .method = .{ 192 | .parameters = try params.toOwnedSlice(), 193 | .return_type = returnd, 194 | }, 195 | } else .{ 196 | .method = .{ 197 | .parameters = params.toOwnedSlice(), 198 | .return_type = returnd, 199 | }, 200 | }; 201 | return x; 202 | }, 203 | ')' => return null, 204 | 205 | else => unreachable, 206 | } 207 | } 208 | 209 | pub fn parse(allocator: std.mem.Allocator, reader: anytype) anyerror!*Descriptor { 210 | return (try parse_(allocator, reader)).?; 211 | } 212 | 213 | pub fn parseString(allocator: std.mem.Allocator, string: []const u8) !*Descriptor { 214 | var fbs = std.io.fixedBufferStream(string); 215 | return parse(allocator, fbs.reader()); 216 | } 217 | 218 | test "Descriptors: Write/parse 3D array of objects" { 219 | var test_string = "[[[Ljava/lang/Object;"; 220 | 221 | var object = Descriptor{ .object = "java/lang/Object" }; 222 | var array1 = Descriptor{ .array = &object }; 223 | var array2 = Descriptor{ .array = &array1 }; 224 | var desc = Descriptor{ .array = &array2 }; 225 | 226 | var out_buf = std.ArrayList(u8).init(std.testing.allocator); 227 | defer out_buf.deinit(); 228 | 229 | try desc.stringify(out_buf.writer()); 230 | try std.testing.expectEqualStrings(test_string, out_buf.items); 231 | 232 | var fbs = std.io.fixedBufferStream(test_string); 233 | var parsed_desc = try parse(std.testing.allocator, fbs.reader()); 234 | defer parsed_desc.deinit(std.testing.allocator); 235 | 236 | out_buf.shrinkRetainingCapacity(0); 237 | try parsed_desc.stringify(out_buf.writer()); 238 | try std.testing.expectEqualStrings(test_string, out_buf.items); 239 | } 240 | 241 | test "Descriptors: Write/parse method that returns an object and accepts an integer, double, and Thread" { 242 | var test_string = "(IDLjava/lang/Thread;)Ljava/lang/Object;"; 243 | 244 | var int = Descriptor{ .int = {} }; 245 | var double = Descriptor{ .double = {} }; 246 | var thread = Descriptor{ .object = "java/lang/Thread" }; 247 | 248 | var object = Descriptor{ .object = "java/lang/Object" }; 249 | 250 | var desc = Descriptor{ .method = .{ .parameters = &[_]*Descriptor{ &int, &double, &thread }, .return_type = &object } }; 251 | 252 | var out_buf = std.ArrayList(u8).init(std.testing.allocator); 253 | defer out_buf.deinit(); 254 | 255 | try desc.stringify(out_buf.writer()); 256 | try std.testing.expectEqualStrings(test_string, out_buf.items); 257 | 258 | var fbs = std.io.fixedBufferStream(test_string); 259 | var parsed_desc = try parse(std.testing.allocator, fbs.reader()); 260 | defer parsed_desc.deinit(std.testing.allocator); 261 | 262 | out_buf.shrinkRetainingCapacity(0); 263 | try parsed_desc.stringify(out_buf.writer()); 264 | try std.testing.expectEqualStrings(test_string, out_buf.items); 265 | } 266 | -------------------------------------------------------------------------------- /examples/guessing-game/gen/java/io/InputStream.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const jui = @import("jui"); 3 | /// Opaque type corresponding to java/io/InputStream 4 | pub const InputStream = opaque { 5 | const classpath = "java/io/InputStream"; 6 | var class_global: jui.jclass = null; 7 | var fields: struct { 8 | @"MAX_SKIP_BUFFER_SIZE_I": jui.jfieldID, 9 | @"DEFAULT_BUFFER_SIZE_I": jui.jfieldID, 10 | @"MAX_BUFFER_SIZE_I": jui.jfieldID, 11 | } = undefined; 12 | var methods: struct { 13 | @"()V": jui.jmethodID, 14 | @"nullInputStream()Ljava/io/InputStream;": jui.jmethodID, 15 | @"read()I": jui.jmethodID, 16 | @"read([B)I": jui.jmethodID, 17 | @"read([BII)I": jui.jmethodID, 18 | @"readAllBytes()[B": jui.jmethodID, 19 | @"readNBytes(I)[B": jui.jmethodID, 20 | @"readNBytes([BII)I": jui.jmethodID, 21 | @"skip(J)J": jui.jmethodID, 22 | @"skipNBytes(J)V": jui.jmethodID, 23 | @"available()I": jui.jmethodID, 24 | @"close()V": jui.jmethodID, 25 | @"mark(I)V": jui.jmethodID, 26 | @"reset()V": jui.jmethodID, 27 | @"markSupported()Z": jui.jmethodID, 28 | @"transferTo(Ljava/io/OutputStream;)J": jui.jmethodID, 29 | } = undefined; 30 | pub fn load(env: *jui.JNIEnv) !void { 31 | struct { 32 | var runner = std.once(_runner); 33 | var _env: *jui.JNIEnv = undefined; 34 | var _err: ?Error = null; 35 | 36 | const Error = 37 | jui.JNIEnv.FindClassError || 38 | jui.JNIEnv.NewReferenceError || 39 | jui.JNIEnv.GetFieldIdError || 40 | jui.JNIEnv.GetMethodIdError || 41 | jui.JNIEnv.GetStaticFieldIdError || 42 | jui.JNIEnv.GetStaticMethodIdError; 43 | 44 | fn _load(arg: *jui.JNIEnv) !void { 45 | _env = arg; 46 | runner.call(); 47 | if (_err) |e| return e; 48 | } 49 | 50 | fn _runner() void { 51 | _run(_env) catch |e| { _err = e; }; 52 | } 53 | 54 | fn _run(inner_env: *jui.JNIEnv) !void { 55 | const class_local = try inner_env.findClass(classpath); 56 | class_global = try inner_env.newReference(.global, class_local); 57 | const class = class_global orelse return error.NoClassDefFoundError; 58 | // 59 | fields = .{ 60 | .@"MAX_SKIP_BUFFER_SIZE_I" = try inner_env.getStaticFieldId(class, "MAX_SKIP_BUFFER_SIZE", "I"), 61 | .@"DEFAULT_BUFFER_SIZE_I" = try inner_env.getStaticFieldId(class, "DEFAULT_BUFFER_SIZE", "I"), 62 | .@"MAX_BUFFER_SIZE_I" = try inner_env.getStaticFieldId(class, "MAX_BUFFER_SIZE", "I"), 63 | }; 64 | methods = .{ 65 | .@"()V" = try inner_env.getMethodId(class, "", "()V"), 66 | .@"nullInputStream()Ljava/io/InputStream;" = try inner_env.getStaticMethodId(class, "nullInputStream", "()Ljava/io/InputStream;"), 67 | .@"read()I" = try inner_env.getMethodId(class, "read", "()I"), 68 | .@"read([B)I" = try inner_env.getMethodId(class, "read", "([B)I"), 69 | .@"read([BII)I" = try inner_env.getMethodId(class, "read", "([BII)I"), 70 | .@"readAllBytes()[B" = try inner_env.getMethodId(class, "readAllBytes", "()[B"), 71 | .@"readNBytes(I)[B" = try inner_env.getMethodId(class, "readNBytes", "(I)[B"), 72 | .@"readNBytes([BII)I" = try inner_env.getMethodId(class, "readNBytes", "([BII)I"), 73 | .@"skip(J)J" = try inner_env.getMethodId(class, "skip", "(J)J"), 74 | .@"skipNBytes(J)V" = try inner_env.getMethodId(class, "skipNBytes", "(J)V"), 75 | .@"available()I" = try inner_env.getMethodId(class, "available", "()I"), 76 | .@"close()V" = try inner_env.getMethodId(class, "close", "()V"), 77 | .@"mark(I)V" = try inner_env.getMethodId(class, "mark", "(I)V"), 78 | .@"reset()V" = try inner_env.getMethodId(class, "reset", "()V"), 79 | .@"markSupported()Z" = try inner_env.getMethodId(class, "markSupported", "()Z"), 80 | .@"transferTo(Ljava/io/OutputStream;)J" = try inner_env.getMethodId(class, "transferTo", "(Ljava/io/OutputStream;)J"), 81 | }; 82 | 83 | } 84 | }._load(env) catch |e| return e; 85 | } 86 | pub fn @"get_MAX_SKIP_BUFFER_SIZE_I"(env: *jui.JNIEnv) !jui.jint { 87 | try load(env); 88 | const class = class_global orelse return error.ClassNotFound; 89 | return env.getStaticField(.int, class, fields.@"MAX_SKIP_BUFFER_SIZE_I"); 90 | } 91 | pub fn @"get_DEFAULT_BUFFER_SIZE_I"(env: *jui.JNIEnv) !jui.jint { 92 | try load(env); 93 | const class = class_global orelse return error.ClassNotFound; 94 | return env.getStaticField(.int, class, fields.@"DEFAULT_BUFFER_SIZE_I"); 95 | } 96 | pub fn @"get_MAX_BUFFER_SIZE_I"(env: *jui.JNIEnv) !jui.jint { 97 | try load(env); 98 | const class = class_global orelse return error.ClassNotFound; 99 | return env.getStaticField(.int, class, fields.@"MAX_BUFFER_SIZE_I"); 100 | } 101 | pub fn @"()V"(env: *jui.JNIEnv) !*@This() { 102 | try load(env); 103 | const class = class_global orelse return error.ClassNotLoaded; 104 | return @ptrCast(*@This(), try env.newObject(class, methods.@"()V", null)); 105 | } 106 | pub fn @"nullInputStream()Ljava/io/InputStream;"(env: *jui.JNIEnv) !jui.jobject { 107 | try load(env); 108 | const class = class_global orelse return error.ClassNotFound; 109 | return env.callStaticMethod(.object, class, methods.@"nullInputStream()Ljava/io/InputStream;", null); 110 | } 111 | pub fn @"read()I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 112 | try load(env); 113 | _ = class_global orelse return error.ClassNotFound; 114 | return env.callMethod(.int, self, methods.@"read()I", null); 115 | } 116 | pub fn @"read([B)I"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray) !jui.jint { 117 | try load(env); 118 | _ = class_global orelse return error.ClassNotFound; 119 | return env.callMethod(.int, self, methods.@"read([B)I", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 120 | } 121 | pub fn @"read([BII)I"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray, arg1: jui.jint, arg2: jui.jint) !jui.jint { 122 | try load(env); 123 | _ = class_global orelse return error.ClassNotFound; 124 | return env.callMethod(.int, self, methods.@"read([BII)I", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)}); 125 | } 126 | pub fn @"readAllBytes()[B"(self: *@This(), env: *jui.JNIEnv) !jui.jarray { 127 | try load(env); 128 | _ = class_global orelse return error.ClassNotFound; 129 | return env.callMethod(.array, self, methods.@"readAllBytes()[B", null); 130 | } 131 | pub fn @"readNBytes(I)[B"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jarray { 132 | try load(env); 133 | _ = class_global orelse return error.ClassNotFound; 134 | return env.callMethod(.array, self, methods.@"readNBytes(I)[B", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 135 | } 136 | pub fn @"readNBytes([BII)I"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray, arg1: jui.jint, arg2: jui.jint) !jui.jint { 137 | try load(env); 138 | _ = class_global orelse return error.ClassNotFound; 139 | return env.callMethod(.int, self, methods.@"readNBytes([BII)I", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)}); 140 | } 141 | pub fn @"skip(J)J"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jlong) !jui.jlong { 142 | try load(env); 143 | _ = class_global orelse return error.ClassNotFound; 144 | return env.callMethod(.long, self, methods.@"skip(J)J", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 145 | } 146 | pub fn @"skipNBytes(J)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jlong) !void { 147 | try load(env); 148 | _ = class_global orelse return error.ClassNotFound; 149 | return env.callMethod(.void, self, methods.@"skipNBytes(J)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 150 | } 151 | pub fn @"available()I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 152 | try load(env); 153 | _ = class_global orelse return error.ClassNotFound; 154 | return env.callMethod(.int, self, methods.@"available()I", null); 155 | } 156 | pub fn @"close()V"(self: *@This(), env: *jui.JNIEnv) !void { 157 | try load(env); 158 | _ = class_global orelse return error.ClassNotFound; 159 | return env.callMethod(.void, self, methods.@"close()V", null); 160 | } 161 | pub fn @"mark(I)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !void { 162 | try load(env); 163 | _ = class_global orelse return error.ClassNotFound; 164 | return env.callMethod(.void, self, methods.@"mark(I)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 165 | } 166 | pub fn @"reset()V"(self: *@This(), env: *jui.JNIEnv) !void { 167 | try load(env); 168 | _ = class_global orelse return error.ClassNotFound; 169 | return env.callMethod(.void, self, methods.@"reset()V", null); 170 | } 171 | pub fn @"markSupported()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 172 | try load(env); 173 | _ = class_global orelse return error.ClassNotFound; 174 | return env.callMethod(.boolean, self, methods.@"markSupported()Z", null); 175 | } 176 | pub fn @"transferTo(Ljava/io/OutputStream;)J"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jlong { 177 | try load(env); 178 | _ = class_global orelse return error.ClassNotFound; 179 | return env.callMethod(.long, self, methods.@"transferTo(Ljava/io/OutputStream;)J", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 180 | } 181 | 182 | }; 183 | -------------------------------------------------------------------------------- /src/Reflector.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const types = @import("types.zig"); 3 | const descriptors = @import("descriptors.zig"); 4 | 5 | const Reflector = @This(); 6 | 7 | allocator: std.mem.Allocator, 8 | env: *types.JNIEnv, 9 | 10 | pub fn init(allocator: std.mem.Allocator, env: *types.JNIEnv) Reflector { 11 | return .{ .allocator = allocator, .env = env }; 12 | } 13 | 14 | pub fn getClass(self: *Reflector, name: [*:0]const u8) !Class { 15 | return Class.init(self, try self.env.newReference(.global, try self.env.findClass(name))); 16 | } 17 | 18 | pub fn ObjectType(comptime name_: []const u8) type { 19 | return struct { 20 | pub const object_class_name = name_; 21 | }; 22 | } 23 | 24 | pub const StringChars = union(enum) { 25 | utf8: [:0]const u8, 26 | unicode: []const u16, 27 | }; 28 | 29 | pub const String = struct { 30 | const Self = @This(); 31 | const object_class_name = "java/lang/String"; 32 | 33 | reflector: *Reflector, 34 | chars: StringChars, 35 | string: types.jstring, 36 | 37 | pub fn init(reflector: *Reflector, chars: StringChars) !Self { 38 | var string = try switch (chars) { 39 | .utf8 => |buf| reflector.env.newStringUTF(@ptrCast([*:0]const u8, buf)), 40 | .unicode => |buf| reflector.env.newString(buf), 41 | }; 42 | 43 | return Self{ .reflector = reflector, .chars = chars, .string = string }; 44 | } 45 | 46 | /// Only use when a string is `get`-ed 47 | /// Tells the JVM that the string you've obtained is no longer being used 48 | pub fn release(self: Self) void { 49 | switch (self.chars) { 50 | .utf8 => |buf| self.reflector.env.releaseStringUTFChars(self.string, @ptrCast([*]const u8, buf)), 51 | .unicode => |buf| self.reflector.env.releaseStringChars(self.string, @ptrCast([*]const u16, buf)), 52 | } 53 | } 54 | 55 | pub fn toJValue(self: Self) types.jvalue { 56 | return .{ .l = self.string }; 57 | } 58 | 59 | pub fn fromObject(reflector: *Reflector, object: types.jobject) !Self { 60 | var chars_len = reflector.env.getStringUTFLength(object); 61 | var chars_ret = try reflector.env.getStringUTFChars(object); 62 | 63 | return Self{ .reflector = reflector, .chars = .{ .utf8 = std.meta.assumeSentinel(chars_ret.chars[0..@intCast(usize, chars_len)], 0) }, .string = object }; 64 | } 65 | 66 | pub fn fromJValue(reflector: *Reflector, value: types.jvalue) !Self { 67 | return fromObject(reflector, value.l); 68 | } 69 | }; 70 | 71 | fn valueToDescriptor(comptime T: type) descriptors.Descriptor { 72 | if (@typeInfo(T) == .Struct and @hasDecl(T, "object_class_name")) { 73 | return .{ .object = @field(T, "object_class_name") }; 74 | } 75 | 76 | return switch (T) { 77 | types.jint => .int, 78 | void => .void, 79 | else => @compileError("Unsupported type: " ++ @typeName(T)), 80 | }; 81 | } 82 | 83 | fn funcToMethodDescriptor(comptime func: type) descriptors.MethodDescriptor { 84 | const Fn = @typeInfo(func).Fn; 85 | var parameters: [Fn.args.len]descriptors.Descriptor = undefined; 86 | 87 | inline for (Fn.args) |param, u| { 88 | parameters[u] = valueToDescriptor(param.arg_type.?); 89 | } 90 | 91 | return .{ 92 | .parameters = ¶meters, 93 | .return_type = &valueToDescriptor(Fn.return_type.?), 94 | }; 95 | } 96 | 97 | fn sm(comptime func: type) type { 98 | return StaticMethod(funcToMethodDescriptor(func)); 99 | } 100 | 101 | fn nsm(comptime func: type) type { 102 | return Method(funcToMethodDescriptor(func)); 103 | } 104 | 105 | fn cnsm(comptime func: type) type { 106 | return Constructor(funcToMethodDescriptor(func)); 107 | } 108 | 109 | pub const Object = struct { 110 | const Self = @This(); 111 | 112 | class: *Class, 113 | object: types.jobject, 114 | 115 | pub fn init(class: *Class, object: types.jobject) Self { 116 | return .{ .class = class, .object = object }; 117 | } 118 | }; 119 | 120 | pub const Class = struct { 121 | const Self = @This(); 122 | 123 | reflector: *Reflector, 124 | class: types.jclass, 125 | 126 | pub fn init(reflector: *Reflector, class: types.jclass) Self { 127 | return .{ .reflector = reflector, .class = class }; 128 | } 129 | 130 | /// Creates an instance of the current class without invoking constructors 131 | pub fn create(self: *Self) !Object { 132 | return Object.init(self, try self.reflector.env.allocObject(self.class)); 133 | } 134 | 135 | pub fn getConstructor(self: *Self, comptime func: type) !cnsm(func) { 136 | return try self.getConstructor_(cnsm(func)); 137 | } 138 | 139 | fn getConstructor_(self: *Self, comptime T: type) !T { 140 | var buf = std.ArrayList(u8).init(self.reflector.allocator); 141 | defer buf.deinit(); 142 | 143 | try @field(T, "descriptor_").toStringArrayList(&buf); 144 | try buf.append(0); 145 | 146 | return T{ .class = self, .method_id = try self.reflector.env.getMethodId(self.class, "", @ptrCast([*:0]const u8, buf.items)) }; 147 | } 148 | 149 | pub fn getMethod(self: *Self, name: [*:0]const u8, comptime func: type) !nsm(func) { 150 | return try self.getMethod_(nsm(func), name); 151 | } 152 | 153 | fn getMethod_(self: *Self, comptime T: type, name: [*:0]const u8) !T { 154 | var buf = std.ArrayList(u8).init(self.reflector.allocator); 155 | defer buf.deinit(); 156 | 157 | try @field(T, "descriptor_").toStringArrayList(&buf); 158 | try buf.append(0); 159 | 160 | return T{ .class = self, .method_id = try self.reflector.env.getMethodId(self.class, name, @ptrCast([*:0]const u8, buf.items)) }; 161 | } 162 | 163 | pub fn getStaticMethod(self: *Self, name: [*:0]const u8, comptime func: type) !sm(func) { 164 | return try self.getStaticMethod_(sm(func), name); 165 | } 166 | 167 | fn getStaticMethod_(self: *Self, comptime T: type, name: [*:0]const u8) !T { 168 | var buf = std.ArrayList(u8).init(self.reflector.allocator); 169 | defer buf.deinit(); 170 | 171 | try @field(T, "descriptor_").toStringArrayList(&buf); 172 | try buf.append(0); 173 | 174 | return T{ .class = self, .method_id = try self.reflector.env.getStaticMethodId(self.class, name, @ptrCast([*:0]const u8, buf.items)) }; 175 | } 176 | }; 177 | 178 | fn MapDescriptorLowLevelType(comptime value: *const descriptors.Descriptor) type { 179 | return switch (value.*) { 180 | .byte => types.jbyte, 181 | .char => types.jchar, 182 | 183 | .int => types.jint, 184 | .long => types.jlong, 185 | .short => types.jshort, 186 | 187 | .float => types.jfloat, 188 | .double => types.jdouble, 189 | 190 | .boolean => types.jboolean, 191 | .void => void, 192 | 193 | .object => types.jobject, 194 | .array => types.jarray, 195 | .method => unreachable, 196 | }; 197 | } 198 | 199 | fn MapDescriptorType(comptime value: *const descriptors.Descriptor) type { 200 | return switch (value.*) { 201 | .byte => types.jbyte, 202 | .char => types.jchar, 203 | 204 | .int => types.jint, 205 | .long => types.jlong, 206 | .short => types.jshort, 207 | 208 | .float => types.jfloat, 209 | .double => types.jdouble, 210 | 211 | .boolean => types.jboolean, 212 | .void => void, 213 | 214 | .object => |name| if (std.mem.eql(u8, name, "java/lang/String")) 215 | String 216 | else 217 | types.jobject, 218 | .array => types.jarray, 219 | .method => unreachable, 220 | }; 221 | } 222 | 223 | fn MapDescriptorToNativeTypeEnum(comptime value: *const descriptors.Descriptor) types.NativeType { 224 | return switch (value.*) { 225 | .byte => .byte, 226 | .char => .char, 227 | 228 | .int => .int, 229 | .long => .long, 230 | .short => .short, 231 | 232 | .float => .float, 233 | .double => .double, 234 | 235 | .boolean => .boolean, 236 | 237 | .object, .array => .object, 238 | .void => .void, 239 | .method => unreachable, 240 | }; 241 | } 242 | 243 | fn ArgsFromDescriptor(comptime descriptor: *const descriptors.MethodDescriptor) type { 244 | var Ts: [descriptor.parameters.len]type = undefined; 245 | for (descriptor.parameters) |param, i| Ts[i] = MapDescriptorType(¶m); 246 | return std.meta.Tuple(&Ts); 247 | } 248 | 249 | pub fn Constructor(comptime descriptor: descriptors.MethodDescriptor) type { 250 | return struct { 251 | const Self = @This(); 252 | pub const descriptor_ = descriptor; 253 | 254 | class: *Class, 255 | method_id: types.jmethodID, 256 | 257 | pub fn call(self: Self, args: ArgsFromDescriptor(&descriptor)) !Object { 258 | var processed_args: [args.len]types.jvalue = undefined; 259 | comptime var index: usize = 0; 260 | inline while (index < args.len) : (index += 1) { 261 | processed_args[index] = types.jvalue.toJValue(args[index]); 262 | } 263 | 264 | return Object.init(self.class, try self.callJValues(&processed_args)); 265 | } 266 | 267 | pub fn callJValues(self: Self, args: []types.jvalue) types.JNIEnv.NewObjectError!types.jobject { 268 | return self.class.reflector.env.newObject(self.class.class, self.method_id, if (args.len == 0) null else @ptrCast([*]types.jvalue, args)); 269 | } 270 | }; 271 | } 272 | 273 | pub fn Method(descriptor: descriptors.MethodDescriptor) type { 274 | return struct { 275 | const Self = @This(); 276 | pub const descriptor_ = descriptor; 277 | 278 | class: *Class, 279 | method_id: types.jmethodID, 280 | 281 | pub fn call(self: Self, object: Object, args: ArgsFromDescriptor(&descriptor)) !MapDescriptorType(descriptor.return_type) { 282 | var processed_args: [args.len]types.jvalue = undefined; 283 | comptime var index: usize = 0; 284 | inline while (index < args.len) : (index += 1) { 285 | processed_args[index] = types.jvalue.toJValue(args[index]); 286 | } 287 | 288 | var ret = try self.callJValues(object.object, &processed_args); 289 | const mdt = MapDescriptorType(descriptor.return_type); 290 | return if (@typeInfo(mdt) == .Struct and @hasDecl(mdt, "fromJValue")) @field(mdt, "fromJValue")(self.class.reflector, .{ .l = ret }) else ret; 291 | } 292 | 293 | pub fn callJValues(self: Self, object: types.jobject, args: []types.jvalue) types.JNIEnv.CallStaticMethodError!MapDescriptorLowLevelType(descriptor.return_type) { 294 | return self.class.reflector.env.callMethod(comptime MapDescriptorToNativeTypeEnum(descriptor.return_type), object, self.method_id, if (args.len == 0) null else @ptrCast([*]types.jvalue, args)); 295 | } 296 | }; 297 | } 298 | 299 | pub fn StaticMethod(descriptor: descriptors.MethodDescriptor) type { 300 | return struct { 301 | const Self = @This(); 302 | const descriptor_ = descriptor; 303 | 304 | class: *Class, 305 | method_id: types.jmethodID, 306 | 307 | pub fn call(self: Self, args: ArgsFromDescriptor(&descriptor)) !MapDescriptorType(descriptor.return_type) { 308 | var processed_args: [args.len]types.jvalue = undefined; 309 | comptime var index: usize = 0; 310 | inline while (index < args.len) : (index += 1) { 311 | processed_args[index] = types.jvalue.toJValue(args[index]); 312 | } 313 | 314 | var ret = try self.callJValues(&processed_args); 315 | const mdt = MapDescriptorType(descriptor.return_type); 316 | return if (@typeInfo(mdt) == .Struct and @hasDecl(mdt, "fromJValue")) @field(mdt, "fromJValue")(self.class.reflector, .{ .l = ret }) else ret; 317 | } 318 | 319 | pub fn callJValues(self: Self, args: []types.jvalue) types.JNIEnv.CallStaticMethodError!MapDescriptorLowLevelType(descriptor.return_type) { 320 | return self.class.reflector.env.callStaticMethod(comptime MapDescriptorToNativeTypeEnum(descriptor.return_type), self.class.class, self.method_id, if (args.len == 0) null else @ptrCast([*]types.jvalue, args)); 321 | } 322 | }; 323 | } 324 | -------------------------------------------------------------------------------- /tools/class2zig.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const jui = @import("jui"); 3 | const cf = @import("cf"); 4 | const ClassFile = @import("cf").ClassFile; 5 | 6 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; 7 | 8 | pub fn main() !void { 9 | const allocator = gpa.allocator(); 10 | const stdout = std.io.getStdOut(); 11 | const cwd = std.fs.cwd(); 12 | 13 | // Handle cli 14 | const args = try std.process.argsAlloc(allocator); 15 | defer std.process.argsFree(allocator, args); 16 | 17 | const arg_class_in = args[1]; 18 | const arg_out_dir = args[2]; 19 | 20 | // Open class file 21 | var class_file: ClassFile = undefined; 22 | { 23 | const file = try cwd.openFile(arg_class_in, .{}); 24 | const reader = file.reader(); 25 | 26 | class_file = try ClassFile.decode(allocator, reader); 27 | } 28 | defer class_file.deinit(); 29 | 30 | const out = try cwd.makeOpenPath(arg_out_dir, .{}); 31 | 32 | var arena = std.heap.ArenaAllocator.init(allocator); 33 | defer arena.deinit(); 34 | 35 | var arena_alloc = arena.allocator(); 36 | // Generate zig bindings 37 | { 38 | const class = class_file.constant_pool.get(class_file.this_class).class; 39 | const classpath = class_file.constant_pool.get(class.name_index).utf8.bytes; 40 | const classname = std.fs.path.basename(classpath); 41 | const dirname = std.fs.path.dirname(classpath) orelse ""; 42 | const zig_filename = try std.fmt.allocPrint(arena_alloc, "{s}.zig", .{classname}); 43 | 44 | const class_dir = try out.makeOpenPath(dirname, .{}); 45 | const zig_file = try class_dir.createFile(zig_filename, .{}); 46 | 47 | // Write Declarations 48 | 49 | var field_decls = std.ArrayList(u8).init(arena_alloc); 50 | defer field_decls.deinit(); 51 | 52 | try writeFieldDecls(class_file.fields.items, field_decls.writer()); 53 | 54 | var method_decls = std.ArrayList(u8).init(arena_alloc); 55 | defer method_decls.deinit(); 56 | 57 | try writeMethodDecls(class_file.methods.items, method_decls.writer()); 58 | 59 | // Sort methods 60 | 61 | var constructor_overloads = std.ArrayList(cf.MethodInfo).init(arena_alloc); 62 | var method_overloads = std.StringHashMap(std.ArrayList(cf.MethodInfo)).init(arena_alloc); 63 | var static_method_overloads = std.StringHashMap(std.ArrayList(cf.MethodInfo)).init(arena_alloc); 64 | 65 | for (class_file.methods.items) |method| { 66 | const name = method.getName().bytes; 67 | if (std.mem.eql(u8, name, "")) { 68 | try constructor_overloads.append(method); 69 | continue; 70 | } 71 | if (method.access_flags.static) { 72 | const entry = try static_method_overloads.getOrPut(name); 73 | if (!entry.found_existing) entry.value_ptr.* = std.ArrayList(cf.MethodInfo).init(arena_alloc); 74 | try entry.value_ptr.*.append(method); 75 | continue; 76 | } 77 | const entry = try method_overloads.getOrPut(name); 78 | if (!entry.found_existing) entry.value_ptr.* = std.ArrayList(cf.MethodInfo).init(arena_alloc); 79 | try entry.value_ptr.*.append(method); 80 | } 81 | 82 | std.log.info("Found {} constructors", .{ 83 | constructor_overloads.items.len, 84 | }); 85 | 86 | // Write methods 87 | 88 | var constructors = std.ArrayList(u8).init(arena_alloc); 89 | defer constructors.deinit(); 90 | 91 | try writeConstructors(constructor_overloads.items, constructors.writer()); 92 | 93 | var static_method_accessors = std.ArrayList(u8).init(arena_alloc); 94 | defer static_method_accessors.deinit(); 95 | 96 | { 97 | var iter = static_method_overloads.iterator(); 98 | while (iter.next()) |entry| { 99 | try writeStaticMethod(entry.key_ptr.*, entry.value_ptr.*.items, arena_alloc, static_method_accessors.writer()); 100 | } 101 | } 102 | 103 | var method_accessors = std.ArrayList(u8).init(arena_alloc); 104 | defer method_accessors.deinit(); 105 | 106 | // Write field accessors 107 | 108 | var static_field_accessors = std.ArrayList(u8).init(arena_alloc); 109 | defer static_field_accessors.deinit(); 110 | 111 | try writeStaticFieldAccessors(class_file.fields.items, arena_alloc, static_field_accessors.writer()); 112 | 113 | var field_accessors = std.ArrayList(u8).init(arena_alloc); 114 | defer field_accessors.deinit(); 115 | 116 | try writeFieldAccessors(class_file.fields.items, arena_alloc, field_accessors.writer()); 117 | 118 | // Write to file 119 | const writer = zig_file.writer(); 120 | try writer.print( 121 | \\const std = @import("std"); 122 | \\const jui = @import("jui"); 123 | \\ 124 | \\const {[classname]s} = struct {{ 125 | \\ const Instance = @This(); 126 | \\ pub const Class = struct {{ 127 | \\ fields: struct {{ {[field_decls]s} }}, 128 | \\ methods: struct {{ {[method_decls]s} }}, 129 | \\ class: jui.jclass, 130 | \\ const classpath = "{[classpath]s}"; 131 | \\ pub fn load(env: *jui.JNIEnv) !@This() {{ 132 | \\ const class_local = try env.findClass(classpath); 133 | \\ const class = try env.newReference(.global, class_local); 134 | \\ return @This(){{ 135 | \\ .fields = .{{}}, 136 | \\ .methods = .{{}}, 137 | \\ .class = class, 138 | \\ }}; 139 | \\ }} 140 | \\ {[constructors]s} 141 | \\ {[static_field_accessors]s} 142 | \\ {[static_method_accessors]s} 143 | \\ }}; 144 | \\ 145 | \\ class: *Class, 146 | \\ object: jui.jobject, 147 | \\ 148 | \\ {[field_accessors]s} 149 | \\ {[method_accessors]s} 150 | \\}}; 151 | \\comptime {{ 152 | \\ std.testing.refAllDecls({[classname]s}); 153 | \\ std.testing.refAllDecls({[classname]s}.Class); 154 | \\}} 155 | , .{ 156 | .classname = classname, 157 | .classpath = classpath, 158 | .field_decls = field_decls.items, 159 | .method_decls = method_decls.items, 160 | .constructors = constructors.items, 161 | .static_field_accessors = static_field_accessors.items, 162 | .static_method_accessors = static_method_accessors.items, 163 | .field_accessors = field_accessors.items, 164 | .method_accessors = method_accessors.items, 165 | }); 166 | 167 | _ = try std.fmt.format(stdout.writer(), "Successfully wrote {s}\n", .{classpath}); 168 | } 169 | } 170 | 171 | fn writeFieldDecls(fields: []cf.FieldInfo, writer: anytype) !void { 172 | if (fields.len > 0) { 173 | try writer.writeAll("\n"); 174 | for (fields) |field| { 175 | const name = field.getName().bytes; 176 | const descriptor = field.getDescriptor().bytes; 177 | try std.fmt.format(writer, " @\"{s}_{s}\": ?jui.jfieldID,\n", .{ name, descriptor }); 178 | } 179 | try writer.writeAll(" "); 180 | } 181 | } 182 | 183 | fn writeStaticFieldAccessors(fields: []cf.FieldInfo, allocator: std.mem.Allocator, writer: anytype) !void { 184 | if (fields.len > 0) { 185 | try writer.writeAll("\n"); 186 | for (fields) |field| { 187 | if (!field.access_flags.static or field.access_flags.protected or field.access_flags.private) continue; 188 | const name = field.getName().bytes; 189 | const descriptor = field.getDescriptor().bytes; 190 | var descriptor_info = try jui.descriptors.parseString(allocator, descriptor); 191 | try std.fmt.format(writer, 192 | \\ pub fn {[name]s}(self: @This(), env: *jui.JNIEnv) !*{[return_type]s} {{ 193 | \\ const field_id = self.fields.@"{[name]s}{[descriptor]s}" orelse field_id: {{ 194 | \\ self.fields.@"{[name]s}{[descriptor]s}" = try env.getFieldId(self.class, "{[name]s}", "{[descriptor]s}"); 195 | \\ break :field_id self.methods.@"{[name]s}_{[descriptor]s}".?; 196 | \\ }}; 197 | \\ return try env.getStaticField(.{[type]s} , self.class, field_id); 198 | \\ }} 199 | \\ 200 | , .{ 201 | .name = name, 202 | .descriptor = descriptor, 203 | .return_type = descriptorAsTypeString(descriptor_info.*), 204 | .type = try descriptor_info.humanStringifyConst(), 205 | }); 206 | if (field.access_flags.final) continue; 207 | const upper_name = try allocator.dupe(u8, name); 208 | defer allocator.free(upper_name); 209 | upper_name[0] = std.ascii.toUpper(upper_name[0]); 210 | try std.fmt.format(writer, 211 | \\ pub fn set{[name]s}(self: @This(), env: *jui.JNIEnv) !*{[return_type]s} {{ 212 | \\ const field_id = self.fields.@"{[name]s}{[descriptor]s}" orelse field_id: {{ 213 | \\ self.fields.@"{[name]s}{[descriptor]s}" = try env.getFieldId(self.class, "{[name]s}", "{[descriptor]s}"); 214 | \\ break :field_id self.methods.@"{[name]s}_{[descriptor]s}".?; 215 | \\ }}; 216 | \\ return try env.getField(.{[type]s} , self.class, field_id); 217 | \\ }} 218 | \\ 219 | , .{ 220 | .name = upper_name, 221 | .descriptor = descriptor, 222 | .return_type = descriptorAsTypeString(descriptor_info.*), 223 | .type = try descriptor_info.humanStringifyConst(), 224 | }); 225 | } 226 | } 227 | } 228 | 229 | fn writeFieldAccessors(fields: []cf.FieldInfo, allocator: std.mem.Allocator, writer: anytype) !void { 230 | if (fields.len > 0) { 231 | try writer.writeAll("\n"); 232 | for (fields) |field| { 233 | if (field.access_flags.static or field.access_flags.protected or field.access_flags.private) continue; 234 | const name = field.getName().bytes; 235 | const descriptor = field.getDescriptor().bytes; 236 | var descriptor_info = try jui.descriptors.parseString(allocator, descriptor); 237 | try std.fmt.format(writer, 238 | \\ pub fn {[name]s}(self: @This(), env: *jui.JNIEnv) !*{[return_type]s} {{ 239 | \\ const field_id = self.fields.@"{[name]s}{[descriptor]s}" orelse field_id: {{ 240 | \\ self.fields.@"{[name]s}{[descriptor]s}" = try env.getFieldId(self.Class.class, "{[name]s}", "{[descriptor]s}"); 241 | \\ break :field_id self.methods.@"{[name]s}_{[descriptor]s}".?; 242 | \\ }}; 243 | \\ return try env.getField(.{[type]s}, self.object, field_id); 244 | \\ }} 245 | \\ 246 | , .{ 247 | .name = name, 248 | .descriptor = descriptor, 249 | .return_type = descriptorAsTypeString(descriptor_info.*), 250 | .type = try descriptor_info.humanStringifyConst(), 251 | }); 252 | if (field.access_flags.final) continue; 253 | const upper_name = try allocator.dupe(u8, name); 254 | defer allocator.free(upper_name); 255 | upper_name[0] = std.ascii.toUpper(upper_name[0]); 256 | try std.fmt.format(writer, 257 | \\ pub fn set{[name]s}(self: @This(), env: *jui.JNIEnv) !*{[return_type]s} {{ 258 | \\ const field_id = self.fields.@"{[name]s}{[descriptor]s}" orelse field_id: {{ 259 | \\ self.fields.@"{[name]s}{[descriptor]s}" = try env.getFieldId(self.Class.class, "{[name]s}", "{[descriptor]s}"); 260 | \\ break :field_id self.methods.@"{[name]s}_{[descriptor]s}".?; 261 | \\ }}; 262 | \\ return try env.getField(.{[type]s}, self.object, field_id); 263 | \\ }} 264 | \\ 265 | , .{ 266 | .name = upper_name, 267 | .descriptor = descriptor, 268 | .return_type = descriptorAsTypeString(descriptor_info.*), 269 | .type = try descriptor_info.humanStringifyConst(), 270 | }); 271 | } 272 | } 273 | } 274 | 275 | fn writeMethodDecls(methods: []cf.MethodInfo, writer: anytype) !void { 276 | if (methods.len > 0) { 277 | try writer.writeAll("\n"); 278 | for (methods) |method| { 279 | const name = method.getName().bytes; 280 | const descriptor = method.getDescriptor().bytes; 281 | try std.fmt.format(writer, " @\"{s}{s}\": ?jui.jmethodID,\n", .{ name, descriptor }); 282 | } 283 | try writer.writeAll(" "); 284 | } 285 | } 286 | 287 | fn writeConstructors(methods: []cf.MethodInfo, writer: anytype) !void { 288 | if (methods.len == 0) return; 289 | try writer.writeAll("\n"); 290 | 291 | try std.fmt.format(writer, 292 | \\ pub fn new(self: @This(), env: *jui.JNIEnv, descriptor: []const u8, args: ?[*]const jui.jvalue) !*Instance {{ 293 | \\ const method_id = @field(self.Class.methods, "" ++ descriptor) orelse method_id: {{ 294 | \\ @field(self.Class.methods, "" ++ descriptor) = try env.getMethodId(self.class, "", descriptor); 295 | \\ break :method_id @field(self.Class.methods, "" ++ descriptor).?; 296 | \\ }}; 297 | \\ const object = try env.newObject(self.class, method_id, args); 298 | \\ return Instance {{ .class = self, .object = object }}; 299 | \\ }} 300 | \\ 301 | , .{}); 302 | } 303 | 304 | fn writeStaticMethod(name: []const u8, methods: []cf.MethodInfo, allocator: std.mem.Allocator, writer: anytype) !void { 305 | if (methods.len > 0) try writer.writeAll("\n"); 306 | 307 | // TODO: make sure the method_name is a valid identifier string 308 | 309 | var overloads = std.ArrayList(u8).init(allocator); 310 | defer overloads.deinit(); 311 | try overloads.writer().print(" const {s}_overloads = &[_][]const u8{{", .{name}); 312 | 313 | var return_types = std.ArrayList(u8).init(allocator); 314 | defer return_types.deinit(); 315 | try return_types.writer().print(" const {s}_return_types = &[_]type{{", .{name}); 316 | 317 | for (methods) |method| { 318 | const descriptor = method.getDescriptor().bytes; 319 | var descriptor_info = try jui.descriptors.parseString(allocator, descriptor); 320 | defer descriptor_info.deinit(allocator); 321 | std.debug.assert(descriptor_info.* == .method); 322 | 323 | try overloads.writer().writeAll("\n \""); 324 | try overloads.writer().writeAll(descriptor); 325 | try overloads.writer().writeAll("\","); 326 | 327 | try return_types.writer().writeAll("\n "); 328 | try return_types.writer().writeAll(descriptorAsTypeString(descriptor_info.*.method.return_type.*)); 329 | try return_types.writer().writeAll(","); 330 | } 331 | 332 | try overloads.writer().writeAll("\n };"); 333 | try return_types.writer().writeAll("\n };"); 334 | 335 | try std.fmt.format(writer, 336 | \\{[overloads]s} 337 | \\{[return_types]s} 338 | \\ pub fn {[name]s}(self: @This(), env: *jui.JNIEnv, comptime descriptor: []const u8, args: ?[*]const jui.jvalue) !jui.bindings.returnTypeLookup(descriptor, {[name]s}_overloads, {[name]s}_return_types) {{ 339 | \\ const method_id = @field(self.Class.methods, "{[name]s}" ++ descriptor) orelse method_id: {{ 340 | \\ @field(self.Class.methods, "{[name]s}" ++ descriptor) = try env.getMethodId(self.class, "{[name]s}", descriptor); 341 | \\ break :method_id @field(self.Class.methods, "{[name]s}" ++ descriptor).?; 342 | \\ }}; 343 | \\ const object = try env.newObject(self.class, method_id, arg_array); 344 | \\ return Instance {{ .class = self, .object = object }}; 345 | \\ }} 346 | \\ 347 | , .{ 348 | .name = name, 349 | .overloads = overloads.items, 350 | .return_types = return_types.items, 351 | }); 352 | } 353 | 354 | fn descriptorAsTypeString(descriptor: jui.descriptors.Descriptor) []const u8 { 355 | return switch (descriptor) { 356 | .byte => "jui.jbyte", 357 | .char => "jui.jchar", 358 | .int => "jui.jint", 359 | .short => "jui.jshort", 360 | .long => "jui.jlong", 361 | .float => "jui.jfloat", 362 | .double => "jui.jdouble", 363 | .boolean => "jui.jboolean", 364 | .void => "void", 365 | .object => "jui.jobject", 366 | .array => "jui.jarray", 367 | .method => "jui.jmethodId", 368 | }; 369 | } 370 | 371 | fn writeBindingFunction(call_entry: *std.ArrayList(u8), alloc: std.mem.Allocator, method: cf.MethodInfo) !void { 372 | // Get name and descriptor 373 | const name = method.getName().bytes; 374 | const descriptor = method.getDescriptor().bytes; 375 | 376 | const is_constructor = std.mem.eql(u8, name, ""); 377 | 378 | // Parse the descriptor 379 | var descriptor_info = try jui.descriptors.parseString(alloc, descriptor); 380 | defer descriptor_info.deinit(alloc); 381 | 382 | const self = if (method.access_flags.static) "" else "self: *@This(), "; 383 | const self2 = if (method.access_flags.static) "class" else "@ptrCast(jui.jobject, self)"; 384 | const class_assign = if (method.access_flags.static) "const class" else "_"; 385 | const static = if (method.access_flags.static) "Static" else ""; 386 | 387 | const return_type = descriptorAsTypeString(descriptor_info.method.return_type.*); 388 | 389 | var parameters = std.ArrayList(u8).init(alloc); 390 | defer parameters.deinit(); 391 | 392 | var call_parameters = std.ArrayList(u8).init(alloc); 393 | defer call_parameters.deinit(); 394 | 395 | const has_parameters = (descriptor_info.method.parameters.len != 0); 396 | 397 | if (has_parameters) 398 | try std.fmt.format(call_parameters.writer(), "&[_]jui.jvalue{{", .{}) 399 | else 400 | try call_parameters.appendSlice("null"); 401 | 402 | for (descriptor_info.method.parameters) |parameter, i| { 403 | const type_string = descriptorAsTypeString(parameter.*); 404 | try std.fmt.format(parameters.writer(), ", arg{}: {s}", .{ 405 | i, 406 | type_string, 407 | }); 408 | try std.fmt.format(call_parameters.writer(), "{s}jui.jvalue.toJValue(arg{})", .{ 409 | if (i == 0) "" else ", ", 410 | i, 411 | }); 412 | } 413 | 414 | if (has_parameters) 415 | try std.fmt.format(call_parameters.writer(), "}}", .{}); 416 | 417 | if (is_constructor) { 418 | try std.fmt.format(call_entry.writer(), 419 | \\ pub fn @"{[name]s}{[descriptor]s}"(env: *jui.JNIEnv{[parameters]s}) !*@This() {{ 420 | \\ try load(env); 421 | \\ const class = class_global orelse return error.ClassNotLoaded; 422 | \\ return @ptrCast(*@This(), try env.newObject(class, methods.@"{[name]s}{[descriptor]s}", {[call_parameters]s})); 423 | \\ }} 424 | \\ 425 | , .{ 426 | .name = name, 427 | .descriptor = descriptor, 428 | .parameters = parameters.items, 429 | .call_parameters = call_parameters.items, 430 | }); 431 | } else { 432 | try std.fmt.format(call_entry.writer(), 433 | \\ pub fn @"{[name]s}{[descriptor]s}"({[self]s}env: *jui.JNIEnv{[parameters]s}) !{[return_type]s} {{ 434 | \\ try load(env); 435 | \\ {[class_assign]s} = class_global orelse return error.ClassNotFound; 436 | \\ return env.call{[static]s}Method(.{[call_return_type]s}, {[self2]s}, methods.@"{[name]s}{[descriptor]s}", {[call_parameters]s}); 437 | \\ }} 438 | \\ 439 | , .{ 440 | .name = name, 441 | .descriptor = descriptor, 442 | .self = self, 443 | .self2 = self2, 444 | .return_type = return_type, 445 | .call_return_type = try descriptor_info.method.return_type.humanStringifyConst(), 446 | .static = static, 447 | .parameters = parameters.items, 448 | .call_parameters = call_parameters.items, 449 | .class_assign = class_assign, 450 | }); 451 | } 452 | } 453 | 454 | fn writeFieldBindingFunction(call_entry: *std.ArrayList(u8), alloc: std.mem.Allocator, field: cf.FieldInfo) !void { 455 | // Get name and descriptor 456 | const name = field.getName().bytes; 457 | const descriptor = field.getDescriptor().bytes; 458 | 459 | // Parse the descriptor 460 | var descriptor_info = try jui.descriptors.parseString(alloc, descriptor); 461 | defer descriptor_info.deinit(alloc); 462 | 463 | const self = if (field.access_flags.static) "" else "self: *@This(), "; 464 | const self2 = if (field.access_flags.static) "class" else "@ptrCast(jui.jobject, self)"; 465 | const class_assign = if (field.access_flags.static) "const class" else "_"; 466 | const static = if (field.access_flags.static) "Static" else ""; 467 | 468 | const return_type = descriptorAsTypeString(descriptor_info.*); 469 | 470 | try std.fmt.format(call_entry.writer(), 471 | \\ pub fn @"get_{[name]s}_{[descriptor]s}"({[self]s}env: *jui.JNIEnv) !{[return_type]s} {{ 472 | \\ try load(env); 473 | \\ {[class_assign]s} = class_global orelse return error.ClassNotFound; 474 | \\ return env.get{[static]s}Field(.{[call_return_type]s}, {[self2]s}, fields.@"{[name]s}_{[descriptor]s}"); 475 | \\ }} 476 | \\ 477 | , .{ 478 | .name = name, 479 | .descriptor = descriptor, 480 | .self = self, 481 | .self2 = self2, 482 | .return_type = return_type, 483 | .call_return_type = try descriptor_info.humanStringifyConst(), 484 | .static = static, 485 | .class_assign = class_assign, 486 | }); 487 | 488 | if (!field.access_flags.final) { 489 | try std.fmt.format(call_entry.writer(), 490 | \\ pub fn @"set_{[name]s}_{[descriptor]s}"({[self]s}env: *jui.JNIEnv, arg: {[return_type]s}) !void {{ 491 | \\ try load(env); 492 | \\ {[class_assign]s} = class_global orelse return error.ClassNotFound; 493 | \\ try env.call{[static]s}Field(.{[call_return_type]s}, {[self2]s}, fields.@"{[name]s}_{[descriptor]s}", arg); 494 | \\ }} 495 | \\ 496 | , .{ 497 | .name = name, 498 | .descriptor = descriptor, 499 | .self = self, 500 | .self2 = self2, 501 | .return_type = return_type, 502 | .call_return_type = try descriptor_info.humanStringifyConst(), 503 | .static = static, 504 | .class_assign = class_assign, 505 | }); 506 | } 507 | } 508 | -------------------------------------------------------------------------------- /examples/guessing-game/gen/java/io/PrintStream.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const jui = @import("jui"); 3 | /// Opaque type corresponding to java/io/PrintStream 4 | pub const PrintStream = opaque { 5 | const classpath = "java/io/PrintStream"; 6 | var class_global: jui.jclass = null; 7 | var fields: struct { 8 | @"lock_Ljdk/internal/misc/InternalLock;": jui.jfieldID, 9 | @"autoFlush_Z": jui.jfieldID, 10 | @"trouble_Z": jui.jfieldID, 11 | @"formatter_Ljava/util/Formatter;": jui.jfieldID, 12 | @"charset_Ljava/nio/charset/Charset;": jui.jfieldID, 13 | @"textOut_Ljava/io/BufferedWriter;": jui.jfieldID, 14 | @"charOut_Ljava/io/OutputStreamWriter;": jui.jfieldID, 15 | @"closing_Z": jui.jfieldID, 16 | } = undefined; 17 | var methods: struct { 18 | @"requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;": jui.jmethodID, 19 | @"toCharset(Ljava/lang/String;)Ljava/nio/charset/Charset;": jui.jmethodID, 20 | @"(ZLjava/io/OutputStream;)V": jui.jmethodID, 21 | @"(ZLjava/nio/charset/Charset;Ljava/io/OutputStream;)V": jui.jmethodID, 22 | @"(Ljava/io/OutputStream;)V": jui.jmethodID, 23 | @"(Ljava/io/OutputStream;Z)V": jui.jmethodID, 24 | @"(Ljava/io/OutputStream;ZLjava/lang/String;)V": jui.jmethodID, 25 | @"(Ljava/io/OutputStream;ZLjava/nio/charset/Charset;)V": jui.jmethodID, 26 | @"(Ljava/lang/String;)V": jui.jmethodID, 27 | @"(Ljava/lang/String;Ljava/lang/String;)V": jui.jmethodID, 28 | @"(Ljava/lang/String;Ljava/nio/charset/Charset;)V": jui.jmethodID, 29 | @"(Ljava/io/File;)V": jui.jmethodID, 30 | @"(Ljava/io/File;Ljava/lang/String;)V": jui.jmethodID, 31 | @"(Ljava/io/File;Ljava/nio/charset/Charset;)V": jui.jmethodID, 32 | @"ensureOpen()V": jui.jmethodID, 33 | @"flush()V": jui.jmethodID, 34 | @"implFlush()V": jui.jmethodID, 35 | @"close()V": jui.jmethodID, 36 | @"implClose()V": jui.jmethodID, 37 | @"checkError()Z": jui.jmethodID, 38 | @"setError()V": jui.jmethodID, 39 | @"clearError()V": jui.jmethodID, 40 | @"write(I)V": jui.jmethodID, 41 | @"implWrite(I)V": jui.jmethodID, 42 | @"write([BII)V": jui.jmethodID, 43 | @"implWrite([BII)V": jui.jmethodID, 44 | @"write([B)V": jui.jmethodID, 45 | @"writeBytes([B)V": jui.jmethodID, 46 | @"write([C)V": jui.jmethodID, 47 | @"implWrite([C)V": jui.jmethodID, 48 | @"writeln([C)V": jui.jmethodID, 49 | @"implWriteln([C)V": jui.jmethodID, 50 | @"write(Ljava/lang/String;)V": jui.jmethodID, 51 | @"implWrite(Ljava/lang/String;)V": jui.jmethodID, 52 | @"writeln(Ljava/lang/String;)V": jui.jmethodID, 53 | @"implWriteln(Ljava/lang/String;)V": jui.jmethodID, 54 | @"newLine()V": jui.jmethodID, 55 | @"implNewLine()V": jui.jmethodID, 56 | @"print(Z)V": jui.jmethodID, 57 | @"print(C)V": jui.jmethodID, 58 | @"print(I)V": jui.jmethodID, 59 | @"print(J)V": jui.jmethodID, 60 | @"print(F)V": jui.jmethodID, 61 | @"print(D)V": jui.jmethodID, 62 | @"print([C)V": jui.jmethodID, 63 | @"print(Ljava/lang/String;)V": jui.jmethodID, 64 | @"print(Ljava/lang/Object;)V": jui.jmethodID, 65 | @"println()V": jui.jmethodID, 66 | @"println(Z)V": jui.jmethodID, 67 | @"println(C)V": jui.jmethodID, 68 | @"println(I)V": jui.jmethodID, 69 | @"println(J)V": jui.jmethodID, 70 | @"println(F)V": jui.jmethodID, 71 | @"println(D)V": jui.jmethodID, 72 | @"println([C)V": jui.jmethodID, 73 | @"println(Ljava/lang/String;)V": jui.jmethodID, 74 | @"println(Ljava/lang/Object;)V": jui.jmethodID, 75 | @"printf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;": jui.jmethodID, 76 | @"printf(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;": jui.jmethodID, 77 | @"format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;": jui.jmethodID, 78 | @"implFormat(Ljava/lang/String;[Ljava/lang/Object;)V": jui.jmethodID, 79 | @"format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;": jui.jmethodID, 80 | @"implFormat(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)V": jui.jmethodID, 81 | @"append(Ljava/lang/CharSequence;)Ljava/io/PrintStream;": jui.jmethodID, 82 | @"append(Ljava/lang/CharSequence;II)Ljava/io/PrintStream;": jui.jmethodID, 83 | @"append(C)Ljava/io/PrintStream;": jui.jmethodID, 84 | @"charset()Ljava/nio/charset/Charset;": jui.jmethodID, 85 | @"append(C)Ljava/lang/Appendable;": jui.jmethodID, 86 | @"append(Ljava/lang/CharSequence;II)Ljava/lang/Appendable;": jui.jmethodID, 87 | @"append(Ljava/lang/CharSequence;)Ljava/lang/Appendable;": jui.jmethodID, 88 | @"()V": jui.jmethodID, 89 | } = undefined; 90 | pub fn load(env: *jui.JNIEnv) !void { 91 | struct { 92 | var runner = std.once(_runner); 93 | var _env: *jui.JNIEnv = undefined; 94 | var _err: ?Error = null; 95 | 96 | const Error = 97 | jui.JNIEnv.FindClassError || 98 | jui.JNIEnv.NewReferenceError || 99 | jui.JNIEnv.GetFieldIdError || 100 | jui.JNIEnv.GetMethodIdError || 101 | jui.JNIEnv.GetStaticFieldIdError || 102 | jui.JNIEnv.GetStaticMethodIdError; 103 | 104 | fn _load(arg: *jui.JNIEnv) !void { 105 | _env = arg; 106 | runner.call(); 107 | if (_err) |e| return e; 108 | } 109 | 110 | fn _runner() void { 111 | _run(_env) catch |e| { _err = e; }; 112 | } 113 | 114 | fn _run(inner_env: *jui.JNIEnv) !void { 115 | const class_local = try inner_env.findClass(classpath); 116 | class_global = try inner_env.newReference(.global, class_local); 117 | const class = class_global orelse return error.NoClassDefFoundError; 118 | // 119 | fields = .{ 120 | .@"lock_Ljdk/internal/misc/InternalLock;" = try inner_env.getFieldId(class, "lock", "Ljdk/internal/misc/InternalLock;"), 121 | .@"autoFlush_Z" = try inner_env.getFieldId(class, "autoFlush", "Z"), 122 | .@"trouble_Z" = try inner_env.getFieldId(class, "trouble", "Z"), 123 | .@"formatter_Ljava/util/Formatter;" = try inner_env.getFieldId(class, "formatter", "Ljava/util/Formatter;"), 124 | .@"charset_Ljava/nio/charset/Charset;" = try inner_env.getFieldId(class, "charset", "Ljava/nio/charset/Charset;"), 125 | .@"textOut_Ljava/io/BufferedWriter;" = try inner_env.getFieldId(class, "textOut", "Ljava/io/BufferedWriter;"), 126 | .@"charOut_Ljava/io/OutputStreamWriter;" = try inner_env.getFieldId(class, "charOut", "Ljava/io/OutputStreamWriter;"), 127 | .@"closing_Z" = try inner_env.getFieldId(class, "closing", "Z"), 128 | }; 129 | methods = .{ 130 | .@"requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;" = try inner_env.getStaticMethodId(class, "requireNonNull", "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;"), 131 | .@"toCharset(Ljava/lang/String;)Ljava/nio/charset/Charset;" = try inner_env.getStaticMethodId(class, "toCharset", "(Ljava/lang/String;)Ljava/nio/charset/Charset;"), 132 | .@"(ZLjava/io/OutputStream;)V" = try inner_env.getMethodId(class, "", "(ZLjava/io/OutputStream;)V"), 133 | .@"(ZLjava/nio/charset/Charset;Ljava/io/OutputStream;)V" = try inner_env.getMethodId(class, "", "(ZLjava/nio/charset/Charset;Ljava/io/OutputStream;)V"), 134 | .@"(Ljava/io/OutputStream;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/OutputStream;)V"), 135 | .@"(Ljava/io/OutputStream;Z)V" = try inner_env.getMethodId(class, "", "(Ljava/io/OutputStream;Z)V"), 136 | .@"(Ljava/io/OutputStream;ZLjava/lang/String;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/OutputStream;ZLjava/lang/String;)V"), 137 | .@"(Ljava/io/OutputStream;ZLjava/nio/charset/Charset;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/OutputStream;ZLjava/nio/charset/Charset;)V"), 138 | .@"(Ljava/lang/String;)V" = try inner_env.getMethodId(class, "", "(Ljava/lang/String;)V"), 139 | .@"(Ljava/lang/String;Ljava/lang/String;)V" = try inner_env.getMethodId(class, "", "(Ljava/lang/String;Ljava/lang/String;)V"), 140 | .@"(Ljava/lang/String;Ljava/nio/charset/Charset;)V" = try inner_env.getMethodId(class, "", "(Ljava/lang/String;Ljava/nio/charset/Charset;)V"), 141 | .@"(Ljava/io/File;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/File;)V"), 142 | .@"(Ljava/io/File;Ljava/lang/String;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/File;Ljava/lang/String;)V"), 143 | .@"(Ljava/io/File;Ljava/nio/charset/Charset;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/File;Ljava/nio/charset/Charset;)V"), 144 | .@"ensureOpen()V" = try inner_env.getMethodId(class, "ensureOpen", "()V"), 145 | .@"flush()V" = try inner_env.getMethodId(class, "flush", "()V"), 146 | .@"implFlush()V" = try inner_env.getMethodId(class, "implFlush", "()V"), 147 | .@"close()V" = try inner_env.getMethodId(class, "close", "()V"), 148 | .@"implClose()V" = try inner_env.getMethodId(class, "implClose", "()V"), 149 | .@"checkError()Z" = try inner_env.getMethodId(class, "checkError", "()Z"), 150 | .@"setError()V" = try inner_env.getMethodId(class, "setError", "()V"), 151 | .@"clearError()V" = try inner_env.getMethodId(class, "clearError", "()V"), 152 | .@"write(I)V" = try inner_env.getMethodId(class, "write", "(I)V"), 153 | .@"implWrite(I)V" = try inner_env.getMethodId(class, "implWrite", "(I)V"), 154 | .@"write([BII)V" = try inner_env.getMethodId(class, "write", "([BII)V"), 155 | .@"implWrite([BII)V" = try inner_env.getMethodId(class, "implWrite", "([BII)V"), 156 | .@"write([B)V" = try inner_env.getMethodId(class, "write", "([B)V"), 157 | .@"writeBytes([B)V" = try inner_env.getMethodId(class, "writeBytes", "([B)V"), 158 | .@"write([C)V" = try inner_env.getMethodId(class, "write", "([C)V"), 159 | .@"implWrite([C)V" = try inner_env.getMethodId(class, "implWrite", "([C)V"), 160 | .@"writeln([C)V" = try inner_env.getMethodId(class, "writeln", "([C)V"), 161 | .@"implWriteln([C)V" = try inner_env.getMethodId(class, "implWriteln", "([C)V"), 162 | .@"write(Ljava/lang/String;)V" = try inner_env.getMethodId(class, "write", "(Ljava/lang/String;)V"), 163 | .@"implWrite(Ljava/lang/String;)V" = try inner_env.getMethodId(class, "implWrite", "(Ljava/lang/String;)V"), 164 | .@"writeln(Ljava/lang/String;)V" = try inner_env.getMethodId(class, "writeln", "(Ljava/lang/String;)V"), 165 | .@"implWriteln(Ljava/lang/String;)V" = try inner_env.getMethodId(class, "implWriteln", "(Ljava/lang/String;)V"), 166 | .@"newLine()V" = try inner_env.getMethodId(class, "newLine", "()V"), 167 | .@"implNewLine()V" = try inner_env.getMethodId(class, "implNewLine", "()V"), 168 | .@"print(Z)V" = try inner_env.getMethodId(class, "print", "(Z)V"), 169 | .@"print(C)V" = try inner_env.getMethodId(class, "print", "(C)V"), 170 | .@"print(I)V" = try inner_env.getMethodId(class, "print", "(I)V"), 171 | .@"print(J)V" = try inner_env.getMethodId(class, "print", "(J)V"), 172 | .@"print(F)V" = try inner_env.getMethodId(class, "print", "(F)V"), 173 | .@"print(D)V" = try inner_env.getMethodId(class, "print", "(D)V"), 174 | .@"print([C)V" = try inner_env.getMethodId(class, "print", "([C)V"), 175 | .@"print(Ljava/lang/String;)V" = try inner_env.getMethodId(class, "print", "(Ljava/lang/String;)V"), 176 | .@"print(Ljava/lang/Object;)V" = try inner_env.getMethodId(class, "print", "(Ljava/lang/Object;)V"), 177 | .@"println()V" = try inner_env.getMethodId(class, "println", "()V"), 178 | .@"println(Z)V" = try inner_env.getMethodId(class, "println", "(Z)V"), 179 | .@"println(C)V" = try inner_env.getMethodId(class, "println", "(C)V"), 180 | .@"println(I)V" = try inner_env.getMethodId(class, "println", "(I)V"), 181 | .@"println(J)V" = try inner_env.getMethodId(class, "println", "(J)V"), 182 | .@"println(F)V" = try inner_env.getMethodId(class, "println", "(F)V"), 183 | .@"println(D)V" = try inner_env.getMethodId(class, "println", "(D)V"), 184 | .@"println([C)V" = try inner_env.getMethodId(class, "println", "([C)V"), 185 | .@"println(Ljava/lang/String;)V" = try inner_env.getMethodId(class, "println", "(Ljava/lang/String;)V"), 186 | .@"println(Ljava/lang/Object;)V" = try inner_env.getMethodId(class, "println", "(Ljava/lang/Object;)V"), 187 | .@"printf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;" = try inner_env.getMethodId(class, "printf", "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;"), 188 | .@"printf(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;" = try inner_env.getMethodId(class, "printf", "(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;"), 189 | .@"format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;" = try inner_env.getMethodId(class, "format", "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;"), 190 | .@"implFormat(Ljava/lang/String;[Ljava/lang/Object;)V" = try inner_env.getMethodId(class, "implFormat", "(Ljava/lang/String;[Ljava/lang/Object;)V"), 191 | .@"format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;" = try inner_env.getMethodId(class, "format", "(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;"), 192 | .@"implFormat(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)V" = try inner_env.getMethodId(class, "implFormat", "(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)V"), 193 | .@"append(Ljava/lang/CharSequence;)Ljava/io/PrintStream;" = try inner_env.getMethodId(class, "append", "(Ljava/lang/CharSequence;)Ljava/io/PrintStream;"), 194 | .@"append(Ljava/lang/CharSequence;II)Ljava/io/PrintStream;" = try inner_env.getMethodId(class, "append", "(Ljava/lang/CharSequence;II)Ljava/io/PrintStream;"), 195 | .@"append(C)Ljava/io/PrintStream;" = try inner_env.getMethodId(class, "append", "(C)Ljava/io/PrintStream;"), 196 | .@"charset()Ljava/nio/charset/Charset;" = try inner_env.getMethodId(class, "charset", "()Ljava/nio/charset/Charset;"), 197 | .@"append(C)Ljava/lang/Appendable;" = try inner_env.getMethodId(class, "append", "(C)Ljava/lang/Appendable;"), 198 | .@"append(Ljava/lang/CharSequence;II)Ljava/lang/Appendable;" = try inner_env.getMethodId(class, "append", "(Ljava/lang/CharSequence;II)Ljava/lang/Appendable;"), 199 | .@"append(Ljava/lang/CharSequence;)Ljava/lang/Appendable;" = try inner_env.getMethodId(class, "append", "(Ljava/lang/CharSequence;)Ljava/lang/Appendable;"), 200 | .@"()V" = try inner_env.getStaticMethodId(class, "", "()V"), 201 | }; 202 | 203 | } 204 | }._load(env) catch |e| return e; 205 | } 206 | pub fn @"get_lock_Ljdk/internal/misc/InternalLock;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 207 | try load(env); 208 | _ = class_global orelse return error.ClassNotFound; 209 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"lock_Ljdk/internal/misc/InternalLock;"); 210 | } 211 | pub fn @"get_autoFlush_Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 212 | try load(env); 213 | _ = class_global orelse return error.ClassNotFound; 214 | return env.getField(.boolean, @ptrCast(jui.jobject, self), fields.@"autoFlush_Z"); 215 | } 216 | pub fn @"get_trouble_Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 217 | try load(env); 218 | _ = class_global orelse return error.ClassNotFound; 219 | return env.getField(.boolean, @ptrCast(jui.jobject, self), fields.@"trouble_Z"); 220 | } 221 | pub fn @"set_trouble_Z"(self: *@This(), env: *jui.JNIEnv, arg: jui.jboolean) !void { 222 | try load(env); 223 | _ = class_global orelse return error.ClassNotFound; 224 | try env.callField(.boolean, @ptrCast(jui.jobject, self), fields.@"trouble_Z", arg); 225 | } 226 | pub fn @"get_formatter_Ljava/util/Formatter;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 227 | try load(env); 228 | _ = class_global orelse return error.ClassNotFound; 229 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"formatter_Ljava/util/Formatter;"); 230 | } 231 | pub fn @"set_formatter_Ljava/util/Formatter;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 232 | try load(env); 233 | _ = class_global orelse return error.ClassNotFound; 234 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"formatter_Ljava/util/Formatter;", arg); 235 | } 236 | pub fn @"get_charset_Ljava/nio/charset/Charset;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 237 | try load(env); 238 | _ = class_global orelse return error.ClassNotFound; 239 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"charset_Ljava/nio/charset/Charset;"); 240 | } 241 | pub fn @"get_textOut_Ljava/io/BufferedWriter;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 242 | try load(env); 243 | _ = class_global orelse return error.ClassNotFound; 244 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"textOut_Ljava/io/BufferedWriter;"); 245 | } 246 | pub fn @"set_textOut_Ljava/io/BufferedWriter;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 247 | try load(env); 248 | _ = class_global orelse return error.ClassNotFound; 249 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"textOut_Ljava/io/BufferedWriter;", arg); 250 | } 251 | pub fn @"get_charOut_Ljava/io/OutputStreamWriter;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 252 | try load(env); 253 | _ = class_global orelse return error.ClassNotFound; 254 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"charOut_Ljava/io/OutputStreamWriter;"); 255 | } 256 | pub fn @"set_charOut_Ljava/io/OutputStreamWriter;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 257 | try load(env); 258 | _ = class_global orelse return error.ClassNotFound; 259 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"charOut_Ljava/io/OutputStreamWriter;", arg); 260 | } 261 | pub fn @"get_closing_Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 262 | try load(env); 263 | _ = class_global orelse return error.ClassNotFound; 264 | return env.getField(.boolean, @ptrCast(jui.jobject, self), fields.@"closing_Z"); 265 | } 266 | pub fn @"set_closing_Z"(self: *@This(), env: *jui.JNIEnv, arg: jui.jboolean) !void { 267 | try load(env); 268 | _ = class_global orelse return error.ClassNotFound; 269 | try env.callField(.boolean, @ptrCast(jui.jobject, self), fields.@"closing_Z", arg); 270 | } 271 | pub fn @"requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !jui.jobject { 272 | try load(env); 273 | const class = class_global orelse return error.ClassNotFound; 274 | return env.callStaticMethod(.object, class, methods.@"requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 275 | } 276 | pub fn @"toCharset(Ljava/lang/String;)Ljava/nio/charset/Charset;"(env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 277 | try load(env); 278 | const class = class_global orelse return error.ClassNotFound; 279 | return env.callStaticMethod(.object, class, methods.@"toCharset(Ljava/lang/String;)Ljava/nio/charset/Charset;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 280 | } 281 | pub fn @"(ZLjava/io/OutputStream;)V"(env: *jui.JNIEnv, arg0: jui.jboolean, arg1: jui.jobject) !*@This() { 282 | try load(env); 283 | const class = class_global orelse return error.ClassNotLoaded; 284 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(ZLjava/io/OutputStream;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 285 | } 286 | pub fn @"(ZLjava/nio/charset/Charset;Ljava/io/OutputStream;)V"(env: *jui.JNIEnv, arg0: jui.jboolean, arg1: jui.jobject, arg2: jui.jobject) !*@This() { 287 | try load(env); 288 | const class = class_global orelse return error.ClassNotLoaded; 289 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(ZLjava/nio/charset/Charset;Ljava/io/OutputStream;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)})); 290 | } 291 | pub fn @"(Ljava/io/OutputStream;)V"(env: *jui.JNIEnv, arg0: jui.jobject) !*@This() { 292 | try load(env); 293 | const class = class_global orelse return error.ClassNotLoaded; 294 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/OutputStream;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)})); 295 | } 296 | pub fn @"(Ljava/io/OutputStream;Z)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jboolean) !*@This() { 297 | try load(env); 298 | const class = class_global orelse return error.ClassNotLoaded; 299 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/OutputStream;Z)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 300 | } 301 | pub fn @"(Ljava/io/OutputStream;ZLjava/lang/String;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jboolean, arg2: jui.jobject) !*@This() { 302 | try load(env); 303 | const class = class_global orelse return error.ClassNotLoaded; 304 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/OutputStream;ZLjava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)})); 305 | } 306 | pub fn @"(Ljava/io/OutputStream;ZLjava/nio/charset/Charset;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jboolean, arg2: jui.jobject) !*@This() { 307 | try load(env); 308 | const class = class_global orelse return error.ClassNotLoaded; 309 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/OutputStream;ZLjava/nio/charset/Charset;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)})); 310 | } 311 | pub fn @"(Ljava/lang/String;)V"(env: *jui.JNIEnv, arg0: jui.jobject) !*@This() { 312 | try load(env); 313 | const class = class_global orelse return error.ClassNotLoaded; 314 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)})); 315 | } 316 | pub fn @"(Ljava/lang/String;Ljava/lang/String;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 317 | try load(env); 318 | const class = class_global orelse return error.ClassNotLoaded; 319 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/lang/String;Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 320 | } 321 | pub fn @"(Ljava/lang/String;Ljava/nio/charset/Charset;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 322 | try load(env); 323 | const class = class_global orelse return error.ClassNotLoaded; 324 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/lang/String;Ljava/nio/charset/Charset;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 325 | } 326 | pub fn @"(Ljava/io/File;)V"(env: *jui.JNIEnv, arg0: jui.jobject) !*@This() { 327 | try load(env); 328 | const class = class_global orelse return error.ClassNotLoaded; 329 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/File;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)})); 330 | } 331 | pub fn @"(Ljava/io/File;Ljava/lang/String;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 332 | try load(env); 333 | const class = class_global orelse return error.ClassNotLoaded; 334 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/File;Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 335 | } 336 | pub fn @"(Ljava/io/File;Ljava/nio/charset/Charset;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 337 | try load(env); 338 | const class = class_global orelse return error.ClassNotLoaded; 339 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/File;Ljava/nio/charset/Charset;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 340 | } 341 | pub fn @"ensureOpen()V"(self: *@This(), env: *jui.JNIEnv) !void { 342 | try load(env); 343 | _ = class_global orelse return error.ClassNotFound; 344 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"ensureOpen()V", null); 345 | } 346 | pub fn @"flush()V"(self: *@This(), env: *jui.JNIEnv) !void { 347 | try load(env); 348 | _ = class_global orelse return error.ClassNotFound; 349 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"flush()V", null); 350 | } 351 | pub fn @"implFlush()V"(self: *@This(), env: *jui.JNIEnv) !void { 352 | try load(env); 353 | _ = class_global orelse return error.ClassNotFound; 354 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implFlush()V", null); 355 | } 356 | pub fn @"close()V"(self: *@This(), env: *jui.JNIEnv) !void { 357 | try load(env); 358 | _ = class_global orelse return error.ClassNotFound; 359 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"close()V", null); 360 | } 361 | pub fn @"implClose()V"(self: *@This(), env: *jui.JNIEnv) !void { 362 | try load(env); 363 | _ = class_global orelse return error.ClassNotFound; 364 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implClose()V", null); 365 | } 366 | pub fn @"checkError()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 367 | try load(env); 368 | _ = class_global orelse return error.ClassNotFound; 369 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"checkError()Z", null); 370 | } 371 | pub fn @"setError()V"(self: *@This(), env: *jui.JNIEnv) !void { 372 | try load(env); 373 | _ = class_global orelse return error.ClassNotFound; 374 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"setError()V", null); 375 | } 376 | pub fn @"clearError()V"(self: *@This(), env: *jui.JNIEnv) !void { 377 | try load(env); 378 | _ = class_global orelse return error.ClassNotFound; 379 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"clearError()V", null); 380 | } 381 | pub fn @"write(I)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !void { 382 | try load(env); 383 | _ = class_global orelse return error.ClassNotFound; 384 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"write(I)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 385 | } 386 | pub fn @"implWrite(I)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !void { 387 | try load(env); 388 | _ = class_global orelse return error.ClassNotFound; 389 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implWrite(I)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 390 | } 391 | pub fn @"write([BII)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray, arg1: jui.jint, arg2: jui.jint) !void { 392 | try load(env); 393 | _ = class_global orelse return error.ClassNotFound; 394 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"write([BII)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)}); 395 | } 396 | pub fn @"implWrite([BII)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray, arg1: jui.jint, arg2: jui.jint) !void { 397 | try load(env); 398 | _ = class_global orelse return error.ClassNotFound; 399 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implWrite([BII)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)}); 400 | } 401 | pub fn @"write([B)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray) !void { 402 | try load(env); 403 | _ = class_global orelse return error.ClassNotFound; 404 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"write([B)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 405 | } 406 | pub fn @"writeBytes([B)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray) !void { 407 | try load(env); 408 | _ = class_global orelse return error.ClassNotFound; 409 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"writeBytes([B)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 410 | } 411 | pub fn @"write([C)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray) !void { 412 | try load(env); 413 | _ = class_global orelse return error.ClassNotFound; 414 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"write([C)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 415 | } 416 | pub fn @"implWrite([C)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray) !void { 417 | try load(env); 418 | _ = class_global orelse return error.ClassNotFound; 419 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implWrite([C)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 420 | } 421 | pub fn @"writeln([C)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray) !void { 422 | try load(env); 423 | _ = class_global orelse return error.ClassNotFound; 424 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"writeln([C)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 425 | } 426 | pub fn @"implWriteln([C)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray) !void { 427 | try load(env); 428 | _ = class_global orelse return error.ClassNotFound; 429 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implWriteln([C)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 430 | } 431 | pub fn @"write(Ljava/lang/String;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !void { 432 | try load(env); 433 | _ = class_global orelse return error.ClassNotFound; 434 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"write(Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 435 | } 436 | pub fn @"implWrite(Ljava/lang/String;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !void { 437 | try load(env); 438 | _ = class_global orelse return error.ClassNotFound; 439 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implWrite(Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 440 | } 441 | pub fn @"writeln(Ljava/lang/String;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !void { 442 | try load(env); 443 | _ = class_global orelse return error.ClassNotFound; 444 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"writeln(Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 445 | } 446 | pub fn @"implWriteln(Ljava/lang/String;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !void { 447 | try load(env); 448 | _ = class_global orelse return error.ClassNotFound; 449 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implWriteln(Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 450 | } 451 | pub fn @"newLine()V"(self: *@This(), env: *jui.JNIEnv) !void { 452 | try load(env); 453 | _ = class_global orelse return error.ClassNotFound; 454 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"newLine()V", null); 455 | } 456 | pub fn @"implNewLine()V"(self: *@This(), env: *jui.JNIEnv) !void { 457 | try load(env); 458 | _ = class_global orelse return error.ClassNotFound; 459 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implNewLine()V", null); 460 | } 461 | pub fn @"print(Z)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jboolean) !void { 462 | try load(env); 463 | _ = class_global orelse return error.ClassNotFound; 464 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"print(Z)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 465 | } 466 | pub fn @"print(C)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jchar) !void { 467 | try load(env); 468 | _ = class_global orelse return error.ClassNotFound; 469 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"print(C)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 470 | } 471 | pub fn @"print(I)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !void { 472 | try load(env); 473 | _ = class_global orelse return error.ClassNotFound; 474 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"print(I)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 475 | } 476 | pub fn @"print(J)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jlong) !void { 477 | try load(env); 478 | _ = class_global orelse return error.ClassNotFound; 479 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"print(J)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 480 | } 481 | pub fn @"print(F)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jfloat) !void { 482 | try load(env); 483 | _ = class_global orelse return error.ClassNotFound; 484 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"print(F)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 485 | } 486 | pub fn @"print(D)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jdouble) !void { 487 | try load(env); 488 | _ = class_global orelse return error.ClassNotFound; 489 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"print(D)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 490 | } 491 | pub fn @"print([C)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray) !void { 492 | try load(env); 493 | _ = class_global orelse return error.ClassNotFound; 494 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"print([C)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 495 | } 496 | pub fn @"print(Ljava/lang/String;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !void { 497 | try load(env); 498 | _ = class_global orelse return error.ClassNotFound; 499 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"print(Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 500 | } 501 | pub fn @"print(Ljava/lang/Object;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !void { 502 | try load(env); 503 | _ = class_global orelse return error.ClassNotFound; 504 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"print(Ljava/lang/Object;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 505 | } 506 | pub fn @"println()V"(self: *@This(), env: *jui.JNIEnv) !void { 507 | try load(env); 508 | _ = class_global orelse return error.ClassNotFound; 509 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println()V", null); 510 | } 511 | pub fn @"println(Z)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jboolean) !void { 512 | try load(env); 513 | _ = class_global orelse return error.ClassNotFound; 514 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println(Z)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 515 | } 516 | pub fn @"println(C)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jchar) !void { 517 | try load(env); 518 | _ = class_global orelse return error.ClassNotFound; 519 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println(C)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 520 | } 521 | pub fn @"println(I)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !void { 522 | try load(env); 523 | _ = class_global orelse return error.ClassNotFound; 524 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println(I)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 525 | } 526 | pub fn @"println(J)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jlong) !void { 527 | try load(env); 528 | _ = class_global orelse return error.ClassNotFound; 529 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println(J)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 530 | } 531 | pub fn @"println(F)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jfloat) !void { 532 | try load(env); 533 | _ = class_global orelse return error.ClassNotFound; 534 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println(F)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 535 | } 536 | pub fn @"println(D)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jdouble) !void { 537 | try load(env); 538 | _ = class_global orelse return error.ClassNotFound; 539 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println(D)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 540 | } 541 | pub fn @"println([C)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jarray) !void { 542 | try load(env); 543 | _ = class_global orelse return error.ClassNotFound; 544 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println([C)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 545 | } 546 | pub fn @"println(Ljava/lang/String;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !void { 547 | try load(env); 548 | _ = class_global orelse return error.ClassNotFound; 549 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println(Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 550 | } 551 | pub fn @"println(Ljava/lang/Object;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !void { 552 | try load(env); 553 | _ = class_global orelse return error.ClassNotFound; 554 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"println(Ljava/lang/Object;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 555 | } 556 | pub fn @"printf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jarray) !jui.jobject { 557 | try load(env); 558 | _ = class_global orelse return error.ClassNotFound; 559 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"printf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 560 | } 561 | pub fn @"printf(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject, arg2: jui.jarray) !jui.jobject { 562 | try load(env); 563 | _ = class_global orelse return error.ClassNotFound; 564 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"printf(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)}); 565 | } 566 | pub fn @"format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jarray) !jui.jobject { 567 | try load(env); 568 | _ = class_global orelse return error.ClassNotFound; 569 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 570 | } 571 | pub fn @"implFormat(Ljava/lang/String;[Ljava/lang/Object;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jarray) !void { 572 | try load(env); 573 | _ = class_global orelse return error.ClassNotFound; 574 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implFormat(Ljava/lang/String;[Ljava/lang/Object;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 575 | } 576 | pub fn @"format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject, arg2: jui.jarray) !jui.jobject { 577 | try load(env); 578 | _ = class_global orelse return error.ClassNotFound; 579 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)}); 580 | } 581 | pub fn @"implFormat(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject, arg2: jui.jarray) !void { 582 | try load(env); 583 | _ = class_global orelse return error.ClassNotFound; 584 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"implFormat(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)}); 585 | } 586 | pub fn @"append(Ljava/lang/CharSequence;)Ljava/io/PrintStream;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 587 | try load(env); 588 | _ = class_global orelse return error.ClassNotFound; 589 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"append(Ljava/lang/CharSequence;)Ljava/io/PrintStream;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 590 | } 591 | pub fn @"append(Ljava/lang/CharSequence;II)Ljava/io/PrintStream;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jint, arg2: jui.jint) !jui.jobject { 592 | try load(env); 593 | _ = class_global orelse return error.ClassNotFound; 594 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"append(Ljava/lang/CharSequence;II)Ljava/io/PrintStream;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)}); 595 | } 596 | pub fn @"append(C)Ljava/io/PrintStream;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jchar) !jui.jobject { 597 | try load(env); 598 | _ = class_global orelse return error.ClassNotFound; 599 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"append(C)Ljava/io/PrintStream;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 600 | } 601 | pub fn @"charset()Ljava/nio/charset/Charset;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 602 | try load(env); 603 | _ = class_global orelse return error.ClassNotFound; 604 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"charset()Ljava/nio/charset/Charset;", null); 605 | } 606 | pub fn @"append(C)Ljava/lang/Appendable;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jchar) !jui.jobject { 607 | try load(env); 608 | _ = class_global orelse return error.ClassNotFound; 609 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"append(C)Ljava/lang/Appendable;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 610 | } 611 | pub fn @"append(Ljava/lang/CharSequence;II)Ljava/lang/Appendable;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jint, arg2: jui.jint) !jui.jobject { 612 | try load(env); 613 | _ = class_global orelse return error.ClassNotFound; 614 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"append(Ljava/lang/CharSequence;II)Ljava/lang/Appendable;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1), jui.jvalue.toJValue(arg2)}); 615 | } 616 | pub fn @"append(Ljava/lang/CharSequence;)Ljava/lang/Appendable;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 617 | try load(env); 618 | _ = class_global orelse return error.ClassNotFound; 619 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"append(Ljava/lang/CharSequence;)Ljava/lang/Appendable;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 620 | } 621 | pub fn @"()V"(env: *jui.JNIEnv) !void { 622 | try load(env); 623 | const class = class_global orelse return error.ClassNotFound; 624 | return env.callStaticMethod(.void, class, methods.@"()V", null); 625 | } 626 | 627 | }; 628 | -------------------------------------------------------------------------------- /examples/guessing-game/gen/java/util/Scanner.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const jui = @import("jui"); 3 | /// Opaque type corresponding to java/util/Scanner 4 | pub const Scanner = opaque { 5 | const classpath = "java/util/Scanner"; 6 | var class_global: jui.jclass = null; 7 | var fields: struct { 8 | @"buf_Ljava/nio/CharBuffer;": jui.jfieldID, 9 | @"BUFFER_SIZE_I": jui.jfieldID, 10 | @"position_I": jui.jfieldID, 11 | @"matcher_Ljava/util/regex/Matcher;": jui.jfieldID, 12 | @"delimPattern_Ljava/util/regex/Pattern;": jui.jfieldID, 13 | @"hasNextPattern_Ljava/util/regex/Pattern;": jui.jfieldID, 14 | @"hasNextPosition_I": jui.jfieldID, 15 | @"hasNextResult_Ljava/lang/String;": jui.jfieldID, 16 | @"source_Ljava/lang/Readable;": jui.jfieldID, 17 | @"sourceClosed_Z": jui.jfieldID, 18 | @"needInput_Z": jui.jfieldID, 19 | @"skipped_Z": jui.jfieldID, 20 | @"savedScannerPosition_I": jui.jfieldID, 21 | @"typeCache_Ljava/lang/Object;": jui.jfieldID, 22 | @"matchValid_Z": jui.jfieldID, 23 | @"closed_Z": jui.jfieldID, 24 | @"radix_I": jui.jfieldID, 25 | @"defaultRadix_I": jui.jfieldID, 26 | @"locale_Ljava/util/Locale;": jui.jfieldID, 27 | @"patternCache_Ljava/util/Scanner$PatternLRUCache;": jui.jfieldID, 28 | @"lastException_Ljava/io/IOException;": jui.jfieldID, 29 | @"modCount_I": jui.jfieldID, 30 | @"WHITESPACE_PATTERN_Ljava/util/regex/Pattern;": jui.jfieldID, 31 | @"FIND_ANY_PATTERN_Ljava/util/regex/Pattern;": jui.jfieldID, 32 | @"NON_ASCII_DIGIT_Ljava/util/regex/Pattern;": jui.jfieldID, 33 | @"groupSeparator_Ljava/lang/String;": jui.jfieldID, 34 | @"decimalSeparator_Ljava/lang/String;": jui.jfieldID, 35 | @"nanString_Ljava/lang/String;": jui.jfieldID, 36 | @"infinityString_Ljava/lang/String;": jui.jfieldID, 37 | @"positivePrefix_Ljava/lang/String;": jui.jfieldID, 38 | @"negativePrefix_Ljava/lang/String;": jui.jfieldID, 39 | @"positiveSuffix_Ljava/lang/String;": jui.jfieldID, 40 | @"negativeSuffix_Ljava/lang/String;": jui.jfieldID, 41 | @"boolPattern_Ljava/util/regex/Pattern;": jui.jfieldID, 42 | @"BOOLEAN_PATTERN_Ljava/lang/String;": jui.jfieldID, 43 | @"integerPattern_Ljava/util/regex/Pattern;": jui.jfieldID, 44 | @"digits_Ljava/lang/String;": jui.jfieldID, 45 | @"non0Digit_Ljava/lang/String;": jui.jfieldID, 46 | @"SIMPLE_GROUP_INDEX_I": jui.jfieldID, 47 | @"separatorPattern_Ljava/util/regex/Pattern;": jui.jfieldID, 48 | @"linePattern_Ljava/util/regex/Pattern;": jui.jfieldID, 49 | @"LINE_SEPARATOR_PATTERN_Ljava/lang/String;": jui.jfieldID, 50 | @"LINE_PATTERN_Ljava/lang/String;": jui.jfieldID, 51 | @"floatPattern_Ljava/util/regex/Pattern;": jui.jfieldID, 52 | @"decimalPattern_Ljava/util/regex/Pattern;": jui.jfieldID, 53 | @"$assertionsDisabled_Z": jui.jfieldID, 54 | } = undefined; 55 | var methods: struct { 56 | @"boolPattern()Ljava/util/regex/Pattern;": jui.jmethodID, 57 | @"buildIntegerPatternString()Ljava/lang/String;": jui.jmethodID, 58 | @"integerPattern()Ljava/util/regex/Pattern;": jui.jmethodID, 59 | @"separatorPattern()Ljava/util/regex/Pattern;": jui.jmethodID, 60 | @"linePattern()Ljava/util/regex/Pattern;": jui.jmethodID, 61 | @"buildFloatAndDecimalPattern()V": jui.jmethodID, 62 | @"floatPattern()Ljava/util/regex/Pattern;": jui.jmethodID, 63 | @"decimalPattern()Ljava/util/regex/Pattern;": jui.jmethodID, 64 | @"(Ljava/lang/Readable;Ljava/util/regex/Pattern;)V": jui.jmethodID, 65 | @"(Ljava/lang/Readable;)V": jui.jmethodID, 66 | @"(Ljava/io/InputStream;)V": jui.jmethodID, 67 | @"(Ljava/io/InputStream;Ljava/lang/String;)V": jui.jmethodID, 68 | @"(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V": jui.jmethodID, 69 | @"toCharset(Ljava/lang/String;)Ljava/nio/charset/Charset;": jui.jmethodID, 70 | @"makeReadable(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)Ljava/lang/Readable;": jui.jmethodID, 71 | @"makeReadable(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/Readable;": jui.jmethodID, 72 | @"(Ljava/io/File;)V": jui.jmethodID, 73 | @"(Ljava/io/File;Ljava/lang/String;)V": jui.jmethodID, 74 | @"(Ljava/io/File;Ljava/nio/charset/Charset;)V": jui.jmethodID, 75 | @"(Ljava/io/File;Ljava/nio/charset/CharsetDecoder;)V": jui.jmethodID, 76 | @"toDecoder(Ljava/lang/String;)Ljava/nio/charset/CharsetDecoder;": jui.jmethodID, 77 | @"makeReadable(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/CharsetDecoder;)Ljava/lang/Readable;": jui.jmethodID, 78 | @"makeReadable(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)Ljava/lang/Readable;": jui.jmethodID, 79 | @"(Ljava/nio/file/Path;)V": jui.jmethodID, 80 | @"(Ljava/nio/file/Path;Ljava/lang/String;)V": jui.jmethodID, 81 | @"(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)V": jui.jmethodID, 82 | @"(Ljava/lang/String;)V": jui.jmethodID, 83 | @"(Ljava/nio/channels/ReadableByteChannel;)V": jui.jmethodID, 84 | @"makeReadable(Ljava/nio/channels/ReadableByteChannel;)Ljava/lang/Readable;": jui.jmethodID, 85 | @"(Ljava/nio/channels/ReadableByteChannel;Ljava/lang/String;)V": jui.jmethodID, 86 | @"(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)V": jui.jmethodID, 87 | @"saveState()V": jui.jmethodID, 88 | @"revertState()V": jui.jmethodID, 89 | @"revertState(Z)Z": jui.jmethodID, 90 | @"cacheResult()V": jui.jmethodID, 91 | @"cacheResult(Ljava/lang/String;)V": jui.jmethodID, 92 | @"clearCaches()V": jui.jmethodID, 93 | @"getCachedResult()Ljava/lang/String;": jui.jmethodID, 94 | @"useTypeCache()V": jui.jmethodID, 95 | @"readInput()V": jui.jmethodID, 96 | @"makeSpace()Z": jui.jmethodID, 97 | @"translateSavedIndexes(I)V": jui.jmethodID, 98 | @"throwFor()V": jui.jmethodID, 99 | @"hasTokenInBuffer()Z": jui.jmethodID, 100 | @"getCompleteTokenInBuffer(Ljava/util/regex/Pattern;)Ljava/lang/String;": jui.jmethodID, 101 | @"findPatternInBuffer(Ljava/util/regex/Pattern;I)Z": jui.jmethodID, 102 | @"matchPatternInBuffer(Ljava/util/regex/Pattern;)Z": jui.jmethodID, 103 | @"ensureOpen()V": jui.jmethodID, 104 | @"close()V": jui.jmethodID, 105 | @"ioException()Ljava/io/IOException;": jui.jmethodID, 106 | @"delimiter()Ljava/util/regex/Pattern;": jui.jmethodID, 107 | @"useDelimiter(Ljava/util/regex/Pattern;)Ljava/util/Scanner;": jui.jmethodID, 108 | @"useDelimiter(Ljava/lang/String;)Ljava/util/Scanner;": jui.jmethodID, 109 | @"locale()Ljava/util/Locale;": jui.jmethodID, 110 | @"useLocale(Ljava/util/Locale;)Ljava/util/Scanner;": jui.jmethodID, 111 | @"radix()I": jui.jmethodID, 112 | @"useRadix(I)Ljava/util/Scanner;": jui.jmethodID, 113 | @"setRadix(I)V": jui.jmethodID, 114 | @"match()Ljava/util/regex/MatchResult;": jui.jmethodID, 115 | @"toString()Ljava/lang/String;": jui.jmethodID, 116 | @"hasNext()Z": jui.jmethodID, 117 | @"next()Ljava/lang/String;": jui.jmethodID, 118 | @"remove()V": jui.jmethodID, 119 | @"hasNext(Ljava/lang/String;)Z": jui.jmethodID, 120 | @"next(Ljava/lang/String;)Ljava/lang/String;": jui.jmethodID, 121 | @"hasNext(Ljava/util/regex/Pattern;)Z": jui.jmethodID, 122 | @"next(Ljava/util/regex/Pattern;)Ljava/lang/String;": jui.jmethodID, 123 | @"hasNextLine()Z": jui.jmethodID, 124 | @"nextLine()Ljava/lang/String;": jui.jmethodID, 125 | @"findInLine(Ljava/lang/String;)Ljava/lang/String;": jui.jmethodID, 126 | @"findInLine(Ljava/util/regex/Pattern;)Ljava/lang/String;": jui.jmethodID, 127 | @"findWithinHorizon(Ljava/lang/String;I)Ljava/lang/String;": jui.jmethodID, 128 | @"findWithinHorizon(Ljava/util/regex/Pattern;I)Ljava/lang/String;": jui.jmethodID, 129 | @"skip(Ljava/util/regex/Pattern;)Ljava/util/Scanner;": jui.jmethodID, 130 | @"skip(Ljava/lang/String;)Ljava/util/Scanner;": jui.jmethodID, 131 | @"hasNextBoolean()Z": jui.jmethodID, 132 | @"nextBoolean()Z": jui.jmethodID, 133 | @"hasNextByte()Z": jui.jmethodID, 134 | @"hasNextByte(I)Z": jui.jmethodID, 135 | @"nextByte()B": jui.jmethodID, 136 | @"nextByte(I)B": jui.jmethodID, 137 | @"hasNextShort()Z": jui.jmethodID, 138 | @"hasNextShort(I)Z": jui.jmethodID, 139 | @"nextShort()S": jui.jmethodID, 140 | @"nextShort(I)S": jui.jmethodID, 141 | @"hasNextInt()Z": jui.jmethodID, 142 | @"hasNextInt(I)Z": jui.jmethodID, 143 | @"processIntegerToken(Ljava/lang/String;)Ljava/lang/String;": jui.jmethodID, 144 | @"nextInt()I": jui.jmethodID, 145 | @"nextInt(I)I": jui.jmethodID, 146 | @"hasNextLong()Z": jui.jmethodID, 147 | @"hasNextLong(I)Z": jui.jmethodID, 148 | @"nextLong()J": jui.jmethodID, 149 | @"nextLong(I)J": jui.jmethodID, 150 | @"processFloatToken(Ljava/lang/String;)Ljava/lang/String;": jui.jmethodID, 151 | @"hasNextFloat()Z": jui.jmethodID, 152 | @"nextFloat()F": jui.jmethodID, 153 | @"hasNextDouble()Z": jui.jmethodID, 154 | @"nextDouble()D": jui.jmethodID, 155 | @"hasNextBigInteger()Z": jui.jmethodID, 156 | @"hasNextBigInteger(I)Z": jui.jmethodID, 157 | @"nextBigInteger()Ljava/math/BigInteger;": jui.jmethodID, 158 | @"nextBigInteger(I)Ljava/math/BigInteger;": jui.jmethodID, 159 | @"hasNextBigDecimal()Z": jui.jmethodID, 160 | @"nextBigDecimal()Ljava/math/BigDecimal;": jui.jmethodID, 161 | @"reset()Ljava/util/Scanner;": jui.jmethodID, 162 | @"tokens()Ljava/util/stream/Stream;": jui.jmethodID, 163 | @"findAll(Ljava/util/regex/Pattern;)Ljava/util/stream/Stream;": jui.jmethodID, 164 | @"findAll(Ljava/lang/String;)Ljava/util/stream/Stream;": jui.jmethodID, 165 | @"next()Ljava/lang/Object;": jui.jmethodID, 166 | @"()V": jui.jmethodID, 167 | } = undefined; 168 | pub fn load(env: *jui.JNIEnv) !void { 169 | struct { 170 | var runner = std.once(_runner); 171 | var _env: *jui.JNIEnv = undefined; 172 | var _err: ?Error = null; 173 | 174 | const Error = 175 | jui.JNIEnv.FindClassError || 176 | jui.JNIEnv.NewReferenceError || 177 | jui.JNIEnv.GetFieldIdError || 178 | jui.JNIEnv.GetMethodIdError || 179 | jui.JNIEnv.GetStaticFieldIdError || 180 | jui.JNIEnv.GetStaticMethodIdError; 181 | 182 | fn _load(arg: *jui.JNIEnv) !void { 183 | _env = arg; 184 | runner.call(); 185 | if (_err) |e| return e; 186 | } 187 | 188 | fn _runner() void { 189 | _run(_env) catch |e| { _err = e; }; 190 | } 191 | 192 | fn _run(inner_env: *jui.JNIEnv) !void { 193 | const class_local = try inner_env.findClass(classpath); 194 | class_global = try inner_env.newReference(.global, class_local); 195 | const class = class_global orelse return error.NoClassDefFoundError; 196 | // 197 | fields = .{ 198 | .@"buf_Ljava/nio/CharBuffer;" = try inner_env.getFieldId(class, "buf", "Ljava/nio/CharBuffer;"), 199 | .@"BUFFER_SIZE_I" = try inner_env.getStaticFieldId(class, "BUFFER_SIZE", "I"), 200 | .@"position_I" = try inner_env.getFieldId(class, "position", "I"), 201 | .@"matcher_Ljava/util/regex/Matcher;" = try inner_env.getFieldId(class, "matcher", "Ljava/util/regex/Matcher;"), 202 | .@"delimPattern_Ljava/util/regex/Pattern;" = try inner_env.getFieldId(class, "delimPattern", "Ljava/util/regex/Pattern;"), 203 | .@"hasNextPattern_Ljava/util/regex/Pattern;" = try inner_env.getFieldId(class, "hasNextPattern", "Ljava/util/regex/Pattern;"), 204 | .@"hasNextPosition_I" = try inner_env.getFieldId(class, "hasNextPosition", "I"), 205 | .@"hasNextResult_Ljava/lang/String;" = try inner_env.getFieldId(class, "hasNextResult", "Ljava/lang/String;"), 206 | .@"source_Ljava/lang/Readable;" = try inner_env.getFieldId(class, "source", "Ljava/lang/Readable;"), 207 | .@"sourceClosed_Z" = try inner_env.getFieldId(class, "sourceClosed", "Z"), 208 | .@"needInput_Z" = try inner_env.getFieldId(class, "needInput", "Z"), 209 | .@"skipped_Z" = try inner_env.getFieldId(class, "skipped", "Z"), 210 | .@"savedScannerPosition_I" = try inner_env.getFieldId(class, "savedScannerPosition", "I"), 211 | .@"typeCache_Ljava/lang/Object;" = try inner_env.getFieldId(class, "typeCache", "Ljava/lang/Object;"), 212 | .@"matchValid_Z" = try inner_env.getFieldId(class, "matchValid", "Z"), 213 | .@"closed_Z" = try inner_env.getFieldId(class, "closed", "Z"), 214 | .@"radix_I" = try inner_env.getFieldId(class, "radix", "I"), 215 | .@"defaultRadix_I" = try inner_env.getFieldId(class, "defaultRadix", "I"), 216 | .@"locale_Ljava/util/Locale;" = try inner_env.getFieldId(class, "locale", "Ljava/util/Locale;"), 217 | .@"patternCache_Ljava/util/Scanner$PatternLRUCache;" = try inner_env.getFieldId(class, "patternCache", "Ljava/util/Scanner$PatternLRUCache;"), 218 | .@"lastException_Ljava/io/IOException;" = try inner_env.getFieldId(class, "lastException", "Ljava/io/IOException;"), 219 | .@"modCount_I" = try inner_env.getFieldId(class, "modCount", "I"), 220 | .@"WHITESPACE_PATTERN_Ljava/util/regex/Pattern;" = try inner_env.getStaticFieldId(class, "WHITESPACE_PATTERN", "Ljava/util/regex/Pattern;"), 221 | .@"FIND_ANY_PATTERN_Ljava/util/regex/Pattern;" = try inner_env.getStaticFieldId(class, "FIND_ANY_PATTERN", "Ljava/util/regex/Pattern;"), 222 | .@"NON_ASCII_DIGIT_Ljava/util/regex/Pattern;" = try inner_env.getStaticFieldId(class, "NON_ASCII_DIGIT", "Ljava/util/regex/Pattern;"), 223 | .@"groupSeparator_Ljava/lang/String;" = try inner_env.getFieldId(class, "groupSeparator", "Ljava/lang/String;"), 224 | .@"decimalSeparator_Ljava/lang/String;" = try inner_env.getFieldId(class, "decimalSeparator", "Ljava/lang/String;"), 225 | .@"nanString_Ljava/lang/String;" = try inner_env.getFieldId(class, "nanString", "Ljava/lang/String;"), 226 | .@"infinityString_Ljava/lang/String;" = try inner_env.getFieldId(class, "infinityString", "Ljava/lang/String;"), 227 | .@"positivePrefix_Ljava/lang/String;" = try inner_env.getFieldId(class, "positivePrefix", "Ljava/lang/String;"), 228 | .@"negativePrefix_Ljava/lang/String;" = try inner_env.getFieldId(class, "negativePrefix", "Ljava/lang/String;"), 229 | .@"positiveSuffix_Ljava/lang/String;" = try inner_env.getFieldId(class, "positiveSuffix", "Ljava/lang/String;"), 230 | .@"negativeSuffix_Ljava/lang/String;" = try inner_env.getFieldId(class, "negativeSuffix", "Ljava/lang/String;"), 231 | .@"boolPattern_Ljava/util/regex/Pattern;" = try inner_env.getStaticFieldId(class, "boolPattern", "Ljava/util/regex/Pattern;"), 232 | .@"BOOLEAN_PATTERN_Ljava/lang/String;" = try inner_env.getStaticFieldId(class, "BOOLEAN_PATTERN", "Ljava/lang/String;"), 233 | .@"integerPattern_Ljava/util/regex/Pattern;" = try inner_env.getFieldId(class, "integerPattern", "Ljava/util/regex/Pattern;"), 234 | .@"digits_Ljava/lang/String;" = try inner_env.getFieldId(class, "digits", "Ljava/lang/String;"), 235 | .@"non0Digit_Ljava/lang/String;" = try inner_env.getFieldId(class, "non0Digit", "Ljava/lang/String;"), 236 | .@"SIMPLE_GROUP_INDEX_I" = try inner_env.getFieldId(class, "SIMPLE_GROUP_INDEX", "I"), 237 | .@"separatorPattern_Ljava/util/regex/Pattern;" = try inner_env.getStaticFieldId(class, "separatorPattern", "Ljava/util/regex/Pattern;"), 238 | .@"linePattern_Ljava/util/regex/Pattern;" = try inner_env.getStaticFieldId(class, "linePattern", "Ljava/util/regex/Pattern;"), 239 | .@"LINE_SEPARATOR_PATTERN_Ljava/lang/String;" = try inner_env.getStaticFieldId(class, "LINE_SEPARATOR_PATTERN", "Ljava/lang/String;"), 240 | .@"LINE_PATTERN_Ljava/lang/String;" = try inner_env.getStaticFieldId(class, "LINE_PATTERN", "Ljava/lang/String;"), 241 | .@"floatPattern_Ljava/util/regex/Pattern;" = try inner_env.getFieldId(class, "floatPattern", "Ljava/util/regex/Pattern;"), 242 | .@"decimalPattern_Ljava/util/regex/Pattern;" = try inner_env.getFieldId(class, "decimalPattern", "Ljava/util/regex/Pattern;"), 243 | .@"$assertionsDisabled_Z" = try inner_env.getStaticFieldId(class, "$assertionsDisabled", "Z"), 244 | }; 245 | methods = .{ 246 | .@"boolPattern()Ljava/util/regex/Pattern;" = try inner_env.getStaticMethodId(class, "boolPattern", "()Ljava/util/regex/Pattern;"), 247 | .@"buildIntegerPatternString()Ljava/lang/String;" = try inner_env.getMethodId(class, "buildIntegerPatternString", "()Ljava/lang/String;"), 248 | .@"integerPattern()Ljava/util/regex/Pattern;" = try inner_env.getMethodId(class, "integerPattern", "()Ljava/util/regex/Pattern;"), 249 | .@"separatorPattern()Ljava/util/regex/Pattern;" = try inner_env.getStaticMethodId(class, "separatorPattern", "()Ljava/util/regex/Pattern;"), 250 | .@"linePattern()Ljava/util/regex/Pattern;" = try inner_env.getStaticMethodId(class, "linePattern", "()Ljava/util/regex/Pattern;"), 251 | .@"buildFloatAndDecimalPattern()V" = try inner_env.getMethodId(class, "buildFloatAndDecimalPattern", "()V"), 252 | .@"floatPattern()Ljava/util/regex/Pattern;" = try inner_env.getMethodId(class, "floatPattern", "()Ljava/util/regex/Pattern;"), 253 | .@"decimalPattern()Ljava/util/regex/Pattern;" = try inner_env.getMethodId(class, "decimalPattern", "()Ljava/util/regex/Pattern;"), 254 | .@"(Ljava/lang/Readable;Ljava/util/regex/Pattern;)V" = try inner_env.getMethodId(class, "", "(Ljava/lang/Readable;Ljava/util/regex/Pattern;)V"), 255 | .@"(Ljava/lang/Readable;)V" = try inner_env.getMethodId(class, "", "(Ljava/lang/Readable;)V"), 256 | .@"(Ljava/io/InputStream;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/InputStream;)V"), 257 | .@"(Ljava/io/InputStream;Ljava/lang/String;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/InputStream;Ljava/lang/String;)V"), 258 | .@"(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V"), 259 | .@"toCharset(Ljava/lang/String;)Ljava/nio/charset/Charset;" = try inner_env.getStaticMethodId(class, "toCharset", "(Ljava/lang/String;)Ljava/nio/charset/Charset;"), 260 | .@"makeReadable(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)Ljava/lang/Readable;" = try inner_env.getStaticMethodId(class, "makeReadable", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)Ljava/lang/Readable;"), 261 | .@"makeReadable(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/Readable;" = try inner_env.getStaticMethodId(class, "makeReadable", "(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/Readable;"), 262 | .@"(Ljava/io/File;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/File;)V"), 263 | .@"(Ljava/io/File;Ljava/lang/String;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/File;Ljava/lang/String;)V"), 264 | .@"(Ljava/io/File;Ljava/nio/charset/Charset;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/File;Ljava/nio/charset/Charset;)V"), 265 | .@"(Ljava/io/File;Ljava/nio/charset/CharsetDecoder;)V" = try inner_env.getMethodId(class, "", "(Ljava/io/File;Ljava/nio/charset/CharsetDecoder;)V"), 266 | .@"toDecoder(Ljava/lang/String;)Ljava/nio/charset/CharsetDecoder;" = try inner_env.getStaticMethodId(class, "toDecoder", "(Ljava/lang/String;)Ljava/nio/charset/CharsetDecoder;"), 267 | .@"makeReadable(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/CharsetDecoder;)Ljava/lang/Readable;" = try inner_env.getStaticMethodId(class, "makeReadable", "(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/CharsetDecoder;)Ljava/lang/Readable;"), 268 | .@"makeReadable(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)Ljava/lang/Readable;" = try inner_env.getStaticMethodId(class, "makeReadable", "(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)Ljava/lang/Readable;"), 269 | .@"(Ljava/nio/file/Path;)V" = try inner_env.getMethodId(class, "", "(Ljava/nio/file/Path;)V"), 270 | .@"(Ljava/nio/file/Path;Ljava/lang/String;)V" = try inner_env.getMethodId(class, "", "(Ljava/nio/file/Path;Ljava/lang/String;)V"), 271 | .@"(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)V" = try inner_env.getMethodId(class, "", "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)V"), 272 | .@"(Ljava/lang/String;)V" = try inner_env.getMethodId(class, "", "(Ljava/lang/String;)V"), 273 | .@"(Ljava/nio/channels/ReadableByteChannel;)V" = try inner_env.getMethodId(class, "", "(Ljava/nio/channels/ReadableByteChannel;)V"), 274 | .@"makeReadable(Ljava/nio/channels/ReadableByteChannel;)Ljava/lang/Readable;" = try inner_env.getStaticMethodId(class, "makeReadable", "(Ljava/nio/channels/ReadableByteChannel;)Ljava/lang/Readable;"), 275 | .@"(Ljava/nio/channels/ReadableByteChannel;Ljava/lang/String;)V" = try inner_env.getMethodId(class, "", "(Ljava/nio/channels/ReadableByteChannel;Ljava/lang/String;)V"), 276 | .@"(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)V" = try inner_env.getMethodId(class, "", "(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)V"), 277 | .@"saveState()V" = try inner_env.getMethodId(class, "saveState", "()V"), 278 | .@"revertState()V" = try inner_env.getMethodId(class, "revertState", "()V"), 279 | .@"revertState(Z)Z" = try inner_env.getMethodId(class, "revertState", "(Z)Z"), 280 | .@"cacheResult()V" = try inner_env.getMethodId(class, "cacheResult", "()V"), 281 | .@"cacheResult(Ljava/lang/String;)V" = try inner_env.getMethodId(class, "cacheResult", "(Ljava/lang/String;)V"), 282 | .@"clearCaches()V" = try inner_env.getMethodId(class, "clearCaches", "()V"), 283 | .@"getCachedResult()Ljava/lang/String;" = try inner_env.getMethodId(class, "getCachedResult", "()Ljava/lang/String;"), 284 | .@"useTypeCache()V" = try inner_env.getMethodId(class, "useTypeCache", "()V"), 285 | .@"readInput()V" = try inner_env.getMethodId(class, "readInput", "()V"), 286 | .@"makeSpace()Z" = try inner_env.getMethodId(class, "makeSpace", "()Z"), 287 | .@"translateSavedIndexes(I)V" = try inner_env.getMethodId(class, "translateSavedIndexes", "(I)V"), 288 | .@"throwFor()V" = try inner_env.getMethodId(class, "throwFor", "()V"), 289 | .@"hasTokenInBuffer()Z" = try inner_env.getMethodId(class, "hasTokenInBuffer", "()Z"), 290 | .@"getCompleteTokenInBuffer(Ljava/util/regex/Pattern;)Ljava/lang/String;" = try inner_env.getMethodId(class, "getCompleteTokenInBuffer", "(Ljava/util/regex/Pattern;)Ljava/lang/String;"), 291 | .@"findPatternInBuffer(Ljava/util/regex/Pattern;I)Z" = try inner_env.getMethodId(class, "findPatternInBuffer", "(Ljava/util/regex/Pattern;I)Z"), 292 | .@"matchPatternInBuffer(Ljava/util/regex/Pattern;)Z" = try inner_env.getMethodId(class, "matchPatternInBuffer", "(Ljava/util/regex/Pattern;)Z"), 293 | .@"ensureOpen()V" = try inner_env.getMethodId(class, "ensureOpen", "()V"), 294 | .@"close()V" = try inner_env.getMethodId(class, "close", "()V"), 295 | .@"ioException()Ljava/io/IOException;" = try inner_env.getMethodId(class, "ioException", "()Ljava/io/IOException;"), 296 | .@"delimiter()Ljava/util/regex/Pattern;" = try inner_env.getMethodId(class, "delimiter", "()Ljava/util/regex/Pattern;"), 297 | .@"useDelimiter(Ljava/util/regex/Pattern;)Ljava/util/Scanner;" = try inner_env.getMethodId(class, "useDelimiter", "(Ljava/util/regex/Pattern;)Ljava/util/Scanner;"), 298 | .@"useDelimiter(Ljava/lang/String;)Ljava/util/Scanner;" = try inner_env.getMethodId(class, "useDelimiter", "(Ljava/lang/String;)Ljava/util/Scanner;"), 299 | .@"locale()Ljava/util/Locale;" = try inner_env.getMethodId(class, "locale", "()Ljava/util/Locale;"), 300 | .@"useLocale(Ljava/util/Locale;)Ljava/util/Scanner;" = try inner_env.getMethodId(class, "useLocale", "(Ljava/util/Locale;)Ljava/util/Scanner;"), 301 | .@"radix()I" = try inner_env.getMethodId(class, "radix", "()I"), 302 | .@"useRadix(I)Ljava/util/Scanner;" = try inner_env.getMethodId(class, "useRadix", "(I)Ljava/util/Scanner;"), 303 | .@"setRadix(I)V" = try inner_env.getMethodId(class, "setRadix", "(I)V"), 304 | .@"match()Ljava/util/regex/MatchResult;" = try inner_env.getMethodId(class, "match", "()Ljava/util/regex/MatchResult;"), 305 | .@"toString()Ljava/lang/String;" = try inner_env.getMethodId(class, "toString", "()Ljava/lang/String;"), 306 | .@"hasNext()Z" = try inner_env.getMethodId(class, "hasNext", "()Z"), 307 | .@"next()Ljava/lang/String;" = try inner_env.getMethodId(class, "next", "()Ljava/lang/String;"), 308 | .@"remove()V" = try inner_env.getMethodId(class, "remove", "()V"), 309 | .@"hasNext(Ljava/lang/String;)Z" = try inner_env.getMethodId(class, "hasNext", "(Ljava/lang/String;)Z"), 310 | .@"next(Ljava/lang/String;)Ljava/lang/String;" = try inner_env.getMethodId(class, "next", "(Ljava/lang/String;)Ljava/lang/String;"), 311 | .@"hasNext(Ljava/util/regex/Pattern;)Z" = try inner_env.getMethodId(class, "hasNext", "(Ljava/util/regex/Pattern;)Z"), 312 | .@"next(Ljava/util/regex/Pattern;)Ljava/lang/String;" = try inner_env.getMethodId(class, "next", "(Ljava/util/regex/Pattern;)Ljava/lang/String;"), 313 | .@"hasNextLine()Z" = try inner_env.getMethodId(class, "hasNextLine", "()Z"), 314 | .@"nextLine()Ljava/lang/String;" = try inner_env.getMethodId(class, "nextLine", "()Ljava/lang/String;"), 315 | .@"findInLine(Ljava/lang/String;)Ljava/lang/String;" = try inner_env.getMethodId(class, "findInLine", "(Ljava/lang/String;)Ljava/lang/String;"), 316 | .@"findInLine(Ljava/util/regex/Pattern;)Ljava/lang/String;" = try inner_env.getMethodId(class, "findInLine", "(Ljava/util/regex/Pattern;)Ljava/lang/String;"), 317 | .@"findWithinHorizon(Ljava/lang/String;I)Ljava/lang/String;" = try inner_env.getMethodId(class, "findWithinHorizon", "(Ljava/lang/String;I)Ljava/lang/String;"), 318 | .@"findWithinHorizon(Ljava/util/regex/Pattern;I)Ljava/lang/String;" = try inner_env.getMethodId(class, "findWithinHorizon", "(Ljava/util/regex/Pattern;I)Ljava/lang/String;"), 319 | .@"skip(Ljava/util/regex/Pattern;)Ljava/util/Scanner;" = try inner_env.getMethodId(class, "skip", "(Ljava/util/regex/Pattern;)Ljava/util/Scanner;"), 320 | .@"skip(Ljava/lang/String;)Ljava/util/Scanner;" = try inner_env.getMethodId(class, "skip", "(Ljava/lang/String;)Ljava/util/Scanner;"), 321 | .@"hasNextBoolean()Z" = try inner_env.getMethodId(class, "hasNextBoolean", "()Z"), 322 | .@"nextBoolean()Z" = try inner_env.getMethodId(class, "nextBoolean", "()Z"), 323 | .@"hasNextByte()Z" = try inner_env.getMethodId(class, "hasNextByte", "()Z"), 324 | .@"hasNextByte(I)Z" = try inner_env.getMethodId(class, "hasNextByte", "(I)Z"), 325 | .@"nextByte()B" = try inner_env.getMethodId(class, "nextByte", "()B"), 326 | .@"nextByte(I)B" = try inner_env.getMethodId(class, "nextByte", "(I)B"), 327 | .@"hasNextShort()Z" = try inner_env.getMethodId(class, "hasNextShort", "()Z"), 328 | .@"hasNextShort(I)Z" = try inner_env.getMethodId(class, "hasNextShort", "(I)Z"), 329 | .@"nextShort()S" = try inner_env.getMethodId(class, "nextShort", "()S"), 330 | .@"nextShort(I)S" = try inner_env.getMethodId(class, "nextShort", "(I)S"), 331 | .@"hasNextInt()Z" = try inner_env.getMethodId(class, "hasNextInt", "()Z"), 332 | .@"hasNextInt(I)Z" = try inner_env.getMethodId(class, "hasNextInt", "(I)Z"), 333 | .@"processIntegerToken(Ljava/lang/String;)Ljava/lang/String;" = try inner_env.getMethodId(class, "processIntegerToken", "(Ljava/lang/String;)Ljava/lang/String;"), 334 | .@"nextInt()I" = try inner_env.getMethodId(class, "nextInt", "()I"), 335 | .@"nextInt(I)I" = try inner_env.getMethodId(class, "nextInt", "(I)I"), 336 | .@"hasNextLong()Z" = try inner_env.getMethodId(class, "hasNextLong", "()Z"), 337 | .@"hasNextLong(I)Z" = try inner_env.getMethodId(class, "hasNextLong", "(I)Z"), 338 | .@"nextLong()J" = try inner_env.getMethodId(class, "nextLong", "()J"), 339 | .@"nextLong(I)J" = try inner_env.getMethodId(class, "nextLong", "(I)J"), 340 | .@"processFloatToken(Ljava/lang/String;)Ljava/lang/String;" = try inner_env.getMethodId(class, "processFloatToken", "(Ljava/lang/String;)Ljava/lang/String;"), 341 | .@"hasNextFloat()Z" = try inner_env.getMethodId(class, "hasNextFloat", "()Z"), 342 | .@"nextFloat()F" = try inner_env.getMethodId(class, "nextFloat", "()F"), 343 | .@"hasNextDouble()Z" = try inner_env.getMethodId(class, "hasNextDouble", "()Z"), 344 | .@"nextDouble()D" = try inner_env.getMethodId(class, "nextDouble", "()D"), 345 | .@"hasNextBigInteger()Z" = try inner_env.getMethodId(class, "hasNextBigInteger", "()Z"), 346 | .@"hasNextBigInteger(I)Z" = try inner_env.getMethodId(class, "hasNextBigInteger", "(I)Z"), 347 | .@"nextBigInteger()Ljava/math/BigInteger;" = try inner_env.getMethodId(class, "nextBigInteger", "()Ljava/math/BigInteger;"), 348 | .@"nextBigInteger(I)Ljava/math/BigInteger;" = try inner_env.getMethodId(class, "nextBigInteger", "(I)Ljava/math/BigInteger;"), 349 | .@"hasNextBigDecimal()Z" = try inner_env.getMethodId(class, "hasNextBigDecimal", "()Z"), 350 | .@"nextBigDecimal()Ljava/math/BigDecimal;" = try inner_env.getMethodId(class, "nextBigDecimal", "()Ljava/math/BigDecimal;"), 351 | .@"reset()Ljava/util/Scanner;" = try inner_env.getMethodId(class, "reset", "()Ljava/util/Scanner;"), 352 | .@"tokens()Ljava/util/stream/Stream;" = try inner_env.getMethodId(class, "tokens", "()Ljava/util/stream/Stream;"), 353 | .@"findAll(Ljava/util/regex/Pattern;)Ljava/util/stream/Stream;" = try inner_env.getMethodId(class, "findAll", "(Ljava/util/regex/Pattern;)Ljava/util/stream/Stream;"), 354 | .@"findAll(Ljava/lang/String;)Ljava/util/stream/Stream;" = try inner_env.getMethodId(class, "findAll", "(Ljava/lang/String;)Ljava/util/stream/Stream;"), 355 | .@"next()Ljava/lang/Object;" = try inner_env.getMethodId(class, "next", "()Ljava/lang/Object;"), 356 | .@"()V" = try inner_env.getStaticMethodId(class, "", "()V"), 357 | }; 358 | 359 | } 360 | }._load(env) catch |e| return e; 361 | } 362 | pub fn @"get_buf_Ljava/nio/CharBuffer;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 363 | try load(env); 364 | _ = class_global orelse return error.ClassNotFound; 365 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"buf_Ljava/nio/CharBuffer;"); 366 | } 367 | pub fn @"set_buf_Ljava/nio/CharBuffer;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 368 | try load(env); 369 | _ = class_global orelse return error.ClassNotFound; 370 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"buf_Ljava/nio/CharBuffer;", arg); 371 | } 372 | pub fn @"get_BUFFER_SIZE_I"(env: *jui.JNIEnv) !jui.jint { 373 | try load(env); 374 | const class = class_global orelse return error.ClassNotFound; 375 | return env.getStaticField(.int, class, fields.@"BUFFER_SIZE_I"); 376 | } 377 | pub fn @"get_position_I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 378 | try load(env); 379 | _ = class_global orelse return error.ClassNotFound; 380 | return env.getField(.int, @ptrCast(jui.jobject, self), fields.@"position_I"); 381 | } 382 | pub fn @"set_position_I"(self: *@This(), env: *jui.JNIEnv, arg: jui.jint) !void { 383 | try load(env); 384 | _ = class_global orelse return error.ClassNotFound; 385 | try env.callField(.int, @ptrCast(jui.jobject, self), fields.@"position_I", arg); 386 | } 387 | pub fn @"get_matcher_Ljava/util/regex/Matcher;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 388 | try load(env); 389 | _ = class_global orelse return error.ClassNotFound; 390 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"matcher_Ljava/util/regex/Matcher;"); 391 | } 392 | pub fn @"set_matcher_Ljava/util/regex/Matcher;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 393 | try load(env); 394 | _ = class_global orelse return error.ClassNotFound; 395 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"matcher_Ljava/util/regex/Matcher;", arg); 396 | } 397 | pub fn @"get_delimPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 398 | try load(env); 399 | _ = class_global orelse return error.ClassNotFound; 400 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"delimPattern_Ljava/util/regex/Pattern;"); 401 | } 402 | pub fn @"set_delimPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 403 | try load(env); 404 | _ = class_global orelse return error.ClassNotFound; 405 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"delimPattern_Ljava/util/regex/Pattern;", arg); 406 | } 407 | pub fn @"get_hasNextPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 408 | try load(env); 409 | _ = class_global orelse return error.ClassNotFound; 410 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"hasNextPattern_Ljava/util/regex/Pattern;"); 411 | } 412 | pub fn @"set_hasNextPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 413 | try load(env); 414 | _ = class_global orelse return error.ClassNotFound; 415 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"hasNextPattern_Ljava/util/regex/Pattern;", arg); 416 | } 417 | pub fn @"get_hasNextPosition_I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 418 | try load(env); 419 | _ = class_global orelse return error.ClassNotFound; 420 | return env.getField(.int, @ptrCast(jui.jobject, self), fields.@"hasNextPosition_I"); 421 | } 422 | pub fn @"set_hasNextPosition_I"(self: *@This(), env: *jui.JNIEnv, arg: jui.jint) !void { 423 | try load(env); 424 | _ = class_global orelse return error.ClassNotFound; 425 | try env.callField(.int, @ptrCast(jui.jobject, self), fields.@"hasNextPosition_I", arg); 426 | } 427 | pub fn @"get_hasNextResult_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 428 | try load(env); 429 | _ = class_global orelse return error.ClassNotFound; 430 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"hasNextResult_Ljava/lang/String;"); 431 | } 432 | pub fn @"set_hasNextResult_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 433 | try load(env); 434 | _ = class_global orelse return error.ClassNotFound; 435 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"hasNextResult_Ljava/lang/String;", arg); 436 | } 437 | pub fn @"get_source_Ljava/lang/Readable;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 438 | try load(env); 439 | _ = class_global orelse return error.ClassNotFound; 440 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"source_Ljava/lang/Readable;"); 441 | } 442 | pub fn @"set_source_Ljava/lang/Readable;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 443 | try load(env); 444 | _ = class_global orelse return error.ClassNotFound; 445 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"source_Ljava/lang/Readable;", arg); 446 | } 447 | pub fn @"get_sourceClosed_Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 448 | try load(env); 449 | _ = class_global orelse return error.ClassNotFound; 450 | return env.getField(.boolean, @ptrCast(jui.jobject, self), fields.@"sourceClosed_Z"); 451 | } 452 | pub fn @"set_sourceClosed_Z"(self: *@This(), env: *jui.JNIEnv, arg: jui.jboolean) !void { 453 | try load(env); 454 | _ = class_global orelse return error.ClassNotFound; 455 | try env.callField(.boolean, @ptrCast(jui.jobject, self), fields.@"sourceClosed_Z", arg); 456 | } 457 | pub fn @"get_needInput_Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 458 | try load(env); 459 | _ = class_global orelse return error.ClassNotFound; 460 | return env.getField(.boolean, @ptrCast(jui.jobject, self), fields.@"needInput_Z"); 461 | } 462 | pub fn @"set_needInput_Z"(self: *@This(), env: *jui.JNIEnv, arg: jui.jboolean) !void { 463 | try load(env); 464 | _ = class_global orelse return error.ClassNotFound; 465 | try env.callField(.boolean, @ptrCast(jui.jobject, self), fields.@"needInput_Z", arg); 466 | } 467 | pub fn @"get_skipped_Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 468 | try load(env); 469 | _ = class_global orelse return error.ClassNotFound; 470 | return env.getField(.boolean, @ptrCast(jui.jobject, self), fields.@"skipped_Z"); 471 | } 472 | pub fn @"set_skipped_Z"(self: *@This(), env: *jui.JNIEnv, arg: jui.jboolean) !void { 473 | try load(env); 474 | _ = class_global orelse return error.ClassNotFound; 475 | try env.callField(.boolean, @ptrCast(jui.jobject, self), fields.@"skipped_Z", arg); 476 | } 477 | pub fn @"get_savedScannerPosition_I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 478 | try load(env); 479 | _ = class_global orelse return error.ClassNotFound; 480 | return env.getField(.int, @ptrCast(jui.jobject, self), fields.@"savedScannerPosition_I"); 481 | } 482 | pub fn @"set_savedScannerPosition_I"(self: *@This(), env: *jui.JNIEnv, arg: jui.jint) !void { 483 | try load(env); 484 | _ = class_global orelse return error.ClassNotFound; 485 | try env.callField(.int, @ptrCast(jui.jobject, self), fields.@"savedScannerPosition_I", arg); 486 | } 487 | pub fn @"get_typeCache_Ljava/lang/Object;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 488 | try load(env); 489 | _ = class_global orelse return error.ClassNotFound; 490 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"typeCache_Ljava/lang/Object;"); 491 | } 492 | pub fn @"set_typeCache_Ljava/lang/Object;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 493 | try load(env); 494 | _ = class_global orelse return error.ClassNotFound; 495 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"typeCache_Ljava/lang/Object;", arg); 496 | } 497 | pub fn @"get_matchValid_Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 498 | try load(env); 499 | _ = class_global orelse return error.ClassNotFound; 500 | return env.getField(.boolean, @ptrCast(jui.jobject, self), fields.@"matchValid_Z"); 501 | } 502 | pub fn @"set_matchValid_Z"(self: *@This(), env: *jui.JNIEnv, arg: jui.jboolean) !void { 503 | try load(env); 504 | _ = class_global orelse return error.ClassNotFound; 505 | try env.callField(.boolean, @ptrCast(jui.jobject, self), fields.@"matchValid_Z", arg); 506 | } 507 | pub fn @"get_closed_Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 508 | try load(env); 509 | _ = class_global orelse return error.ClassNotFound; 510 | return env.getField(.boolean, @ptrCast(jui.jobject, self), fields.@"closed_Z"); 511 | } 512 | pub fn @"set_closed_Z"(self: *@This(), env: *jui.JNIEnv, arg: jui.jboolean) !void { 513 | try load(env); 514 | _ = class_global orelse return error.ClassNotFound; 515 | try env.callField(.boolean, @ptrCast(jui.jobject, self), fields.@"closed_Z", arg); 516 | } 517 | pub fn @"get_radix_I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 518 | try load(env); 519 | _ = class_global orelse return error.ClassNotFound; 520 | return env.getField(.int, @ptrCast(jui.jobject, self), fields.@"radix_I"); 521 | } 522 | pub fn @"set_radix_I"(self: *@This(), env: *jui.JNIEnv, arg: jui.jint) !void { 523 | try load(env); 524 | _ = class_global orelse return error.ClassNotFound; 525 | try env.callField(.int, @ptrCast(jui.jobject, self), fields.@"radix_I", arg); 526 | } 527 | pub fn @"get_defaultRadix_I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 528 | try load(env); 529 | _ = class_global orelse return error.ClassNotFound; 530 | return env.getField(.int, @ptrCast(jui.jobject, self), fields.@"defaultRadix_I"); 531 | } 532 | pub fn @"set_defaultRadix_I"(self: *@This(), env: *jui.JNIEnv, arg: jui.jint) !void { 533 | try load(env); 534 | _ = class_global orelse return error.ClassNotFound; 535 | try env.callField(.int, @ptrCast(jui.jobject, self), fields.@"defaultRadix_I", arg); 536 | } 537 | pub fn @"get_locale_Ljava/util/Locale;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 538 | try load(env); 539 | _ = class_global orelse return error.ClassNotFound; 540 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"locale_Ljava/util/Locale;"); 541 | } 542 | pub fn @"set_locale_Ljava/util/Locale;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 543 | try load(env); 544 | _ = class_global orelse return error.ClassNotFound; 545 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"locale_Ljava/util/Locale;", arg); 546 | } 547 | pub fn @"get_patternCache_Ljava/util/Scanner$PatternLRUCache;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 548 | try load(env); 549 | _ = class_global orelse return error.ClassNotFound; 550 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"patternCache_Ljava/util/Scanner$PatternLRUCache;"); 551 | } 552 | pub fn @"set_patternCache_Ljava/util/Scanner$PatternLRUCache;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 553 | try load(env); 554 | _ = class_global orelse return error.ClassNotFound; 555 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"patternCache_Ljava/util/Scanner$PatternLRUCache;", arg); 556 | } 557 | pub fn @"get_lastException_Ljava/io/IOException;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 558 | try load(env); 559 | _ = class_global orelse return error.ClassNotFound; 560 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"lastException_Ljava/io/IOException;"); 561 | } 562 | pub fn @"set_lastException_Ljava/io/IOException;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 563 | try load(env); 564 | _ = class_global orelse return error.ClassNotFound; 565 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"lastException_Ljava/io/IOException;", arg); 566 | } 567 | pub fn @"get_modCount_I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 568 | try load(env); 569 | _ = class_global orelse return error.ClassNotFound; 570 | return env.getField(.int, @ptrCast(jui.jobject, self), fields.@"modCount_I"); 571 | } 572 | pub fn @"set_modCount_I"(self: *@This(), env: *jui.JNIEnv, arg: jui.jint) !void { 573 | try load(env); 574 | _ = class_global orelse return error.ClassNotFound; 575 | try env.callField(.int, @ptrCast(jui.jobject, self), fields.@"modCount_I", arg); 576 | } 577 | pub fn @"get_WHITESPACE_PATTERN_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv) !jui.jobject { 578 | try load(env); 579 | const class = class_global orelse return error.ClassNotFound; 580 | return env.getStaticField(.object, class, fields.@"WHITESPACE_PATTERN_Ljava/util/regex/Pattern;"); 581 | } 582 | pub fn @"set_WHITESPACE_PATTERN_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv, arg: jui.jobject) !void { 583 | try load(env); 584 | const class = class_global orelse return error.ClassNotFound; 585 | try env.callStaticField(.object, class, fields.@"WHITESPACE_PATTERN_Ljava/util/regex/Pattern;", arg); 586 | } 587 | pub fn @"get_FIND_ANY_PATTERN_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv) !jui.jobject { 588 | try load(env); 589 | const class = class_global orelse return error.ClassNotFound; 590 | return env.getStaticField(.object, class, fields.@"FIND_ANY_PATTERN_Ljava/util/regex/Pattern;"); 591 | } 592 | pub fn @"set_FIND_ANY_PATTERN_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv, arg: jui.jobject) !void { 593 | try load(env); 594 | const class = class_global orelse return error.ClassNotFound; 595 | try env.callStaticField(.object, class, fields.@"FIND_ANY_PATTERN_Ljava/util/regex/Pattern;", arg); 596 | } 597 | pub fn @"get_NON_ASCII_DIGIT_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv) !jui.jobject { 598 | try load(env); 599 | const class = class_global orelse return error.ClassNotFound; 600 | return env.getStaticField(.object, class, fields.@"NON_ASCII_DIGIT_Ljava/util/regex/Pattern;"); 601 | } 602 | pub fn @"set_NON_ASCII_DIGIT_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv, arg: jui.jobject) !void { 603 | try load(env); 604 | const class = class_global orelse return error.ClassNotFound; 605 | try env.callStaticField(.object, class, fields.@"NON_ASCII_DIGIT_Ljava/util/regex/Pattern;", arg); 606 | } 607 | pub fn @"get_groupSeparator_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 608 | try load(env); 609 | _ = class_global orelse return error.ClassNotFound; 610 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"groupSeparator_Ljava/lang/String;"); 611 | } 612 | pub fn @"set_groupSeparator_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 613 | try load(env); 614 | _ = class_global orelse return error.ClassNotFound; 615 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"groupSeparator_Ljava/lang/String;", arg); 616 | } 617 | pub fn @"get_decimalSeparator_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 618 | try load(env); 619 | _ = class_global orelse return error.ClassNotFound; 620 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"decimalSeparator_Ljava/lang/String;"); 621 | } 622 | pub fn @"set_decimalSeparator_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 623 | try load(env); 624 | _ = class_global orelse return error.ClassNotFound; 625 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"decimalSeparator_Ljava/lang/String;", arg); 626 | } 627 | pub fn @"get_nanString_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 628 | try load(env); 629 | _ = class_global orelse return error.ClassNotFound; 630 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"nanString_Ljava/lang/String;"); 631 | } 632 | pub fn @"set_nanString_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 633 | try load(env); 634 | _ = class_global orelse return error.ClassNotFound; 635 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"nanString_Ljava/lang/String;", arg); 636 | } 637 | pub fn @"get_infinityString_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 638 | try load(env); 639 | _ = class_global orelse return error.ClassNotFound; 640 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"infinityString_Ljava/lang/String;"); 641 | } 642 | pub fn @"set_infinityString_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 643 | try load(env); 644 | _ = class_global orelse return error.ClassNotFound; 645 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"infinityString_Ljava/lang/String;", arg); 646 | } 647 | pub fn @"get_positivePrefix_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 648 | try load(env); 649 | _ = class_global orelse return error.ClassNotFound; 650 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"positivePrefix_Ljava/lang/String;"); 651 | } 652 | pub fn @"set_positivePrefix_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 653 | try load(env); 654 | _ = class_global orelse return error.ClassNotFound; 655 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"positivePrefix_Ljava/lang/String;", arg); 656 | } 657 | pub fn @"get_negativePrefix_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 658 | try load(env); 659 | _ = class_global orelse return error.ClassNotFound; 660 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"negativePrefix_Ljava/lang/String;"); 661 | } 662 | pub fn @"set_negativePrefix_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 663 | try load(env); 664 | _ = class_global orelse return error.ClassNotFound; 665 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"negativePrefix_Ljava/lang/String;", arg); 666 | } 667 | pub fn @"get_positiveSuffix_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 668 | try load(env); 669 | _ = class_global orelse return error.ClassNotFound; 670 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"positiveSuffix_Ljava/lang/String;"); 671 | } 672 | pub fn @"set_positiveSuffix_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 673 | try load(env); 674 | _ = class_global orelse return error.ClassNotFound; 675 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"positiveSuffix_Ljava/lang/String;", arg); 676 | } 677 | pub fn @"get_negativeSuffix_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 678 | try load(env); 679 | _ = class_global orelse return error.ClassNotFound; 680 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"negativeSuffix_Ljava/lang/String;"); 681 | } 682 | pub fn @"set_negativeSuffix_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 683 | try load(env); 684 | _ = class_global orelse return error.ClassNotFound; 685 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"negativeSuffix_Ljava/lang/String;", arg); 686 | } 687 | pub fn @"get_boolPattern_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv) !jui.jobject { 688 | try load(env); 689 | const class = class_global orelse return error.ClassNotFound; 690 | return env.getStaticField(.object, class, fields.@"boolPattern_Ljava/util/regex/Pattern;"); 691 | } 692 | pub fn @"set_boolPattern_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv, arg: jui.jobject) !void { 693 | try load(env); 694 | const class = class_global orelse return error.ClassNotFound; 695 | try env.callStaticField(.object, class, fields.@"boolPattern_Ljava/util/regex/Pattern;", arg); 696 | } 697 | pub fn @"get_BOOLEAN_PATTERN_Ljava/lang/String;"(env: *jui.JNIEnv) !jui.jobject { 698 | try load(env); 699 | const class = class_global orelse return error.ClassNotFound; 700 | return env.getStaticField(.object, class, fields.@"BOOLEAN_PATTERN_Ljava/lang/String;"); 701 | } 702 | pub fn @"get_integerPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 703 | try load(env); 704 | _ = class_global orelse return error.ClassNotFound; 705 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"integerPattern_Ljava/util/regex/Pattern;"); 706 | } 707 | pub fn @"set_integerPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 708 | try load(env); 709 | _ = class_global orelse return error.ClassNotFound; 710 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"integerPattern_Ljava/util/regex/Pattern;", arg); 711 | } 712 | pub fn @"get_digits_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 713 | try load(env); 714 | _ = class_global orelse return error.ClassNotFound; 715 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"digits_Ljava/lang/String;"); 716 | } 717 | pub fn @"set_digits_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 718 | try load(env); 719 | _ = class_global orelse return error.ClassNotFound; 720 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"digits_Ljava/lang/String;", arg); 721 | } 722 | pub fn @"get_non0Digit_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 723 | try load(env); 724 | _ = class_global orelse return error.ClassNotFound; 725 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"non0Digit_Ljava/lang/String;"); 726 | } 727 | pub fn @"set_non0Digit_Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 728 | try load(env); 729 | _ = class_global orelse return error.ClassNotFound; 730 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"non0Digit_Ljava/lang/String;", arg); 731 | } 732 | pub fn @"get_SIMPLE_GROUP_INDEX_I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 733 | try load(env); 734 | _ = class_global orelse return error.ClassNotFound; 735 | return env.getField(.int, @ptrCast(jui.jobject, self), fields.@"SIMPLE_GROUP_INDEX_I"); 736 | } 737 | pub fn @"set_SIMPLE_GROUP_INDEX_I"(self: *@This(), env: *jui.JNIEnv, arg: jui.jint) !void { 738 | try load(env); 739 | _ = class_global orelse return error.ClassNotFound; 740 | try env.callField(.int, @ptrCast(jui.jobject, self), fields.@"SIMPLE_GROUP_INDEX_I", arg); 741 | } 742 | pub fn @"get_separatorPattern_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv) !jui.jobject { 743 | try load(env); 744 | const class = class_global orelse return error.ClassNotFound; 745 | return env.getStaticField(.object, class, fields.@"separatorPattern_Ljava/util/regex/Pattern;"); 746 | } 747 | pub fn @"set_separatorPattern_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv, arg: jui.jobject) !void { 748 | try load(env); 749 | const class = class_global orelse return error.ClassNotFound; 750 | try env.callStaticField(.object, class, fields.@"separatorPattern_Ljava/util/regex/Pattern;", arg); 751 | } 752 | pub fn @"get_linePattern_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv) !jui.jobject { 753 | try load(env); 754 | const class = class_global orelse return error.ClassNotFound; 755 | return env.getStaticField(.object, class, fields.@"linePattern_Ljava/util/regex/Pattern;"); 756 | } 757 | pub fn @"set_linePattern_Ljava/util/regex/Pattern;"(env: *jui.JNIEnv, arg: jui.jobject) !void { 758 | try load(env); 759 | const class = class_global orelse return error.ClassNotFound; 760 | try env.callStaticField(.object, class, fields.@"linePattern_Ljava/util/regex/Pattern;", arg); 761 | } 762 | pub fn @"get_LINE_SEPARATOR_PATTERN_Ljava/lang/String;"(env: *jui.JNIEnv) !jui.jobject { 763 | try load(env); 764 | const class = class_global orelse return error.ClassNotFound; 765 | return env.getStaticField(.object, class, fields.@"LINE_SEPARATOR_PATTERN_Ljava/lang/String;"); 766 | } 767 | pub fn @"get_LINE_PATTERN_Ljava/lang/String;"(env: *jui.JNIEnv) !jui.jobject { 768 | try load(env); 769 | const class = class_global orelse return error.ClassNotFound; 770 | return env.getStaticField(.object, class, fields.@"LINE_PATTERN_Ljava/lang/String;"); 771 | } 772 | pub fn @"get_floatPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 773 | try load(env); 774 | _ = class_global orelse return error.ClassNotFound; 775 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"floatPattern_Ljava/util/regex/Pattern;"); 776 | } 777 | pub fn @"set_floatPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 778 | try load(env); 779 | _ = class_global orelse return error.ClassNotFound; 780 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"floatPattern_Ljava/util/regex/Pattern;", arg); 781 | } 782 | pub fn @"get_decimalPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 783 | try load(env); 784 | _ = class_global orelse return error.ClassNotFound; 785 | return env.getField(.object, @ptrCast(jui.jobject, self), fields.@"decimalPattern_Ljava/util/regex/Pattern;"); 786 | } 787 | pub fn @"set_decimalPattern_Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv, arg: jui.jobject) !void { 788 | try load(env); 789 | _ = class_global orelse return error.ClassNotFound; 790 | try env.callField(.object, @ptrCast(jui.jobject, self), fields.@"decimalPattern_Ljava/util/regex/Pattern;", arg); 791 | } 792 | pub fn @"get_$assertionsDisabled_Z"(env: *jui.JNIEnv) !jui.jboolean { 793 | try load(env); 794 | const class = class_global orelse return error.ClassNotFound; 795 | return env.getStaticField(.boolean, class, fields.@"$assertionsDisabled_Z"); 796 | } 797 | pub fn @"boolPattern()Ljava/util/regex/Pattern;"(env: *jui.JNIEnv) !jui.jobject { 798 | try load(env); 799 | const class = class_global orelse return error.ClassNotFound; 800 | return env.callStaticMethod(.object, class, methods.@"boolPattern()Ljava/util/regex/Pattern;", null); 801 | } 802 | pub fn @"buildIntegerPatternString()Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 803 | try load(env); 804 | _ = class_global orelse return error.ClassNotFound; 805 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"buildIntegerPatternString()Ljava/lang/String;", null); 806 | } 807 | pub fn @"integerPattern()Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 808 | try load(env); 809 | _ = class_global orelse return error.ClassNotFound; 810 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"integerPattern()Ljava/util/regex/Pattern;", null); 811 | } 812 | pub fn @"separatorPattern()Ljava/util/regex/Pattern;"(env: *jui.JNIEnv) !jui.jobject { 813 | try load(env); 814 | const class = class_global orelse return error.ClassNotFound; 815 | return env.callStaticMethod(.object, class, methods.@"separatorPattern()Ljava/util/regex/Pattern;", null); 816 | } 817 | pub fn @"linePattern()Ljava/util/regex/Pattern;"(env: *jui.JNIEnv) !jui.jobject { 818 | try load(env); 819 | const class = class_global orelse return error.ClassNotFound; 820 | return env.callStaticMethod(.object, class, methods.@"linePattern()Ljava/util/regex/Pattern;", null); 821 | } 822 | pub fn @"buildFloatAndDecimalPattern()V"(self: *@This(), env: *jui.JNIEnv) !void { 823 | try load(env); 824 | _ = class_global orelse return error.ClassNotFound; 825 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"buildFloatAndDecimalPattern()V", null); 826 | } 827 | pub fn @"floatPattern()Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 828 | try load(env); 829 | _ = class_global orelse return error.ClassNotFound; 830 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"floatPattern()Ljava/util/regex/Pattern;", null); 831 | } 832 | pub fn @"decimalPattern()Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 833 | try load(env); 834 | _ = class_global orelse return error.ClassNotFound; 835 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"decimalPattern()Ljava/util/regex/Pattern;", null); 836 | } 837 | pub fn @"(Ljava/lang/Readable;Ljava/util/regex/Pattern;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 838 | try load(env); 839 | const class = class_global orelse return error.ClassNotLoaded; 840 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/lang/Readable;Ljava/util/regex/Pattern;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 841 | } 842 | pub fn @"(Ljava/lang/Readable;)V"(env: *jui.JNIEnv, arg0: jui.jobject) !*@This() { 843 | try load(env); 844 | const class = class_global orelse return error.ClassNotLoaded; 845 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/lang/Readable;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)})); 846 | } 847 | pub fn @"(Ljava/io/InputStream;)V"(env: *jui.JNIEnv, arg0: jui.jobject) !*@This() { 848 | try load(env); 849 | const class = class_global orelse return error.ClassNotLoaded; 850 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/InputStream;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)})); 851 | } 852 | pub fn @"(Ljava/io/InputStream;Ljava/lang/String;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 853 | try load(env); 854 | const class = class_global orelse return error.ClassNotLoaded; 855 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/InputStream;Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 856 | } 857 | pub fn @"(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 858 | try load(env); 859 | const class = class_global orelse return error.ClassNotLoaded; 860 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 861 | } 862 | pub fn @"toCharset(Ljava/lang/String;)Ljava/nio/charset/Charset;"(env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 863 | try load(env); 864 | const class = class_global orelse return error.ClassNotFound; 865 | return env.callStaticMethod(.object, class, methods.@"toCharset(Ljava/lang/String;)Ljava/nio/charset/Charset;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 866 | } 867 | pub fn @"makeReadable(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)Ljava/lang/Readable;"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !jui.jobject { 868 | try load(env); 869 | const class = class_global orelse return error.ClassNotFound; 870 | return env.callStaticMethod(.object, class, methods.@"makeReadable(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)Ljava/lang/Readable;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 871 | } 872 | pub fn @"makeReadable(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/Readable;"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !jui.jobject { 873 | try load(env); 874 | const class = class_global orelse return error.ClassNotFound; 875 | return env.callStaticMethod(.object, class, methods.@"makeReadable(Ljava/io/InputStream;Ljava/nio/charset/Charset;)Ljava/lang/Readable;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 876 | } 877 | pub fn @"(Ljava/io/File;)V"(env: *jui.JNIEnv, arg0: jui.jobject) !*@This() { 878 | try load(env); 879 | const class = class_global orelse return error.ClassNotLoaded; 880 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/File;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)})); 881 | } 882 | pub fn @"(Ljava/io/File;Ljava/lang/String;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 883 | try load(env); 884 | const class = class_global orelse return error.ClassNotLoaded; 885 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/File;Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 886 | } 887 | pub fn @"(Ljava/io/File;Ljava/nio/charset/Charset;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 888 | try load(env); 889 | const class = class_global orelse return error.ClassNotLoaded; 890 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/File;Ljava/nio/charset/Charset;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 891 | } 892 | pub fn @"(Ljava/io/File;Ljava/nio/charset/CharsetDecoder;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 893 | try load(env); 894 | const class = class_global orelse return error.ClassNotLoaded; 895 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/io/File;Ljava/nio/charset/CharsetDecoder;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 896 | } 897 | pub fn @"toDecoder(Ljava/lang/String;)Ljava/nio/charset/CharsetDecoder;"(env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 898 | try load(env); 899 | const class = class_global orelse return error.ClassNotFound; 900 | return env.callStaticMethod(.object, class, methods.@"toDecoder(Ljava/lang/String;)Ljava/nio/charset/CharsetDecoder;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 901 | } 902 | pub fn @"makeReadable(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/CharsetDecoder;)Ljava/lang/Readable;"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !jui.jobject { 903 | try load(env); 904 | const class = class_global orelse return error.ClassNotFound; 905 | return env.callStaticMethod(.object, class, methods.@"makeReadable(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/CharsetDecoder;)Ljava/lang/Readable;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 906 | } 907 | pub fn @"makeReadable(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)Ljava/lang/Readable;"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !jui.jobject { 908 | try load(env); 909 | const class = class_global orelse return error.ClassNotFound; 910 | return env.callStaticMethod(.object, class, methods.@"makeReadable(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)Ljava/lang/Readable;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 911 | } 912 | pub fn @"(Ljava/nio/file/Path;)V"(env: *jui.JNIEnv, arg0: jui.jobject) !*@This() { 913 | try load(env); 914 | const class = class_global orelse return error.ClassNotLoaded; 915 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/nio/file/Path;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)})); 916 | } 917 | pub fn @"(Ljava/nio/file/Path;Ljava/lang/String;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 918 | try load(env); 919 | const class = class_global orelse return error.ClassNotLoaded; 920 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/nio/file/Path;Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 921 | } 922 | pub fn @"(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 923 | try load(env); 924 | const class = class_global orelse return error.ClassNotLoaded; 925 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 926 | } 927 | pub fn @"(Ljava/lang/String;)V"(env: *jui.JNIEnv, arg0: jui.jobject) !*@This() { 928 | try load(env); 929 | const class = class_global orelse return error.ClassNotLoaded; 930 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)})); 931 | } 932 | pub fn @"(Ljava/nio/channels/ReadableByteChannel;)V"(env: *jui.JNIEnv, arg0: jui.jobject) !*@This() { 933 | try load(env); 934 | const class = class_global orelse return error.ClassNotLoaded; 935 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/nio/channels/ReadableByteChannel;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)})); 936 | } 937 | pub fn @"makeReadable(Ljava/nio/channels/ReadableByteChannel;)Ljava/lang/Readable;"(env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 938 | try load(env); 939 | const class = class_global orelse return error.ClassNotFound; 940 | return env.callStaticMethod(.object, class, methods.@"makeReadable(Ljava/nio/channels/ReadableByteChannel;)Ljava/lang/Readable;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 941 | } 942 | pub fn @"(Ljava/nio/channels/ReadableByteChannel;Ljava/lang/String;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 943 | try load(env); 944 | const class = class_global orelse return error.ClassNotLoaded; 945 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/nio/channels/ReadableByteChannel;Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 946 | } 947 | pub fn @"(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)V"(env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jobject) !*@This() { 948 | try load(env); 949 | const class = class_global orelse return error.ClassNotLoaded; 950 | return @ptrCast(*@This(), try env.newObject(class, methods.@"(Ljava/nio/channels/ReadableByteChannel;Ljava/nio/charset/Charset;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)})); 951 | } 952 | pub fn @"saveState()V"(self: *@This(), env: *jui.JNIEnv) !void { 953 | try load(env); 954 | _ = class_global orelse return error.ClassNotFound; 955 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"saveState()V", null); 956 | } 957 | pub fn @"revertState()V"(self: *@This(), env: *jui.JNIEnv) !void { 958 | try load(env); 959 | _ = class_global orelse return error.ClassNotFound; 960 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"revertState()V", null); 961 | } 962 | pub fn @"revertState(Z)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jboolean) !jui.jboolean { 963 | try load(env); 964 | _ = class_global orelse return error.ClassNotFound; 965 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"revertState(Z)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 966 | } 967 | pub fn @"cacheResult()V"(self: *@This(), env: *jui.JNIEnv) !void { 968 | try load(env); 969 | _ = class_global orelse return error.ClassNotFound; 970 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"cacheResult()V", null); 971 | } 972 | pub fn @"cacheResult(Ljava/lang/String;)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !void { 973 | try load(env); 974 | _ = class_global orelse return error.ClassNotFound; 975 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"cacheResult(Ljava/lang/String;)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 976 | } 977 | pub fn @"clearCaches()V"(self: *@This(), env: *jui.JNIEnv) !void { 978 | try load(env); 979 | _ = class_global orelse return error.ClassNotFound; 980 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"clearCaches()V", null); 981 | } 982 | pub fn @"getCachedResult()Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 983 | try load(env); 984 | _ = class_global orelse return error.ClassNotFound; 985 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"getCachedResult()Ljava/lang/String;", null); 986 | } 987 | pub fn @"useTypeCache()V"(self: *@This(), env: *jui.JNIEnv) !void { 988 | try load(env); 989 | _ = class_global orelse return error.ClassNotFound; 990 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"useTypeCache()V", null); 991 | } 992 | pub fn @"readInput()V"(self: *@This(), env: *jui.JNIEnv) !void { 993 | try load(env); 994 | _ = class_global orelse return error.ClassNotFound; 995 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"readInput()V", null); 996 | } 997 | pub fn @"makeSpace()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 998 | try load(env); 999 | _ = class_global orelse return error.ClassNotFound; 1000 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"makeSpace()Z", null); 1001 | } 1002 | pub fn @"translateSavedIndexes(I)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !void { 1003 | try load(env); 1004 | _ = class_global orelse return error.ClassNotFound; 1005 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"translateSavedIndexes(I)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1006 | } 1007 | pub fn @"throwFor()V"(self: *@This(), env: *jui.JNIEnv) !void { 1008 | try load(env); 1009 | _ = class_global orelse return error.ClassNotFound; 1010 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"throwFor()V", null); 1011 | } 1012 | pub fn @"hasTokenInBuffer()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1013 | try load(env); 1014 | _ = class_global orelse return error.ClassNotFound; 1015 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasTokenInBuffer()Z", null); 1016 | } 1017 | pub fn @"getCompleteTokenInBuffer(Ljava/util/regex/Pattern;)Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1018 | try load(env); 1019 | _ = class_global orelse return error.ClassNotFound; 1020 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"getCompleteTokenInBuffer(Ljava/util/regex/Pattern;)Ljava/lang/String;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1021 | } 1022 | pub fn @"findPatternInBuffer(Ljava/util/regex/Pattern;I)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jint) !jui.jboolean { 1023 | try load(env); 1024 | _ = class_global orelse return error.ClassNotFound; 1025 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"findPatternInBuffer(Ljava/util/regex/Pattern;I)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 1026 | } 1027 | pub fn @"matchPatternInBuffer(Ljava/util/regex/Pattern;)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jboolean { 1028 | try load(env); 1029 | _ = class_global orelse return error.ClassNotFound; 1030 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"matchPatternInBuffer(Ljava/util/regex/Pattern;)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1031 | } 1032 | pub fn @"ensureOpen()V"(self: *@This(), env: *jui.JNIEnv) !void { 1033 | try load(env); 1034 | _ = class_global orelse return error.ClassNotFound; 1035 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"ensureOpen()V", null); 1036 | } 1037 | pub fn @"close()V"(self: *@This(), env: *jui.JNIEnv) !void { 1038 | try load(env); 1039 | _ = class_global orelse return error.ClassNotFound; 1040 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"close()V", null); 1041 | } 1042 | pub fn @"ioException()Ljava/io/IOException;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1043 | try load(env); 1044 | _ = class_global orelse return error.ClassNotFound; 1045 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"ioException()Ljava/io/IOException;", null); 1046 | } 1047 | pub fn @"delimiter()Ljava/util/regex/Pattern;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1048 | try load(env); 1049 | _ = class_global orelse return error.ClassNotFound; 1050 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"delimiter()Ljava/util/regex/Pattern;", null); 1051 | } 1052 | pub fn @"useDelimiter(Ljava/util/regex/Pattern;)Ljava/util/Scanner;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1053 | try load(env); 1054 | _ = class_global orelse return error.ClassNotFound; 1055 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"useDelimiter(Ljava/util/regex/Pattern;)Ljava/util/Scanner;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1056 | } 1057 | pub fn @"useDelimiter(Ljava/lang/String;)Ljava/util/Scanner;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1058 | try load(env); 1059 | _ = class_global orelse return error.ClassNotFound; 1060 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"useDelimiter(Ljava/lang/String;)Ljava/util/Scanner;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1061 | } 1062 | pub fn @"locale()Ljava/util/Locale;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1063 | try load(env); 1064 | _ = class_global orelse return error.ClassNotFound; 1065 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"locale()Ljava/util/Locale;", null); 1066 | } 1067 | pub fn @"useLocale(Ljava/util/Locale;)Ljava/util/Scanner;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1068 | try load(env); 1069 | _ = class_global orelse return error.ClassNotFound; 1070 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"useLocale(Ljava/util/Locale;)Ljava/util/Scanner;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1071 | } 1072 | pub fn @"radix()I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 1073 | try load(env); 1074 | _ = class_global orelse return error.ClassNotFound; 1075 | return env.callMethod(.int, @ptrCast(jui.jobject, self), methods.@"radix()I", null); 1076 | } 1077 | pub fn @"useRadix(I)Ljava/util/Scanner;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jobject { 1078 | try load(env); 1079 | _ = class_global orelse return error.ClassNotFound; 1080 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"useRadix(I)Ljava/util/Scanner;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1081 | } 1082 | pub fn @"setRadix(I)V"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !void { 1083 | try load(env); 1084 | _ = class_global orelse return error.ClassNotFound; 1085 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"setRadix(I)V", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1086 | } 1087 | pub fn @"match()Ljava/util/regex/MatchResult;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1088 | try load(env); 1089 | _ = class_global orelse return error.ClassNotFound; 1090 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"match()Ljava/util/regex/MatchResult;", null); 1091 | } 1092 | pub fn @"toString()Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1093 | try load(env); 1094 | _ = class_global orelse return error.ClassNotFound; 1095 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"toString()Ljava/lang/String;", null); 1096 | } 1097 | pub fn @"hasNext()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1098 | try load(env); 1099 | _ = class_global orelse return error.ClassNotFound; 1100 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNext()Z", null); 1101 | } 1102 | pub fn @"next()Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1103 | try load(env); 1104 | _ = class_global orelse return error.ClassNotFound; 1105 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"next()Ljava/lang/String;", null); 1106 | } 1107 | pub fn @"remove()V"(self: *@This(), env: *jui.JNIEnv) !void { 1108 | try load(env); 1109 | _ = class_global orelse return error.ClassNotFound; 1110 | return env.callMethod(.void, @ptrCast(jui.jobject, self), methods.@"remove()V", null); 1111 | } 1112 | pub fn @"hasNext(Ljava/lang/String;)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jboolean { 1113 | try load(env); 1114 | _ = class_global orelse return error.ClassNotFound; 1115 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNext(Ljava/lang/String;)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1116 | } 1117 | pub fn @"next(Ljava/lang/String;)Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1118 | try load(env); 1119 | _ = class_global orelse return error.ClassNotFound; 1120 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"next(Ljava/lang/String;)Ljava/lang/String;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1121 | } 1122 | pub fn @"hasNext(Ljava/util/regex/Pattern;)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jboolean { 1123 | try load(env); 1124 | _ = class_global orelse return error.ClassNotFound; 1125 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNext(Ljava/util/regex/Pattern;)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1126 | } 1127 | pub fn @"next(Ljava/util/regex/Pattern;)Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1128 | try load(env); 1129 | _ = class_global orelse return error.ClassNotFound; 1130 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"next(Ljava/util/regex/Pattern;)Ljava/lang/String;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1131 | } 1132 | pub fn @"hasNextLine()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1133 | try load(env); 1134 | _ = class_global orelse return error.ClassNotFound; 1135 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextLine()Z", null); 1136 | } 1137 | pub fn @"nextLine()Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1138 | try load(env); 1139 | _ = class_global orelse return error.ClassNotFound; 1140 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"nextLine()Ljava/lang/String;", null); 1141 | } 1142 | pub fn @"findInLine(Ljava/lang/String;)Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1143 | try load(env); 1144 | _ = class_global orelse return error.ClassNotFound; 1145 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"findInLine(Ljava/lang/String;)Ljava/lang/String;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1146 | } 1147 | pub fn @"findInLine(Ljava/util/regex/Pattern;)Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1148 | try load(env); 1149 | _ = class_global orelse return error.ClassNotFound; 1150 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"findInLine(Ljava/util/regex/Pattern;)Ljava/lang/String;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1151 | } 1152 | pub fn @"findWithinHorizon(Ljava/lang/String;I)Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jint) !jui.jobject { 1153 | try load(env); 1154 | _ = class_global orelse return error.ClassNotFound; 1155 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"findWithinHorizon(Ljava/lang/String;I)Ljava/lang/String;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 1156 | } 1157 | pub fn @"findWithinHorizon(Ljava/util/regex/Pattern;I)Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject, arg1: jui.jint) !jui.jobject { 1158 | try load(env); 1159 | _ = class_global orelse return error.ClassNotFound; 1160 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"findWithinHorizon(Ljava/util/regex/Pattern;I)Ljava/lang/String;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0), jui.jvalue.toJValue(arg1)}); 1161 | } 1162 | pub fn @"skip(Ljava/util/regex/Pattern;)Ljava/util/Scanner;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1163 | try load(env); 1164 | _ = class_global orelse return error.ClassNotFound; 1165 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"skip(Ljava/util/regex/Pattern;)Ljava/util/Scanner;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1166 | } 1167 | pub fn @"skip(Ljava/lang/String;)Ljava/util/Scanner;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1168 | try load(env); 1169 | _ = class_global orelse return error.ClassNotFound; 1170 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"skip(Ljava/lang/String;)Ljava/util/Scanner;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1171 | } 1172 | pub fn @"hasNextBoolean()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1173 | try load(env); 1174 | _ = class_global orelse return error.ClassNotFound; 1175 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextBoolean()Z", null); 1176 | } 1177 | pub fn @"nextBoolean()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1178 | try load(env); 1179 | _ = class_global orelse return error.ClassNotFound; 1180 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"nextBoolean()Z", null); 1181 | } 1182 | pub fn @"hasNextByte()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1183 | try load(env); 1184 | _ = class_global orelse return error.ClassNotFound; 1185 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextByte()Z", null); 1186 | } 1187 | pub fn @"hasNextByte(I)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jboolean { 1188 | try load(env); 1189 | _ = class_global orelse return error.ClassNotFound; 1190 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextByte(I)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1191 | } 1192 | pub fn @"nextByte()B"(self: *@This(), env: *jui.JNIEnv) !jui.jbyte { 1193 | try load(env); 1194 | _ = class_global orelse return error.ClassNotFound; 1195 | return env.callMethod(.byte, @ptrCast(jui.jobject, self), methods.@"nextByte()B", null); 1196 | } 1197 | pub fn @"nextByte(I)B"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jbyte { 1198 | try load(env); 1199 | _ = class_global orelse return error.ClassNotFound; 1200 | return env.callMethod(.byte, @ptrCast(jui.jobject, self), methods.@"nextByte(I)B", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1201 | } 1202 | pub fn @"hasNextShort()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1203 | try load(env); 1204 | _ = class_global orelse return error.ClassNotFound; 1205 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextShort()Z", null); 1206 | } 1207 | pub fn @"hasNextShort(I)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jboolean { 1208 | try load(env); 1209 | _ = class_global orelse return error.ClassNotFound; 1210 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextShort(I)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1211 | } 1212 | pub fn @"nextShort()S"(self: *@This(), env: *jui.JNIEnv) !jui.jshort { 1213 | try load(env); 1214 | _ = class_global orelse return error.ClassNotFound; 1215 | return env.callMethod(.short, @ptrCast(jui.jobject, self), methods.@"nextShort()S", null); 1216 | } 1217 | pub fn @"nextShort(I)S"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jshort { 1218 | try load(env); 1219 | _ = class_global orelse return error.ClassNotFound; 1220 | return env.callMethod(.short, @ptrCast(jui.jobject, self), methods.@"nextShort(I)S", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1221 | } 1222 | pub fn @"hasNextInt()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1223 | try load(env); 1224 | _ = class_global orelse return error.ClassNotFound; 1225 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextInt()Z", null); 1226 | } 1227 | pub fn @"hasNextInt(I)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jboolean { 1228 | try load(env); 1229 | _ = class_global orelse return error.ClassNotFound; 1230 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextInt(I)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1231 | } 1232 | pub fn @"processIntegerToken(Ljava/lang/String;)Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1233 | try load(env); 1234 | _ = class_global orelse return error.ClassNotFound; 1235 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"processIntegerToken(Ljava/lang/String;)Ljava/lang/String;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1236 | } 1237 | pub fn @"nextInt()I"(self: *@This(), env: *jui.JNIEnv) !jui.jint { 1238 | try load(env); 1239 | _ = class_global orelse return error.ClassNotFound; 1240 | return env.callMethod(.int, @ptrCast(jui.jobject, self), methods.@"nextInt()I", null); 1241 | } 1242 | pub fn @"nextInt(I)I"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jint { 1243 | try load(env); 1244 | _ = class_global orelse return error.ClassNotFound; 1245 | return env.callMethod(.int, @ptrCast(jui.jobject, self), methods.@"nextInt(I)I", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1246 | } 1247 | pub fn @"hasNextLong()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1248 | try load(env); 1249 | _ = class_global orelse return error.ClassNotFound; 1250 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextLong()Z", null); 1251 | } 1252 | pub fn @"hasNextLong(I)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jboolean { 1253 | try load(env); 1254 | _ = class_global orelse return error.ClassNotFound; 1255 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextLong(I)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1256 | } 1257 | pub fn @"nextLong()J"(self: *@This(), env: *jui.JNIEnv) !jui.jlong { 1258 | try load(env); 1259 | _ = class_global orelse return error.ClassNotFound; 1260 | return env.callMethod(.long, @ptrCast(jui.jobject, self), methods.@"nextLong()J", null); 1261 | } 1262 | pub fn @"nextLong(I)J"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jlong { 1263 | try load(env); 1264 | _ = class_global orelse return error.ClassNotFound; 1265 | return env.callMethod(.long, @ptrCast(jui.jobject, self), methods.@"nextLong(I)J", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1266 | } 1267 | pub fn @"processFloatToken(Ljava/lang/String;)Ljava/lang/String;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1268 | try load(env); 1269 | _ = class_global orelse return error.ClassNotFound; 1270 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"processFloatToken(Ljava/lang/String;)Ljava/lang/String;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1271 | } 1272 | pub fn @"hasNextFloat()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1273 | try load(env); 1274 | _ = class_global orelse return error.ClassNotFound; 1275 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextFloat()Z", null); 1276 | } 1277 | pub fn @"nextFloat()F"(self: *@This(), env: *jui.JNIEnv) !jui.jfloat { 1278 | try load(env); 1279 | _ = class_global orelse return error.ClassNotFound; 1280 | return env.callMethod(.float, @ptrCast(jui.jobject, self), methods.@"nextFloat()F", null); 1281 | } 1282 | pub fn @"hasNextDouble()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1283 | try load(env); 1284 | _ = class_global orelse return error.ClassNotFound; 1285 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextDouble()Z", null); 1286 | } 1287 | pub fn @"nextDouble()D"(self: *@This(), env: *jui.JNIEnv) !jui.jdouble { 1288 | try load(env); 1289 | _ = class_global orelse return error.ClassNotFound; 1290 | return env.callMethod(.double, @ptrCast(jui.jobject, self), methods.@"nextDouble()D", null); 1291 | } 1292 | pub fn @"hasNextBigInteger()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1293 | try load(env); 1294 | _ = class_global orelse return error.ClassNotFound; 1295 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextBigInteger()Z", null); 1296 | } 1297 | pub fn @"hasNextBigInteger(I)Z"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jboolean { 1298 | try load(env); 1299 | _ = class_global orelse return error.ClassNotFound; 1300 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextBigInteger(I)Z", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1301 | } 1302 | pub fn @"nextBigInteger()Ljava/math/BigInteger;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1303 | try load(env); 1304 | _ = class_global orelse return error.ClassNotFound; 1305 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"nextBigInteger()Ljava/math/BigInteger;", null); 1306 | } 1307 | pub fn @"nextBigInteger(I)Ljava/math/BigInteger;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jint) !jui.jobject { 1308 | try load(env); 1309 | _ = class_global orelse return error.ClassNotFound; 1310 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"nextBigInteger(I)Ljava/math/BigInteger;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1311 | } 1312 | pub fn @"hasNextBigDecimal()Z"(self: *@This(), env: *jui.JNIEnv) !jui.jboolean { 1313 | try load(env); 1314 | _ = class_global orelse return error.ClassNotFound; 1315 | return env.callMethod(.boolean, @ptrCast(jui.jobject, self), methods.@"hasNextBigDecimal()Z", null); 1316 | } 1317 | pub fn @"nextBigDecimal()Ljava/math/BigDecimal;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1318 | try load(env); 1319 | _ = class_global orelse return error.ClassNotFound; 1320 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"nextBigDecimal()Ljava/math/BigDecimal;", null); 1321 | } 1322 | pub fn @"reset()Ljava/util/Scanner;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1323 | try load(env); 1324 | _ = class_global orelse return error.ClassNotFound; 1325 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"reset()Ljava/util/Scanner;", null); 1326 | } 1327 | pub fn @"tokens()Ljava/util/stream/Stream;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1328 | try load(env); 1329 | _ = class_global orelse return error.ClassNotFound; 1330 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"tokens()Ljava/util/stream/Stream;", null); 1331 | } 1332 | pub fn @"findAll(Ljava/util/regex/Pattern;)Ljava/util/stream/Stream;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1333 | try load(env); 1334 | _ = class_global orelse return error.ClassNotFound; 1335 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"findAll(Ljava/util/regex/Pattern;)Ljava/util/stream/Stream;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1336 | } 1337 | pub fn @"findAll(Ljava/lang/String;)Ljava/util/stream/Stream;"(self: *@This(), env: *jui.JNIEnv, arg0: jui.jobject) !jui.jobject { 1338 | try load(env); 1339 | _ = class_global orelse return error.ClassNotFound; 1340 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"findAll(Ljava/lang/String;)Ljava/util/stream/Stream;", &[_]jui.jvalue{jui.jvalue.toJValue(arg0)}); 1341 | } 1342 | pub fn @"next()Ljava/lang/Object;"(self: *@This(), env: *jui.JNIEnv) !jui.jobject { 1343 | try load(env); 1344 | _ = class_global orelse return error.ClassNotFound; 1345 | return env.callMethod(.object, @ptrCast(jui.jobject, self), methods.@"next()Ljava/lang/Object;", null); 1346 | } 1347 | pub fn @"()V"(env: *jui.JNIEnv) !void { 1348 | try load(env); 1349 | const class = class_global orelse return error.ClassNotFound; 1350 | return env.callStaticMethod(.void, class, methods.@"()V", null); 1351 | } 1352 | 1353 | }; 1354 | --------------------------------------------------------------------------------