@@ -99,7 +99,7 @@ public String generateDtsContent(List<JavaClass> javaClasses) {
99
99
processField (f , currClass );
100
100
}
101
101
} else {
102
- List <FieldOrMethod > foms = getMembers (currClass );
102
+ List <FieldOrMethod > foms = getMembers (currClass , getAllInterfaces ( currClass ) );
103
103
for (FieldOrMethod fom : foms ) {
104
104
if (fom instanceof Field ) {
105
105
processField ((Field ) fom , currClass );
@@ -320,7 +320,8 @@ private List<JavaClass> getInterfaces(JavaClass classInterface) {
320
320
// TODO: Pete: Hardcoded until we figure out how to go around the 'type incompatible with Object' issue
321
321
if (className .equals ("java.util.Iterator" ) ||
322
322
className .equals ("android.animation.TypeEvaluator" ) ||
323
- className .equals ("java.lang.Comparable" )) {
323
+ className .equals ("java.lang.Comparable" ) ||
324
+ className .startsWith ("java.util.function" )) {
324
325
continue ;
325
326
}
326
327
@@ -491,9 +492,16 @@ private String getMethodParamSignature(JavaClass clazz, Method m) {
491
492
sb .append ("param" );
492
493
sb .append (idx ++);
493
494
sb .append (": " );
494
- addReference ( type );
495
+
495
496
String paramTypeName = getTypeScriptTypeFromJavaType (clazz , type );
496
- sb .append (paramTypeName );
497
+
498
+ // TODO: Pete:
499
+ if (paramTypeName .startsWith ("java.util.function" )) {
500
+ sb .append ("any /* " + paramTypeName + "*/" );
501
+ } else {
502
+ addReference (type );
503
+ sb .append (paramTypeName );
504
+ }
497
505
}
498
506
sb .append (")" );
499
507
String sig = sb .toString ();
@@ -590,8 +598,14 @@ else if (isObjectType)
590
598
{
591
599
typeName = typeName .replaceAll ("\\ $" , "\\ ." );
592
600
}
593
- tsType .append (typeName );
594
- addReference (type );
601
+
602
+ // TODO: Pete:
603
+ if (typeName .startsWith ("java.util.function" )) {
604
+ tsType .append ("any /*" + typeName + "*/" );
605
+ } else {
606
+ tsType .append (typeName );
607
+ addReference (type );
608
+ }
595
609
}
596
610
else
597
611
{
@@ -613,10 +627,16 @@ private void addReference(Type type) {
613
627
}
614
628
}
615
629
616
- private List <FieldOrMethod > getMembers (JavaClass javaClass ) {
630
+ private List <FieldOrMethod > getMembers (JavaClass javaClass , List < JavaClass > interfaces ) {
617
631
Set <String > methodNames = new HashSet <String >();
618
632
ArrayList <FieldOrMethod > members = new ArrayList <FieldOrMethod >();
619
- for (Method m : javaClass .getMethods ()) {
633
+
634
+ List <Method > allInterfacesMethods = getAllInterfacesMethods (interfaces );
635
+ List <Method > methods = new ArrayList <>();
636
+ methods .addAll (Arrays .asList (javaClass .getMethods ()));
637
+ methods .addAll (allInterfacesMethods );
638
+
639
+ for (Method m : methods ) {
620
640
if ((m .isPublic () || m .isProtected ()) && !m .isSynthetic ()) {
621
641
members .add (m );
622
642
methodNames .add (m .getName ());
@@ -627,6 +647,7 @@ private List<FieldOrMethod> getMembers(JavaClass javaClass) {
627
647
members .add (f );
628
648
}
629
649
}
650
+
630
651
return members ;
631
652
}
632
653
0 commit comments