@@ -601,32 +601,32 @@ public static String generateHeaderFromObject(SimpleSerializable s) {
601
601
} else if (type == boolean .class ) {
602
602
source .append (") BOOL " );
603
603
} else if (type == String .class ) {
604
- source .append (", retain) NSString *" );
604
+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSString *" );
605
605
} else if (SimpleSerializable .isSubclassOf (type , SimpleSerializable .class )) {
606
- source .append (", retain) " );
606
+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) " );
607
607
source .append (type .getSimpleName ());
608
608
source .append (" *" );
609
609
} else if (type == byte [].class ) {
610
610
if (s .bytesCompactMode ()) {
611
- source .append (", retain) NSData *" );
611
+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSData *" );
612
612
} else {
613
- source .append (", retain) NSMutableArray<NSNumber> *" );
613
+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSMutableArray<NSNumber> *" );
614
614
}
615
615
} else if (type == String [].class ) {
616
- source .append (", retain) NSMutableArray<NSString> *" );
616
+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSMutableArray<NSString> *" );
617
617
} else if (SimpleSerializable .isSubclassOf (type , SimpleSerializable [].class )) {
618
618
//if (!SimpleSerializable.isSubclassOf(type, SimpleRPCRunnable[].class)) {
619
- source .append (", retain) NSMutableArray<" );
619
+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSMutableArray<" );
620
620
source .append (type .getComponentType ().getSimpleName ());
621
621
source .append ("> *" );
622
622
//} else {
623
- // source.append(", retain) NSMutableArray *");
623
+ // source.append(", " + (!supportsARC ? " retain" : "strong") + " ) NSMutableArray *");
624
624
//}
625
625
} else if (type == int [].class || type == long [].class || type == double [].class
626
626
|| type == short [].class || type == char [].class
627
627
|| type == float [].class || type == boolean [].class || type == String [].class
628
628
|| SimpleSerializable .isSubclassOf (type , SimpleSerializable [].class )) {
629
- source .append (", retain) NSMutableArray<NSNumber> *" );
629
+ source .append (", " + (! supportsARC ? " retain" : "strong" ) + " ) NSMutableArray<NSNumber> *" );
630
630
} else {
631
631
System .out .println ("Unsupported type " + type );
632
632
}
@@ -858,7 +858,7 @@ public static String generateImplementation(SimpleSerializable s) {
858
858
source .append ("}\r \n " );
859
859
source .append ("\r \n " );
860
860
861
- if (needDealloc ) {
861
+ if (needDealloc && ! supportsARC ) {
862
862
source .append ("- (void) dealloc {\r \n " );
863
863
SourceUtils .insertLineComment (source , "\t " , index ++, false );
864
864
for (Iterator <Field > itr = fields .iterator (); itr .hasNext ();) {
@@ -880,6 +880,10 @@ public static String generateImplementation(SimpleSerializable s) {
880
880
source .append ("\t [super dealloc];\r \n " );
881
881
source .append ("}\r \n " );
882
882
source .append ("\r \n " );
883
+ } else if (needDealloc ) {
884
+ index ++;
885
+ index ++;
886
+ source .append ("\r \n " );
883
887
}
884
888
SourceUtils .insertLineComment (source , "" , index ++, true );
885
889
@@ -1091,9 +1095,15 @@ public static void main(String[] args) {
1091
1095
source .append ("\t if ([className compare:@\" " );
1092
1096
source .append (j2sSimpleClazz );
1093
1097
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
+ }
1097
1107
source .append ("\t }\r \n " );
1098
1108
}
1099
1109
}
0 commit comments