Skip to content

Commit

Permalink
updated to j2objc-2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sashafirsov committed Sep 20, 2017
1 parent f05df5e commit 0bd7af7
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 10 deletions.
15 changes: 8 additions & 7 deletions demo/andr-demo-prj/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,23 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,23 @@ - (void)amfibianOperations {
Appointment *meetAmfibianAppointment = [anOrm getSingleResult];
[self checkTestWithNSString:@"attrib level adapter" withBoolean:[((JavaLangInteger *) nil_chk([((Appointment *) nil_chk(meetAmfibianAppointment)) getStatus])) intValue] == 1];
[self checkTestWithNSString:@"object level adapter" withBoolean:[((JavaLangInteger *) nil_chk([meetAmfibianAppointment getIsProcessed])) intValue] == 1];
[anOrm addInclAttribsWithNSStringArray:[IOSObjectArray newArrayWithObjects:(id[]){ @"name" } count:1 type:NSString_class_()]];
[meetAmfibianAppointment setNameWithNSString:@"Meet AmfibiaN! + 1"];
[meetAmfibianAppointment setIsProcessedWithJavaLangInteger:JavaLangInteger_valueOfWithInt_(0)];
[anOrm startSqlUpdateWithId:meetAmfibianAppointment];
[anOrm addWhereWithNSString:@"id = ?" withId:JavaLangInteger_valueOfWithInt_(234)];
(void) [anOrm apply];
[anOrm resetSkipInclAttrNameList];
[anOrm startSqlSelect];
[anOrm addWhereWithNSString:@"id = ?" withId:JavaLangInteger_valueOfWithInt_(234)];
meetAmfibianAppointment = [anOrm getSingleResult];
[self printAppointmentsWithAnOrm:anOrm];
[self checkTestWithNSString:@"partial update attrib level adapter" withBoolean:[((NSString *) nil_chk([((Appointment *) nil_chk(meetAmfibianAppointment)) getName])) isEqual:@"Meet AmfibiaN! + 1"]];
[self checkTestWithNSString:@"partial update object level adapter" withBoolean:[((JavaLangInteger *) nil_chk([meetAmfibianAppointment getIsProcessed])) intValue] == 1];
[((JavaIoPrintStream *) nil_chk(JreLoadStatic(JavaLangSystem, out))) printlnWithNSString:JreStrcat("$$", @"Back to JSON string\nbecause we might want to send it\nback to the server like so: ", [anOrm asJsonStringWithId:meetAmfibianAppointment])];
OrgJsonJSONObject *jsonObject = [anOrm asJSONObjectWithId:meetAmfibianAppointment];
NSString *name = (NSString *) cast_chk([((OrgJsonJSONObject *) nil_chk(jsonObject)) getWithNSString:@"name"], [NSString class]);
[self checkTestWithNSString:@"native to JSON" withBoolean:[((NSString *) nil_chk(name)) isEqual:@"Meet AmfibiaN!"]];
[self checkTestWithNSString:@"native to JSON" withBoolean:[((NSString *) nil_chk(name)) isEqual:@"Meet AmfibiaN! + 1"]];
[self amfibianAssociationTests];
[self extraAmfibianTestsWithAnOrm:anOrm];
[self anUpdateOperationsWithAnObject:anOrm];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ - (void)printWithJavaUtilCollection:(id<JavaUtilCollection>)appointments {
}

- (void)printWithAppointment:(Appointment *)appointment {
[((JavaIoPrintStream *) nil_chk(JreLoadStatic(JavaLangSystem, out))) printlnWithNSString:JreStrcat("$@$$$@$@", @"Appointment object. id: ", [((Appointment *) nil_chk(appointment)) getId], @", name: ", [appointment getName], @", isProcessed:", [appointment getIsProcessed], @", createDate:", [appointment getCreateDate])];
[((JavaIoPrintStream *) nil_chk(JreLoadStatic(JavaLangSystem, out))) printlnWithNSString:JreStrcat("$@$$$@$@$@", @"Appointment object. id: ", [((Appointment *) nil_chk(appointment)) getId], @", name: ", [appointment getName], @", isProcessed:", [appointment getIsProcessed], @", createDate:", [appointment getCreateDate], @", status: ", [appointment getStatus])];
}

- (void)printWithSQLighterRs:(id<SQLighterRs>)rs {
Expand Down
182 changes: 181 additions & 1 deletion ios/j2objc/com/vals/a2ios/amfibian/impl/AnUpgradeImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "java/util/Set.h"

#pragma clang diagnostic ignored "-Wprotocol"
#pragma clang diagnostic ignored "-Wincomplete-implementation"

@interface AnUpgradeImpl () {
@public
Expand All @@ -37,6 +36,24 @@ @interface AnUpgradeImpl () {
id<JavaUtilList> delayedLogs_;
}

- (jint)applyUpdatesWithInt:(jint)privatePublic;

- (jint)attemptToRecoverWithInt:(jint)privatePublic;

- (void)logUpgradeStepWithNSString:(NSString *)key
withNSString:(NSString *)sqlStr
withJavaLangLong:(JavaLangLong *)result;

- (void)logKeyWithNSString:(NSString *)key
withNSString:(NSString *)message
withJavaLangInteger:(JavaLangInteger *)status;

- (void)saveLogWithAnUpgradeImpl_Upgrade:(AnUpgradeImpl_Upgrade *)appUpdateEntry;

- (jboolean)findTableWithNSString:(NSString *)searchTableName;

- (id<JavaUtilList>)getPrivateUpdateKeys;

@end

J2OBJC_FIELD_SETTER(AnUpgradeImpl, map_, id<JavaUtilMap>)
Expand Down Expand Up @@ -107,6 +124,18 @@ - (instancetype)initWithSQLighterDb:(id<SQLighterDb>)sqLighterDb {
return self;
}

- (id<JavaUtilList>)getTasksByKeyWithNSString:(NSString *)key {
// can't call an abstract method
[self doesNotRecognizeSelector:_cmd];
return 0;
}

- (id<JavaUtilList>)getUpdateKeys {
// can't call an abstract method
[self doesNotRecognizeSelector:_cmd];
return 0;
}

- (NSString *)getLogTableName {
return logTableName_;
}
Expand Down Expand Up @@ -144,6 +173,10 @@ - (jint)applyUpdates {
return taskCount;
}

- (jint)applyUpdatesWithInt:(jint)privatePublic {
return AnUpgradeImpl_applyUpdatesWithInt_(self, privatePublic);
}

- (jboolean)applyUpdateWithNSString:(NSString *)key
withJavaUtilList:(id<JavaUtilList>)statementList {
id taskObject = nil;
Expand Down Expand Up @@ -192,17 +225,45 @@ - (jint)attemptToRecover {
return returnCode;
}

- (jint)attemptToRecoverWithInt:(jint)privatePublic {
return AnUpgradeImpl_attemptToRecoverWithInt_(self, privatePublic);
}

- (void)setRecoverKeyWithNSString:(NSString *)recoverKey {
self->recoverKey_ = recoverKey;
}

- (void)logUpgradeStepWithNSString:(NSString *)key
withNSString:(NSString *)sqlStr
withJavaLangLong:(JavaLangLong *)result {
AnUpgradeImpl_logUpgradeStepWithNSString_withNSString_withJavaLangLong_(self, key, sqlStr, result);
}

- (void)logKeyWithNSString:(NSString *)key
withNSString:(NSString *)message
withJavaLangInteger:(JavaLangInteger *)status {
AnUpgradeImpl_logKeyWithNSString_withNSString_withJavaLangInteger_(self, key, message, status);
}

- (void)saveLogWithAnUpgradeImpl_Upgrade:(AnUpgradeImpl_Upgrade *)appUpdateEntry {
AnUpgradeImpl_saveLogWithAnUpgradeImpl_Upgrade_(self, appUpdateEntry);
}

- (jboolean)findTableWithNSString:(NSString *)searchTableName {
return AnUpgradeImpl_findTableWithNSString_(self, searchTableName);
}

- (void)onTaskSuccessWithId:(id)task {
}

- (void)onTaskFailWithId:(id)task
withJavaLangThrowable:(JavaLangThrowable *)exception {
}

- (id<JavaUtilList>)getPrivateUpdateKeys {
return AnUpgradeImpl_getPrivateUpdateKeys(self);
}

- (id<JavaUtilList>)getPrivateTasksByKeyWithNSString:(NSString *)key {
id<JavaUtilList> tasks = new_JavaUtilLinkedList_init();
if ([((NSString *) nil_chk(AnUpgradeImpl_PRIVATE_REC_KEY)) isEqual:key]) {
Expand All @@ -221,6 +282,70 @@ - (void)onTaskFailWithId:(id)task
return tasks;
}

+ (const J2ObjcClassInfo *)__metadata {
static J2ObjcMethodInfo methods[] = {
{ NULL, NULL, 0x1, -1, 0, 1, -1, -1, -1 },
{ NULL, NULL, 0x1, -1, 2, 1, -1, -1, -1 },
{ NULL, "LJavaUtilList;", 0x401, 3, 4, -1, 5, -1, -1 },
{ NULL, "LJavaUtilList;", 0x401, -1, -1, -1, 6, -1, -1 },
{ NULL, "LNSString;", 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 7, 4, -1, -1, -1, -1 },
{ NULL, "LJavaUtilSet;", 0x1, -1, -1, 1, 8, -1, -1 },
{ NULL, "I", 0x1, -1, -1, 1, -1, -1, -1 },
{ NULL, "I", 0x2, 9, 10, 1, -1, -1, -1 },
{ NULL, "Z", 0x4, 11, 12, -1, 13, -1, -1 },
{ NULL, "I", 0x1, -1, -1, 1, -1, -1, -1 },
{ NULL, "I", 0x2, 14, 10, 1, -1, -1, -1 },
{ NULL, "V", 0x1, 15, 4, -1, -1, -1, -1 },
{ NULL, "V", 0x2, 16, 17, 1, -1, -1, -1 },
{ NULL, "V", 0x2, 18, 19, 1, -1, -1, -1 },
{ NULL, "V", 0x2, 20, 21, 1, -1, -1, -1 },
{ NULL, "Z", 0x2, 22, 4, 1, -1, -1, -1 },
{ NULL, "V", 0x1, 23, 24, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 25, 26, -1, -1, -1, -1 },
{ NULL, "LJavaUtilList;", 0x2, -1, -1, -1, 6, -1, -1 },
{ NULL, "LJavaUtilList;", 0x4, 27, 4, -1, 5, -1, -1 },
};
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-multiple-method-names"
methods[0].selector = @selector(initWithSQLighterDb:withNSString:withNSString:);
methods[1].selector = @selector(initWithSQLighterDb:);
methods[2].selector = @selector(getTasksByKeyWithNSString:);
methods[3].selector = @selector(getUpdateKeys);
methods[4].selector = @selector(getLogTableName);
methods[5].selector = @selector(setLogTableNameWithNSString:);
methods[6].selector = @selector(getAppliedUpdates);
methods[7].selector = @selector(applyUpdates);
methods[8].selector = @selector(applyUpdatesWithInt:);
methods[9].selector = @selector(applyUpdateWithNSString:withJavaUtilList:);
methods[10].selector = @selector(attemptToRecover);
methods[11].selector = @selector(attemptToRecoverWithInt:);
methods[12].selector = @selector(setRecoverKeyWithNSString:);
methods[13].selector = @selector(logUpgradeStepWithNSString:withNSString:withJavaLangLong:);
methods[14].selector = @selector(logKeyWithNSString:withNSString:withJavaLangInteger:);
methods[15].selector = @selector(saveLogWithAnUpgradeImpl_Upgrade:);
methods[16].selector = @selector(findTableWithNSString:);
methods[17].selector = @selector(onTaskSuccessWithId:);
methods[18].selector = @selector(onTaskFailWithId:withJavaLangThrowable:);
methods[19].selector = @selector(getPrivateUpdateKeys);
methods[20].selector = @selector(getPrivateTasksByKeyWithNSString:);
#pragma clang diagnostic pop
static const J2ObjcFieldInfo fields[] = {
{ "map_", "LJavaUtilMap;", .constantValue.asLong = 0, 0x2, -1, -1, 28, -1 },
{ "sqlighterDb_", "LSQLighterDb;", .constantValue.asLong = 0, 0x4, -1, -1, -1, -1 },
{ "recoverKey_", "LNSString;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
{ "logTableName_", "LNSString;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
{ "anOrm_", "LAnOrmImpl;", .constantValue.asLong = 0, 0x4, -1, -1, 29, -1 },
{ "delayedLogs_", "LJavaUtilList;", .constantValue.asLong = 0, 0x2, -1, -1, 30, -1 },
{ "PRIVATE_PREFIX", "LNSString;", .constantValue.asLong = 0, 0x1a, -1, 31, -1, -1 },
{ "PRIVATE_REC_KEY", "LNSString;", .constantValue.asLong = 0, 0x1a, -1, 32, -1, -1 },
{ "PRIVATE_KEY1", "LNSString;", .constantValue.asLong = 0, 0x1a, -1, 33, -1, -1 },
};
static const void *ptrTable[] = { "LSQLighterDb;LNSString;LNSString;", "LJavaLangException;", "LSQLighterDb;", "getTasksByKey", "LNSString;", "(Ljava/lang/String;)Ljava/util/List<Ljava/lang/Object;>;", "()Ljava/util/List<Ljava/lang/String;>;", "setLogTableName", "()Ljava/util/Set<Ljava/lang/String;>;", "applyUpdates", "I", "applyUpdate", "LNSString;LJavaUtilList;", "(Ljava/lang/String;Ljava/util/List<Ljava/lang/Object;>;)Z", "attemptToRecover", "setRecoverKey", "logUpgradeStep", "LNSString;LNSString;LJavaLangLong;", "logKey", "LNSString;LNSString;LJavaLangInteger;", "saveLog", "LAnUpgradeImpl_Upgrade;", "findTable", "onTaskSuccess", "LNSObject;", "onTaskFail", "LNSObject;LJavaLangThrowable;", "getPrivateTasksByKey", "Ljava/util/Map<Ljava/lang/Integer;Ljava/util/List<Ljava/lang/String;>;>;", "Lcom/vals/a2ios/amfibian/impl/AnOrmImpl<Lcom/vals/a2ios/amfibian/impl/AnUpgradeImpl$Upgrade;>;", "Ljava/util/List<Lcom/vals/a2ios/amfibian/impl/AnUpgradeImpl$Upgrade;>;", &AnUpgradeImpl_PRIVATE_PREFIX, &AnUpgradeImpl_PRIVATE_REC_KEY, &AnUpgradeImpl_PRIVATE_KEY1 };
static const J2ObjcClassInfo _AnUpgradeImpl = { "AnUpgradeImpl", "com.vals.a2ios.amfibian.impl", ptrTable, methods, fields, 7, 0x401, 21, 9, -1, 21, -1, -1, -1 };
return &_AnUpgradeImpl;
}

@end

void AnUpgradeImpl_initWithSQLighterDb_withNSString_withNSString_(AnUpgradeImpl *self, id<SQLighterDb> sqLighterDb, NSString *tableName, NSString *recoveryKey) {
Expand Down Expand Up @@ -410,6 +535,61 @@ - (void)setRefsWithJavaLangInteger:(JavaLangInteger *)refs {
self->refs_ = refs;
}

+ (const J2ObjcClassInfo *)__metadata {
static J2ObjcMethodInfo methods[] = {
{ NULL, NULL, 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "LNSString;", 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 0, 1, -1, -1, -1, -1 },
{ NULL, "LNSString;", 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 2, 1, -1, -1, -1, -1 },
{ NULL, "LJavaUtilDate;", 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 3, 4, -1, -1, -1, -1 },
{ NULL, "LJavaLangInteger;", 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 5, 6, -1, -1, -1, -1 },
{ NULL, "LJavaLangInteger;", 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 7, 6, -1, -1, -1, -1 },
{ NULL, "LJavaLangInteger;", 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 8, 6, -1, -1, -1, -1 },
{ NULL, "LJavaLangDouble;", 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 9, 10, -1, -1, -1, -1 },
{ NULL, "LJavaLangInteger;", 0x1, -1, -1, -1, -1, -1, -1 },
{ NULL, "V", 0x1, 11, 6, -1, -1, -1, -1 },
};
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-multiple-method-names"
methods[0].selector = @selector(init);
methods[1].selector = @selector(getKey);
methods[2].selector = @selector(setKeyWithNSString:);
methods[3].selector = @selector(getValue);
methods[4].selector = @selector(setValueWithNSString:);
methods[5].selector = @selector(getCreateDate);
methods[6].selector = @selector(setCreateDateWithJavaUtilDate:);
methods[7].selector = @selector(getStatus);
methods[8].selector = @selector(setStatusWithJavaLangInteger:);
methods[9].selector = @selector(getType);
methods[10].selector = @selector(setTypeWithJavaLangInteger:);
methods[11].selector = @selector(getRefi);
methods[12].selector = @selector(setRefiWithJavaLangInteger:);
methods[13].selector = @selector(getRefd);
methods[14].selector = @selector(setRefdWithJavaLangDouble:);
methods[15].selector = @selector(getRefs);
methods[16].selector = @selector(setRefsWithJavaLangInteger:);
#pragma clang diagnostic pop
static const J2ObjcFieldInfo fields[] = {
{ "key_", "LNSString;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
{ "value_", "LNSString;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
{ "createDate_", "LJavaUtilDate;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
{ "status_", "LJavaLangInteger;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
{ "type_", "LJavaLangInteger;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
{ "refi_", "LJavaLangInteger;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
{ "refd_", "LJavaLangDouble;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
{ "refs_", "LJavaLangInteger;", .constantValue.asLong = 0, 0x2, -1, -1, -1, -1 },
};
static const void *ptrTable[] = { "setKey", "LNSString;", "setValue", "setCreateDate", "LJavaUtilDate;", "setStatus", "LJavaLangInteger;", "setType", "setRefi", "setRefd", "LJavaLangDouble;", "setRefs", "LAnUpgradeImpl;" };
static const J2ObjcClassInfo _AnUpgradeImpl_Upgrade = { "Upgrade", "com.vals.a2ios.amfibian.impl", ptrTable, methods, fields, 7, 0x9, 17, 8, 12, -1, -1, -1, -1 };
return &_AnUpgradeImpl_Upgrade;
}

@end

void AnUpgradeImpl_Upgrade_init(AnUpgradeImpl_Upgrade *self) {
Expand Down

0 comments on commit 0bd7af7

Please sign in to comment.