Skip to content

Commit

Permalink
Rewrite of j2objc_library.bzl to use an aspect to generate build acti…
Browse files Browse the repository at this point in the history
…ons for all java_library dependencies, like the native rule does.

PiperOrigin-RevId: 464184706
  • Loading branch information
tomball authored and copybara-github committed Aug 4, 2022
1 parent d011a13 commit a6474b9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/protobuf/AddressBook/j2objc_main.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ int j2objc_main(const char* className, int argc, const char *argv[]) {
IOSClass *clazz = [IOSClass forName:[NSString stringWithUTF8String:className]];
IOSObjectArray *mainArgs = JreEmulationMainArguments(argc, argv);
SEL mainSelector = sel_registerName("mainWithNSStringArray:");
#if __has_feature(objc_arc)
// Avoid a -Warc-performSelector-leaks false-positive warning.
IMP imp = [clazz.objcClass methodForSelector:mainSelector];
void (*func)(id, SEL, id) = (void *)imp;
func(nil, mainSelector, mainArgs);
#else
[clazz.objcClass performSelector:mainSelector withObject:mainArgs];
#endif
}
@catch (JavaLangClassNotFoundException *e) {
fprintf(stderr, "Error: could not find or load main class %s\n", className);
Expand Down

0 comments on commit a6474b9

Please sign in to comment.