Files
sx/examples
agra c02b6b3b1b ffi #jni_main: Alias.new(args) constructor dispatch via JNI NewObject
Adds the constructor-invocation arm of the foreign-class DSL:
`SurfaceView.new(ctx)` (where `SurfaceView` is a `#foreign #jni_class`
with `static new :: (ctx: *Context) -> *Self;`) lowers to
`FindClass(env, "android/view/SurfaceView") + GetMethodID(env, cls,
"<init>", "(args)V") + NewObject(env, cls, mid, args...)`. Returns
the fresh jobject.

  - inst.zig: `JniMsgSend.is_constructor` flag + `parent_class_path`
    re-purposed to carry the class being constructed (alongside its
    existing nonvirtual-super-class use). Mutually exclusive with
    `is_static` / `is_nonvirtual`.
  - lower.zig: `lowerCall.field_access` arm now recognises
    `Alias.method(args)` where `Alias` resolves in `foreign_class_map`
    and the matching member is `static`. `new` routes to a new
    `lowerForeignStaticCall` that derives a `(args)V` JNI descriptor
    and emits a `JniMsgSend` with `is_constructor=true`. Non-`new`
    static calls report a clear "use #jni_static_call" diagnostic
    until that sugar lands.
  - emit_llvm.zig: new `NewObject` vtable slot (28) + `emitJniConstructor`
    helper expanding the FindClass+GetMethodID+NewObject chain. The
    jni_msg_send arm short-circuits to it when `is_constructor` is set.

Smoke `ffi-jni-main-03-ctor.sx` exercises both this slice and the
previous super-dispatch slice in a single `onCreate` body: calls
`super.onCreate(b)` then constructs a `SurfaceView` with the Activity
as Context. IR shows the expected six-stage chain (FindClass+GetMethodID+
CallNonvirtual + FindClass+GetMethodID+NewObject); APK builds clean.

Naming caveat: the Java type `android.content.Context` clashes with
sx stdlib's `Context :: struct {...}` (heap-context). The smoke aliases
it `JContext` — future work could add a path-prefix or `as` rename
form on `#jni_class` to avoid the manual rename.

133 host / 6 cross / zig build test all green.
2026-05-20 17:14:51 +03:00
..
2026-03-06 10:46:28 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-14 13:17:22 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-24 15:10:02 +02:00
2026-03-03 09:35:50 +02:00
2026-02-24 17:37:52 +02:00
2026-02-24 15:10:02 +02:00
2026-02-11 14:22:25 +02:00
2026-02-09 18:07:41 +02:00
2026-02-24 17:37:52 +02:00
2026-02-14 13:17:22 +02:00
2026-02-09 18:07:41 +02:00
...
2026-02-11 13:03:04 +02:00
2026-02-17 16:57:12 +02:00
2026-02-17 16:57:12 +02:00
2026-02-14 14:52:39 +02:00
2026-02-24 17:37:52 +02:00
2026-02-16 01:13:34 +02:00
2026-02-24 06:20:38 +02:00
2026-02-11 01:05:21 +02:00
2026-02-22 22:16:30 +02:00
2026-02-11 20:41:43 +02:00
ir
2026-02-26 02:25:02 +02:00
2026-02-12 12:27:35 +02:00
2026-02-14 13:17:22 +02:00
2026-02-14 14:52:39 +02:00
2026-02-24 13:37:27 +02:00
2026-02-22 22:16:30 +02:00
2026-02-22 17:24:04 +02:00
2026-02-22 17:24:04 +02:00
2026-02-22 17:24:04 +02:00
2026-02-24 17:37:52 +02:00
2026-02-25 15:51:22 +02:00
sm
2026-03-02 21:00:55 +02:00
2026-03-04 17:12:56 +02:00
2026-03-04 17:12:56 +02:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-18 17:40:10 +03:00
2026-05-18 17:40:10 +03:00
2026-05-18 17:40:10 +03:00