Buggy code:
public class CThingImplCompiler extends FSMBasedThingImplCompiler { @ Override public void generateImplementation ( Thing thing , Context ctx ) { } public boolean isGeneratingCpp ( ) { } public String getCppNameScope ( ) { } protected void generateCImpl ( Thing thing , CCompilerContext ctx ) { } protected void generatePrototypeforThingDirect ( Function func , StringBuilder builder , CCompilerContext ctx , Thing thing , boolean isPrototype ) { } protected void generateCGlobalAnnotation ( Thing thing , StringBuilder builder , CCompilerContext ctx ) { } protected void generatePrivateCPrototypes ( Thing thing , StringBuilder builder , CCompilerContext ctx ) { StringBuilder cppHeaderBuilder = ctx . getCppHeaderCode ( ) ; if ( ( ThingMLHelpers . allStateMachines ( thing ) . size ( ) ) > 0 ) { StateMachine sm = ThingMLHelpers . allStateMachines ( thing ) . get ( 0 ) ; builder . append ( ( ( "void<seq2seq4repair_space>" + ( ThingMLElementHelper . qname ( sm , "_" ) ) ) + "_OnExit(int<seq2seq4repair_space>state,<seq2seq4repair_space>" ) ) ; builder . append ( ( ( ( ( "struct<seq2seq4repair_space>" + ( ctx . getInstanceStructName ( thing ) ) ) + "<seq2seq4repair_space>*" ) + ( ctx . getInstanceVarName ( ) ) ) + ");\n" ) ) ; } <START_BUG> for ( Port port : thing . allPorts ( ) ) { <END_BUG> for ( Message msg : port . getSends ( ) ) { builder . append ( ( "void<seq2seq4repair_space>" + ( ctx . getSenderName ( thing , port , msg ) ) ) ) ; ctx . appendFormalParameters ( thing , builder , msg ) ; builder . append ( ";\n" ) ; } } for ( Function f : ThingMLHelpers . allFunctions ( thing ) ) { if ( ! ( AnnotatedElementHelper . isDefined ( f , "abstract" , "true" ) ) ) { generatePrototypeforThingDirect ( f , builder , ctx , thing , true ) ; builder . append ( ";\n" ) ; if ( isGeneratingCpp ( ) ) { generatePrototypeforThingDirect ( f , cppHeaderBuilder , ctx , thing , true ) ; cppHeaderBuilder . append ( ";\n" ) ; } } } } protected void generateCFunctions ( Thing thing , StringBuilder builder , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void generateCFunction ( Function func , Thing thing , StringBuilder builder , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void generateCforThingDirect ( Function func , Thing thing , StringBuilder builder , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void generateCforThingLinuxThread ( Function func , Thing thing , StringBuilder builder , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void generateEntryActions ( Thing thing , StringBuilder builder , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void generateExitActions ( Thing thing , StringBuilder builder , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void generateEventHandlers ( Thing thing , StringBuilder builder , CCompilerContext ctx , DebugProfile debugProfile ) { } public void generateEmptyHandlers ( Thing thing , State s , StringBuilder builder , CompositeState cs , Region r , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void dispatchToSessions ( Thing thing , StringBuilder builder , CompositeState cs , Port port , Message msg , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void dispatchToSubRegions ( Thing thing , StringBuilder builder , CompositeState cs , Port port , Message msg , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void generateMessageHandlers ( Thing thing , State s , Port port , Message msg , StringBuilder builder , CompositeState cs , Region r , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void dispatchEmptyToSubRegions ( Thing thing , StringBuilder builder , CompositeState cs , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void dispatchEmptyToSessions ( Thing thing , StringBuilder builder , CompositeState cs , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void generatePrivateMessageSendingOperations ( Thing thing , StringBuilder builder , CCompilerContext ctx , DebugProfile debugProfile ) { } protected void generateCppMessageSendingInit ( Thing thing , StringBuilder builder , CCompilerContext ctx ) { } No newline ; at end ; of file ; }

Fix:
for ( Port port : ThingMLHelpers . allPorts ( thing ) ) {