Buggy code:
public class CodeGenerator { public ArrayList < String > list_func ; private final Configuration config ; private final String prefix = "_" ; private HashMap < String , String > vars ; private HashMap < String , Type > params ; private ArrayList < String > statements ; private BinaryOperator loop_condition ; private String loop_label ; private Stack < String > assert_labels ; private String indent = "\t" ; private HashMap < String , Symbol > symbols ; public CodeGenerator ( Configuration config ) { } private Symbol getSymbol ( String name ) { } private Object getAttribute ( String name , String att_name ) { } private void putAttribute ( String name , String att_name , Object att_value ) { } public int printWyILCode ( Code code , String name , int line ) { } private String translate ( Type type ) { } private void addStatement ( Code code , String stat ) { } public String translate ( FunctionOrMethodDeclaration functionOrMethod ) { } private void increaseIndent ( ) { } private void decreaseIndent ( ) { } public boolean isBoolTypeIntroduced ( ) { } public void printoutCode ( PrintWriter writer , String function_del ) { } private void translate ( Codes . Const code ) { } private void translate ( Codes . Assign code ) { } private void translate ( Codes . LengthOf code ) { } private void translate ( Codes . BinaryOperator code ) { } private void translate ( Codes . ForAll code ) { } private String translate ( int [ ] operands , List < Type > paramTypes ) { } private String translate ( int [ ] operands , List < Type > paramTypes , String ret , Type return_type ) { } private void translate ( Codes . Invoke code ) { String stat = indent ; String ret = ( prefix ) + ( code . target ( ) ) ; Type return_type = code . type ( ) . ret ( ) ; if ( code . name . toString ( ) . equals ( "whiley//lang//Any:toString" ) ) { if ( ! ( code . type ( ) . params ( ) . isEmpty ( ) ) ) { String param = ( prefix ) + ( code . operand ( 0 ) ) ; <START_BUG> Type paramType = code . type ( ) . params ( ) . get ( 0 ) ; <END_BUG> vars . put ( ( ret + "[1024]" ) , "char" ) ; if ( paramType instanceof Type . Int ) { if ( ret . equals ( param ) ) { ret = ret + "_str" ; } stat += ( ( ( ( "sprintf(" + ret ) + ",<seq2seq4repair_space>\"%lld\",<seq2seq4repair_space>" ) + ( prefix ) ) + ( code . operand ( 0 ) ) ) + ");" ; addStatement ( code , stat ) ; } else { stat += "toString(" ; ArrayList < Type > params = new ArrayList < Type > ( ) ; for ( int op : code . operands ( ) ) { paramType = ( ( Type ) ( getAttribute ( ( ( prefix ) + op ) , "type" ) ) ) ; params . add ( paramType ) ; } stat += translate ( code . operands ( ) , params ) ; stat += ( ",<seq2seq4repair_space>" + ret ) + ");\n" ; addStatement ( code , stat ) ; } } } else { stat += ( ( ret + "=" ) + ( code . name . name ( ) ) ) + "(" ; stat += translate ( code . operands ( ) , code . type ( ) . params ( ) ) ; stat += ");\n" ; stat += translate ( code . operands ( ) , code . type ( ) . params ( ) , ret , return_type ) ; addStatement ( code , stat ) ; } } private void translate ( Codes . If code ) { } private void translate ( Codes . AssertOrAssume code ) { } private void translate ( Codes . Goto code ) { } private void translate ( Codes . Label code ) { } private void translate ( Codes . Fail code ) { } private void translate ( Codes . Update code ) { } private void translate ( Codes . Nop code ) { } private void translate ( Codes . LoopEnd code ) { } private void translate ( Codes . Return code ) { } private void translate ( Codes . IndexOf code ) { } private void translate ( Codes . NewList code ) { } private void translate ( Codes . FieldLoad code ) { } private void translate ( Codes . Convert code ) { } private void translate ( Codes . IndirectInvoke code ) { } private void translate ( UnaryOperator code ) { } private void translate ( Loop code ) { } private void translate ( StringOperator code ) { } private void translate ( ListOperator code ) { } public void dispatch ( Block . Entry entry ) { } }

Fix:
Type paramType = ( ( Type ) ( getAttribute ( param , "type" ) ) ) ;