Files
sx/examples/ffi-jni-class-06-desc.sx
agra 11021d800d ffi 2.6 green: #jni_method_descriptor("(Sig)Ret") override
New `hash_jni_method_descriptor` lexer token + LSP keyword
classification. `JniMethodDecl` gains `desc_override: ?[]const u8`.
parseJniClassDecl accepts an optional `#jni_method_descriptor("...")`
clause between the return type and the terminating `;`, stashing the
literal as the override. Auto-derivation in Phase 2.8 will treat
this as the precedence override when present.

The 2.6 xfail commit (0ed4799) used the working name `#desc` in its
test file; this commit renames to `#jni_method_descriptor` for
parallel naming with the rest of the FFI directive set (`#jni_call`,
`#jni_class`, `#jni_env`, ...). Test snapshot flips xfail → green.

125/125 examples green.
2026-05-20 10:10:23 +03:00

21 lines
646 B
Plaintext

// Phase 2 step 2.6 (PLAN-FFI.md): xfail then green for the
// `#jni_method_descriptor("(Sig)Ret")` per-method JNI-descriptor
// override.
//
// The default descriptor is derived from sx types (Phase 2.8); this
// directive is the escape hatch when the auto-derived signature
// doesn't match (e.g., synthetic methods, ambiguous overloads,
// accessing JNI internals). It appears trailing the method's return
// type, before the terminating `;`.
#import "modules/std.sx";
Foo :: #jni_class("com/example/Foo") {
weirdMethod :: (self: *Self) -> s32 #jni_method_descriptor("()I");
}
main :: () -> s32 {
print("parse-only ok\n");
0;
}