Buggy code:
public class Java2TypeScriptTranslator extends AbstractTreePrinter { protected static Logger logger = Logger . getLogger ( Java2TypeScriptTranslator . class ) ; private static class Scope { private boolean interfaceScope = false ; private boolean sharedMode = false ; private boolean enumScope = false ; private boolean removedSuperclass = false ; private boolean declareClassScope ; private boolean skipTypeAnnotations = false ; private boolean defaultMethodScope = false ; private boolean eraseVariableTypes = false ; private boolean hasDeclaredConstructor = false ; private boolean innerClassNotStatic = false ; } private Stack < Java2TypeScriptTranslator . Scope > scope = new Stack < > ( ) ; private Java2TypeScriptTranslator . Scope getScope ( ) { } private void enterScope ( ) { } private void exitScope ( ) { } public Java2TypeScriptTranslator ( TranspilationHandler logHandler , JSweetContext context , JCCompilationUnit compilationUnit , boolean preserveSourceLineNumbers ) { } @ Override public String getTargetFilesExtension ( ) { } private static List < Class < ? > > statementsWithNoSemis = Arrays . asList ( new Class < ? > [ ] { JCIf . class , JCForLoop . class , JCEnhancedForLoop . class , JCSwitch . class } ) ; private static Map < String , String > instanceOfTypeMapping = new HashMap < String , String > ( ) ; private JCMethodDecl mainMethod ; private List < JCImport > imports = new ArrayList < JCImport > ( ) ; private boolean globalModule = false ; private PackageSymbol topLevelPackage ; private void useModule ( PackageSymbol targetPackage , JCTree sourceTree , String targetName , String moduleName ) { } private boolean checkRootPackageParent ( JCCompilationUnit topLevel , PackageSymbol rootPackage , PackageSymbol parentPackage ) { } @ Override public void visitTopLevel ( JCCompilationUnit topLevel ) { } private void printDocComment ( JCTree element , boolean indent ) { } @ Override public void visitClassDef ( JCClassDecl classdecl ) { } private void printDefaultImplementation ( MethodSymbol method ) { } private String getQualifiedTypeName ( TypeSymbol type , boolean globals ) { } private String getTSMethodName ( JCMethodDecl methodDecl ) { } @ Override public void visitMethodDef ( JCMethodDecl methodDecl ) { } private void printInterfacesInitialization ( ClassSymbol clazz , MethodSymbol method ) { } private String parseJSNI ( String jsniCode ) { } private void printInlinedConstructorBody ( Overload overload , JCMethodDecl method , List < ? extends JCTree > args ) { } private void printBlockStatements ( List < JCStatement > statements ) { } private void printBlockStatement ( JCStatement statement ) { } private String getOverloadMethodName ( JCMethodDecl method ) { if ( method . sym . isConstructor ( ) ) { return "constructor" ; } StringBuilder sb = new StringBuilder ( method . getName ( ) . toString ( ) ) ; sb . append ( "$" ) ; for ( JCVariableDecl p : method . getParameters ( ) ) { <START_BUG> sb . append ( p . type . toString ( ) . replace ( '.' , '_' ) . replace ( "[]" , "_A" ) ) ; <END_BUG> sb . append ( "$" ) ; } if ( ! ( method . getParameters ( ) . isEmpty ( ) ) ) { sb . deleteCharAt ( ( ( sb . length ( ) ) - 1 ) ) ; } return sb . toString ( ) ; } private void printMethodParamsTest ( JCMethodDecl coreMethod , JCMethodDecl m ) { } @ Override public void visitBlock ( JCBlock block ) { } private String avoidJSKeyword ( String name ) { } @ Override public void visitVarDef ( JCVariableDecl varDecl ) { } private boolean isVarargs ( JCVariableDecl varDecl ) { } private boolean hasVarargs ( MethodSymbol methodSymbol ) { } @ Override public void visitParens ( JCParens parens ) { } @ Override public void visitImport ( JCImport importDecl ) { } @ Override public void visitSelect ( JCFieldAccess fieldAccess ) { } private JCImport getStaticImport ( String methName ) { } private String getStaticContainerFullName ( JCImport importDecl ) { } private long applyTargetRefCounter = 0 ; @ Override public void visitApply ( JCMethodInvocation inv ) { } @ Override public void visitIdent ( JCIdent ident ) { } @ Override public void visitTypeApply ( JCTypeApply typeApply ) { } @ Override public void visitNewClass ( JCNewClass newClass ) { } @ Override public AbstractTreePrinter printConstructorArgList ( JCNewClass newClass ) { } @ Override public void visitLiteral ( JCLiteral literal ) { } @ Override public void visitIndexed ( JCArrayAccess arrayAccess ) { } @ Override public void visitForeachLoop ( JCEnhancedForLoop foreachLoop ) { } @ Override public void visitTypeIdent ( JCPrimitiveTypeTree type ) { } @ Override public void visitBinary ( JCBinary binary ) { } @ Override public void visitIf ( JCIf ifStatement ) { } @ Override public void visitReturn ( JCReturn returnStatement ) { } @ Override public void visitAssignop ( JCAssignOp op ) { } @ Override public void visitConditional ( JCConditional conditional ) { } @ Override public void visitForLoop ( JCForLoop forLoop ) { } @ Override public void visitContinue ( JCContinue continueStatement ) { } @ Override public void visitBreak ( JCBreak breakStatement ) { } @ Override public void visitLabelled ( JCLabeledStatement labelledStatement ) { } @ Override public void visitTypeArray ( JCArrayTypeTree arrayType ) { } @ Override public void visitNewArray ( JCNewArray newArray ) { } @ Override public void visitUnary ( JCUnary unary ) { } @ Override public void visitSwitch ( JCSwitch switchStatement ) { } @ Override public void visitCase ( JCCase caseStatement ) { } @ Override public void visitTypeCast ( JCTypeCast cast ) { } @ Override public void visitDoLoop ( JCDoWhileLoop doWhileLoop ) { } @ Override public void visitWhileLoop ( JCWhileLoop whileLoop ) { } @ Override public void visitAssign ( JCAssign assign ) { } @ Override public void visitTry ( JCTry tryStatement ) { } @ Override public void visitCatch ( JCCatch catcher ) { } @ Override public void visitLambda ( JCLambda lamba ) { }

Fix:
sb . append ( types . erasure ( p . type ) . toString ( ) . replace ( '.' , '_' ) . replace ( "[]" , "_A" ) ) ;