@@ -669,7 +669,7 @@ private void printAnnotationProperties(List<AnnotationTypeMemberDeclaration> mem
669
669
private void printTypeAnnotationsMethod (AbstractTypeDeclaration decl ) {
670
670
List <Annotation > runtimeAnnotations = TreeUtil .getRuntimeAnnotationsList (decl .getAnnotations ());
671
671
if (runtimeAnnotations .size () > 0 ) {
672
- println ("+ (IOSObjectArray *)__annotations {" );
672
+ println ("\n + (IOSObjectArray *)__annotations {" );
673
673
printAnnotationCreate (runtimeAnnotations );
674
674
}
675
675
}
@@ -679,7 +679,7 @@ private void printMethodAnnotationMethods(Iterable<MethodDeclaration> methods) {
679
679
List <Annotation > runtimeAnnotations =
680
680
TreeUtil .getRuntimeAnnotationsList (method .getAnnotations ());
681
681
if (runtimeAnnotations .size () > 0 ) {
682
- printf ("+ (IOSObjectArray *)__annotations_%s {\n " , methodKey (method .getMethodBinding ()));
682
+ printf ("\n + (IOSObjectArray *)__annotations_%s {\n " , methodKey (method .getMethodBinding ()));
683
683
printAnnotationCreate (runtimeAnnotations );
684
684
}
685
685
printParameterAnnotationMethods (method );
@@ -731,7 +731,7 @@ private void printFieldAnnotationMethods(AbstractTypeDeclaration node) {
731
731
TreeUtil .getRuntimeAnnotationsList (field .getAnnotations ());
732
732
if (!runtimeAnnotations .isEmpty ()) {
733
733
for (VariableDeclarationFragment var : field .getFragments ()) {
734
- printf ("+ (IOSObjectArray *)__annotations_%s_ {\n " , var .getName ().getIdentifier ());
734
+ printf ("\n + (IOSObjectArray *)__annotations_%s_ {\n " , var .getName ().getIdentifier ());
735
735
printAnnotationCreate (runtimeAnnotations );
736
736
}
737
737
}
@@ -742,7 +742,7 @@ private void printAnnotationCreate(List<Annotation> runtimeAnnotations) {
742
742
print (" return [IOSObjectArray arrayWithObjects:(id[]) { " );
743
743
printAnnotations (runtimeAnnotations );
744
744
printf (" } count:%d type:[IOSClass "
745
- + "classWithProtocol:@protocol(JavaLangAnnotationAnnotation)]];\n }\n \n " ,
745
+ + "classWithProtocol:@protocol(JavaLangAnnotationAnnotation)]];\n }\n " ,
746
746
runtimeAnnotations .size ());
747
747
}
748
748
@@ -794,7 +794,11 @@ private void printAnnotationValue(Object value) {
794
794
printf ("%s_get_%s()" , NameTable .getFullName (declaringClass ), var .getName ());
795
795
} else if (value instanceof ITypeBinding ) {
796
796
ITypeBinding type = (ITypeBinding ) value ;
797
- printf ("[[%s class] getClass]" , NameTable .getFullName (type ));
797
+ if (type .isInterface ()) {
798
+ printf ("[IOSClass classWithProtocol:@protocol(%s)]" , NameTable .getFullName (type ));
799
+ } else {
800
+ printf ("[[%s class] getClass]" , NameTable .getFullName (type ));
801
+ }
798
802
} else if (value instanceof String ) {
799
803
StringLiteral node = new StringLiteral ((String ) value );
800
804
print (StatementGenerator .generateStringLiteral (node ));
0 commit comments