Buggy code:
public class Example1_Simple { private Workspace workspace = null ; public Example1_Simple ( Workspace workspace ) throws Exception { } void generate ( ) throws Exception { String className = "Simple" ; CppClass class_CRectangleSimple = factory . create ( className ) ; class_CRectangleSimple . setComment ( new CCommentImpl ( "A<seq2seq4repair_space>simple<seq2seq4repair_space>class" ) ) ; CppTypeGenerator type_int = new CppTypeGenerator ( Cpp . INT ) ; CppVar var_x = CppVar . factory . create ( PRIVATE , type_int . toString ( ) , "x" , "1" ) ; var_x . setComment ( new CCommentImpl ( "A<seq2seq4repair_space>nice<seq2seq4repair_space>comment<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>variable<seq2seq4repair_space>x" ) ) ; CppVar var_y = CppVar . factory . create ( PRIVATE , type_int . toString ( ) , "y" ) ; var_y . setComment ( new CCommentImpl ( "A<seq2seq4repair_space>nice<seq2seq4repair_space>comment<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>variable<seq2seq4repair_space>y" ) ) ; class_CRectangleSimple . add ( var_y ) ; class_CRectangleSimple . add ( var_x ) ; CppVar var_a = CppVar . factory . create ( type_int , "a" ) ; CppVar var_b = CppVar . factory . create ( type_int , "b" ) ; CppFun fun_set_values = CppFun . factory . create ( VOID , "set_values" , var_a , var_b ) ; fun_set_values . appendCode ( "x<seq2seq4repair_space>=<seq2seq4repair_space>a;" ) ; fun_set_values . appendCode ( "y<seq2seq4repair_space>=<seq2seq4repair_space>b;" ) ; CppConstructor con = CppConstructor . factory . create ( var_a , var_b ) ; con . appendCode ( "set_values(a,b);" ) ; class_CRectangleSimple . add ( PUBLIC , con ) ; CppFunCommentImpl comment_fun_set_values = new CppFunCommentImpl ( "This<seq2seq4repair_space>function<seq2seq4repair_space>sets<seq2seq4repair_space>the<seq2seq4repair_space>values<seq2seq4repair_space>x<seq2seq4repair_space>and<seq2seq4repair_space>y." ) ; comment_fun_set_values . addParameter ( var_a , "An<seq2seq4repair_space>integer<seq2seq4repair_space>a" ) ; comment_fun_set_values . addParameter ( var_b , "An<seq2seq4repair_space>integer<seq2seq4repair_space>b" ) ; fun_set_values . setComment ( comment_fun_set_values ) ; class_CRectangleSimple . add ( PUBLIC , fun_set_values ) ; CppFun fun_area = CppFun . factory . create ( type_int , "area" ) ; CppFunCommentImpl comment_fun_area = new CppFunCommentImpl ( "This<seq2seq4repair_space>function<seq2seq4repair_space>multiplies<seq2seq4repair_space>two<seq2seq4repair_space>values." ) ; comment_fun_area . setReturnTypeDescription ( "The<seq2seq4repair_space>value<seq2seq4repair_space>of<seq2seq4repair_space>x*y." ) ; fun_area . setComment ( comment_fun_area ) ; fun_area . appendCode ( "return<seq2seq4repair_space>(x*y);" ) ; class_CRectangleSimple . add ( PUBLIC , fun_area ) ; <START_BUG> CppSourceFile file = workspace . getC ( ) . getCppSourceFile ( className ) ; <END_BUG> CppSourceFile header = this . workspace . getC ( ) . getCppHeaderFile ( className ) ; file . addInclude ( header ) ; header . setComment ( new CCommentImpl ( "The<seq2seq4repair_space>header<seq2seq4repair_space>file." ) ) ; file . addLibInclude ( "iostream" ) ; file . addUsingNamespace ( "std" ) ; file . setComment ( new CCommentImpl ( "This<seq2seq4repair_space>file<seq2seq4repair_space>contains<seq2seq4repair_space>a<seq2seq4repair_space>simple<seq2seq4repair_space>class." ) ) ; CFun fun_main = CFun . factory . create ( "main" , "int" , null ) ; fun_main . appendCode ( ( className + "<seq2seq4repair_space>rect(3,4);" ) ) ; fun_main . appendCode ( "cout<seq2seq4repair_space><<<seq2seq4repair_space>rect.area()<seq2seq4repair_space><<<seq2seq4repair_space>\"\\n\";" ) ; fun_main . appendCode ( "return<seq2seq4repair_space>0;" ) ; fun_main . setComment ( new CCommentImpl ( "Here<seq2seq4repair_space>is<seq2seq4repair_space>the<seq2seq4repair_space>main." ) ) ; file . add ( fun_main ) ; header . add ( class_CRectangleSimple ) ; } }

Fix:
CppSourceFile file = this . workspace . getC ( ) . getCppSourceFile ( className ) ;