@@ -601,32 +601,32 @@ public static String generateHeaderFromObject(SimpleSerializable s) {
601601 } else if (type == boolean .class ) {
602602 source .append (") BOOL " );
603603 } else if (type == String .class ) {
604- source .append (", retain) NSString *" );
604+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSString *" );
605605 } else if (SimpleSerializable .isSubclassOf (type , SimpleSerializable .class )) {
606- source .append (", retain) " );
606+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) " );
607607 source .append (type .getSimpleName ());
608608 source .append (" *" );
609609 } else if (type == byte [].class ) {
610610 if (s .bytesCompactMode ()) {
611- source .append (", retain) NSData *" );
611+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSData *" );
612612 } else {
613- source .append (", retain) NSMutableArray<NSNumber> *" );
613+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSMutableArray<NSNumber> *" );
614614 }
615615 } else if (type == String [].class ) {
616- source .append (", retain) NSMutableArray<NSString> *" );
616+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSMutableArray<NSString> *" );
617617 } else if (SimpleSerializable .isSubclassOf (type , SimpleSerializable [].class )) {
618618 //if (!SimpleSerializable.isSubclassOf(type, SimpleRPCRunnable[].class)) {
619- source .append (", retain) NSMutableArray<" );
619+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSMutableArray<" );
620620 source .append (type .getComponentType ().getSimpleName ());
621621 source .append ("> *" );
622622 //} else {
623- // source.append(", retain) NSMutableArray *");
623+ // source.append(", " + (!supportsARC ? " retain" : "strong") + " ) NSMutableArray *");
624624 //}
625625 } else if (type == int [].class || type == long [].class || type == double [].class
626626 || type == short [].class || type == char [].class
627627 || type == float [].class || type == boolean [].class || type == String [].class
628628 || SimpleSerializable .isSubclassOf (type , SimpleSerializable [].class )) {
629- source .append (", retain) NSMutableArray<NSNumber> *" );
629+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSMutableArray<NSNumber> *" );
630630 } else {
631631 System .out .println ("Unsupported type " + type );
632632 }
@@ -858,7 +858,7 @@ public static String generateImplementation(SimpleSerializable s) {
858858 source .append ("}\r \n " );
859859 source .append ("\r \n " );
860860
861- if (needDealloc ) {
861+ if (needDealloc && ! supportsARC ) {
862862 source .append ("- (void) dealloc {\r \n " );
863863 SourceUtils .insertLineComment (source , "\t " , index ++, false );
864864 for (Iterator <Field > itr = fields .iterator (); itr .hasNext ();) {
@@ -880,6 +880,10 @@ public static String generateImplementation(SimpleSerializable s) {
880880 source .append ("\t [super dealloc];\r \n " );
881881 source .append ("}\r \n " );
882882 source .append ("\r \n " );
883+ } else if (needDealloc ) {
884+ index ++;
885+ index ++;
886+ source .append ("\r \n " );
883887 }
884888 SourceUtils .insertLineComment (source , "" , index ++, true );
885889
@@ -1091,9 +1095,15 @@ public static void main(String[] args) {
10911095 source .append ("\t if ([className compare:@\" " );
10921096 source .append (j2sSimpleClazz );
10931097 source .append ("\" ] == 0) {\r \n " );
1094- source .append ("\t \t return [[[" );
1095- source .append (simpleName );
1096- source .append (" alloc] init] autorelease];\r \n " );
1098+ if (!supportsARC ) {
1099+ source .append ("\t \t return [[[" );
1100+ source .append (simpleName );
1101+ source .append (" alloc] init] autorelease];\r \n " );
1102+ } else {
1103+ source .append ("\t \t return [[" );
1104+ source .append (simpleName );
1105+ source .append (" alloc] init];\r \n " );
1106+ }
10971107 source .append ("\t }\r \n " );
10981108 }
10991109 }
0 commit comments