@@ -198,33 +198,10 @@ public void generateProxy(ApplicationWriter aw, String proxyName, ClassDescripto
198198 methodOverridesSet .add (methodOverride );
199199 }
200200
201- generateProxy (aw , proxyName , classTo , methodOverridesSet , null );
201+ generateProxy (aw , proxyName , classTo , methodOverridesSet , null , null );
202202 }
203203
204- public void generateProxy (ApplicationWriter aw , ClassDescriptor classTo , String [] methodOverrides , int ignored )
205- {
206- HashSet <String > methodOverridesSet = new HashSet <String >();
207-
208- for (int i = 0 ; i < methodOverrides .length ; i ++)
209- {
210- String methodOverride = methodOverrides [i ];
211- methodOverridesSet .add (methodOverride );
212- }
213-
214- generateProxy (aw , "0" , classTo , methodOverridesSet , null );
215- }
216-
217- public void generateProxy (ApplicationWriter aw , String proxyName , ClassDescriptor classTo )
218- {
219- generateProxy (aw , proxyName , classTo , null , null );
220- }
221-
222- public void generateProxy (ApplicationWriter aw , ClassDescriptor classTo )
223- {
224- generateProxy (aw , "0" , classTo , null , null );
225- }
226-
227- public void generateProxy (ApplicationWriter aw , String proxyName , ClassDescriptor classTo , HashSet <String > methodOverrides , HashSet <ClassDescriptor > implementedInterfaces )
204+ public void generateProxy (ApplicationWriter aw , String proxyName , ClassDescriptor classTo , HashSet <String > methodOverrides , HashSet <ClassDescriptor > implementedInterfaces , AnnotationDescriptor [] annotations )
228205 {
229206 String classSignature = getAsmDescriptor (classTo );
230207
@@ -237,7 +214,7 @@ public void generateProxy(ApplicationWriter aw, String proxyName, ClassDescripto
237214
238215 tnsClassSignature += ";" ;
239216
240- ClassVisitor cv = generateClass (aw , classTo , classSignature , tnsClassSignature , implementedInterfaces );
217+ ClassVisitor cv = generateClass (aw , classTo , classSignature , tnsClassSignature , implementedInterfaces , annotations );
241218 MethodDescriptor [] methods = getSupportedMethods (classTo , methodOverrides , implementedInterfaces );
242219
243220 methods = groupMethodsByNameAndSignature (methods );
@@ -926,7 +903,7 @@ private void generateInitializedField(ClassVisitor cv)
926903 static final String [] classImplentedInterfaces = new String [] { "Lcom/tns/NativeScriptHashCodeProvider;" };
927904 static final String [] interfaceImplementedInterfaces = new String [] { "Lcom/tns/NativeScriptHashCodeProvider;" , "" };
928905
929- private ClassVisitor generateClass (ApplicationWriter aw , ClassDescriptor classTo , String classSignature , String tnsClassSignature , HashSet <ClassDescriptor > implementedInterfaces )
906+ private ClassVisitor generateClass (ApplicationWriter aw , ClassDescriptor classTo , String classSignature , String tnsClassSignature , HashSet <ClassDescriptor > implementedInterfaces , AnnotationDescriptor [] annotations )
930907 {
931908 ClassVisitor cv ;
932909
@@ -958,10 +935,28 @@ private ClassVisitor generateClass(ApplicationWriter aw, ClassDescriptor classTo
958935
959936 cv = aw .visitClass (classModifiers , tnsClassSignature , null , classSignature , interfacesToImplementArr );
960937 cv .visit (0 , classModifiers , tnsClassSignature , null , classSignature , interfacesToImplementArr );
938+ if ((annotations != null ) && (annotations .length > 0 )) {
939+ for (AnnotationDescriptor ad : annotations ) {
940+ String annotationClassname = ad .getAnnotationClassname ();
941+ boolean isVisible = ad .isRuntimeVisible ();
942+ AnnotationVisitor av = cv .visitAnnotation (annotationClassname , isVisible );
943+ setAnnotationFields (av , ad );
944+ av .visitEnd ();
945+ }
946+ }
961947 cv .visitSource (classTo .getName () + ".java" , null );
962948 return cv ;
963949 }
964950
951+ private void setAnnotationFields (AnnotationVisitor av , AnnotationDescriptor ad ) {
952+ AnnotationDescriptor .Parameter [] params = ad .getParams ();
953+ if (params .length > 0 ) {
954+ for (AnnotationDescriptor .Parameter p : params ) {
955+ av .visit (p .getName (), p .getValue ());
956+ }
957+ }
958+ }
959+
965960 private int getDexModifiers (Descriptor descriptor )
966961 {
967962 if (descriptor .isPublic ())
0 commit comments