13 JNI examples migrated (1410-1419/1423/1424/1425): import runtime classes
'#foreign #jni_class("X") {' → '#jni_class("X") extern {'. 1417 (all-runtimes)
also exercises #jni_interface/#objc_class/#objc_protocol/#swift_class/#swift_struct/
#swift_protocol — all take the postfix modifier (verified by probe), migrated via a
generalized '#foreign #<directive>("X") {' → '… extern {' rewrite. No 14xx snapshot
asserts on 'foreign'; empty snapshot diff, corpus-validated.
KEPT comment-only #foreign in 1426 (jni-extern-class test, no decls). Suite green
(647 corpus / 444 unit, 0 failed).
25 lines
924 B
Plaintext
25 lines
924 B
Plaintext
// `super.method(args)` dispatch inside a `#jni_main` Activity body
|
|
// (chess-on-Pixel migration, R.6). The override of a lifecycle method
|
|
// like `onCreate` needs to invoke the parent's `onCreate` so the
|
|
// Android runtime's setup completes (`SuperNotCalledException`
|
|
// otherwise) — the sx-side body calls `super.onCreate(b)` and the
|
|
// compiler lowers it to JNI `CallNonvirtualVoidMethod` against the
|
|
// parent class declared via `#extends`.
|
|
//
|
|
// No `#extends` here → defaults to `android.app.Activity`. The smoke
|
|
// is compile-only — runtime correctness is verified by APK install
|
|
// + on-device launch, which is the chess deploy.
|
|
|
|
#import "modules/std.sx";
|
|
#import "modules/build.sx";
|
|
|
|
Bundle :: #jni_class("android/os/Bundle") extern { }
|
|
|
|
SxApp :: #jni_main #jni_class("co/swipelab/sxjnimainsuper/SxApp") {
|
|
onCreate :: (self: *Self, b: *Bundle) {
|
|
super.onCreate(b);
|
|
}
|
|
}
|
|
|
|
main :: () -> i32 { 0 }
|