@@ -60,6 +60,8 @@ public String generateDtsContent(List<JavaClass> javaClasses) {
6060 JavaClass currClass = javaClasses .get (i );
6161 currentFileClassname = currClass .getClassName ();
6262
63+ String simpleClassName = getSimpleClassname (currClass );
64+
6365 if (currentFileClassname .startsWith ("java.util.function" ) ||
6466 currentFileClassname .startsWith ("android.support.v4.media.routing.MediaRouterJellybeanMr1" ) ||
6567 currentFileClassname .startsWith ("android.support.v4.media.routing.MediaRouterJellybeanMr2" ) ||
@@ -84,13 +86,15 @@ public String generateDtsContent(List<JavaClass> javaClasses) {
8486 List <JavaClass > interfaces = getInterfaces (currClass );
8587 String extendsLine = getExtendsLine (superClass , interfaces );
8688
87- if (getSimpleClassname ( currClass ) .equals ("AccessibilityDelegate" )) {
89+ if (simpleClassName .equals ("AccessibilityDelegate" )) {
8890 sbContent .appendln (tabs + "export class " + getFullClassNameConcatenated (currClass ) + extendsLine + " {" );
8991 } else {
90- sbContent .appendln (tabs + "export" + (isAbstract && !isInterface ? " abstract " : " " ) + "class " + getSimpleClassname ( currClass ) + extendsLine + " {" );
92+ sbContent .appendln (tabs + "export" + (isAbstract && !isInterface ? " abstract " : " " ) + "class " + simpleClassName + extendsLine + " {" );
9193 }
9294 // process member scope
9395
96+ mapNameMethod = new HashMap <String , Method >();
97+
9498 // process constructors for interfaces
9599 if (isInterface ) {
96100 List <JavaClass > allInterfaces = getAllInterfaces (currClass );
@@ -175,7 +179,7 @@ private String getExtendsLine(JavaClass superClass, List<JavaClass> interfaces)
175179
176180 for (JavaClass clazz : interfaces ) {
177181 String implementedInterface = clazz .getClassName ().replaceAll ("\\ $" , "\\ ." );
178- if (!typeBelongsInCurrentTopLevelNamespace (implementedInterface )) {
182+ if (!typeBelongsInCurrentTopLevelNamespace (implementedInterface )) {
179183 implementedInterface = getAliasedClassName (implementedInterface );
180184 }
181185
@@ -187,7 +191,7 @@ private String getExtendsLine(JavaClass superClass, List<JavaClass> interfaces)
187191 }
188192
189193 String extendedClass = superClass .getClassName ().replaceAll ("\\ $" , "\\ ." );
190- if (!typeBelongsInCurrentTopLevelNamespace (extendedClass )) {
194+ if (!typeBelongsInCurrentTopLevelNamespace (extendedClass )) {
191195 extendedClass = getAliasedClassName (extendedClass );
192196 }
193197
@@ -441,6 +445,8 @@ private Set<Field> getAllInterfacesFields(List<JavaClass> interfaces) {
441445 private void processMethod (Method m , JavaClass clazz , boolean isInterface , Set <String > methodsSet ) {
442446 String name = m .getName ();
443447
448+ if (isPrivateGoogleApiMember (name )) return ;
449+
444450 if (m .isSynthetic () || (!m .isPublic () && !m .isProtected ())) {
445451 return ;
446452 }
@@ -498,10 +504,9 @@ private void writeMethods(Set<String> methodsSet) {
498504 }
499505
500506 private void cacheMethodBySignature (Method m ) {
501- mapNameMethod = new HashMap <String , Method >();
502- String currMethodSig = getMethodFullSignature (m );
503- if (!mapNameMethod .containsKey (currMethodSig )) {
504- mapNameMethod .put (currMethodSig , m );
507+ String methodName = m .getName ();
508+ if (!mapNameMethod .containsKey (methodName )) {
509+ mapNameMethod .put (methodName , m );
505510 }
506511 }
507512
@@ -613,6 +618,10 @@ private String getMethodParamSignature(JavaClass clazz, Method m) {
613618
614619 //field related
615620 private void processField (Field f , JavaClass clazz ) {
621+ String fieldName = f .getName ();
622+
623+ if (isPrivateGoogleApiMember (fieldName )) return ;
624+
616625 String tabs = getTabs (this .indent + 1 );
617626 sbContent .append (tabs + "public " );
618627 if (f .isStatic ()) {
@@ -652,7 +661,7 @@ private String getTypeScriptTypeFromJavaType(JavaClass clazz, Type type) {
652661 convertToTypeScriptType (type , sb );
653662 tsType = sb .toString ();
654663
655- if (tsType .startsWith ("java.util.function" )) {
664+ if (tsType .startsWith ("java.util.function" ) || isPrivateGoogleApiClass ( tsType ) ) {
656665 tsType = "any /* " + tsType + "*/" ;
657666 }
658667 }
@@ -691,7 +700,7 @@ private void convertToTypeScriptType(Type type, StringBuilder tsType) {
691700 typeName = typeName .replaceAll ("\\ $" , "\\ ." );
692701 }
693702
694- if (!typeBelongsInCurrentTopLevelNamespace (typeName ) && !typeName .startsWith ("java.util.function." )) {
703+ if (!typeBelongsInCurrentTopLevelNamespace (typeName ) && !typeName .startsWith ("java.util.function." ) && ! isPrivateGoogleApiClass ( typeName ) ) {
695704 tsType .append (getAliasedClassName (typeName ));
696705 } else {
697706 tsType .append (typeName );
@@ -763,6 +772,15 @@ private String getTabs(int count) {
763772 return tabs ;
764773 }
765774
775+ private boolean isPrivateGoogleApiMember (String memberName ) {
776+ return memberName .startsWith ("zz" );
777+ }
778+
779+ private boolean isPrivateGoogleApiClass (String name ) {
780+ String [] classNameParts = name .replace ('$' , '.' ).split ("\\ ." );
781+ return classNameParts .length > 0 && classNameParts [classNameParts .length - 1 ].startsWith ("zz" );
782+ }
783+
766784 private void overrideFieldComparator () {
767785 BCELComparator cmp = Field .getComparator ();
768786
0 commit comments