Buggy code:
public class NativesGenerator extends JNIGenerator { boolean enterExitMacro ; public NativesGenerator ( ) { } public void generateCopyright ( ) { } public void generateIncludes ( ) { } public void generate ( Class clazz , String methodName ) { } public void generate ( Class clazz ) { } public void generate ( Method [ ] methods ) { } public void generate ( Method method ) { } public void setEnterExitMacro ( boolean enterExitMacro ) { } void generateExcludes ( Method [ ] methods ) { } void generateNativeMacro ( Class clazz ) { } boolean generateGetParameter ( Method method , int i , Class paramType , ParameterData paramData , boolean critical , int indent ) { } void generateSetParameter ( int i , Class paramType , ParameterData paramData , boolean critical ) { } void generateExitMacro ( Method method , String function ) { } void generateEnterMacro ( Method method , String function ) { } boolean generateLocalVars ( Method method , Class [ ] paramTypes , Class returnType ) { } boolean generateGetters ( Method method , Class [ ] paramTypes ) { } void generateSetters ( Method method , Class [ ] paramTypes ) { } void generateDynamicFunctionCall ( Method method , MethodData methodData , Class [ ] paramTypes , Class returnType , boolean needsReturn ) { outputln ( "//*" ) ; generateFunctionCall ( method , methodData , paramTypes , returnType , needsReturn ) ; outputln ( "*//" ) ; outputln ( "\t{" ) ; String name = method . getName ( ) ; if ( name . startsWith ( "_" ) ) name = name . substring ( 1 ) ; if ( getPlatform ( ) . equals ( "win32" ) ) { outputln ( "\t\tstatic<seq2seq4repair_space>int<seq2seq4repair_space>initialized<seq2seq4repair_space>=<seq2seq4repair_space>0;" ) ; outputln ( "\t\tstatic<seq2seq4repair_space>HMODULE<seq2seq4repair_space>hm<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; outputln ( "\t\tstatic<seq2seq4repair_space>FARPROC<seq2seq4repair_space>fp<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; if ( returnType != ( Void . TYPE ) ) { if ( needsReturn ) { outputln ( "\t\trc<seq2seq4repair_space>=<seq2seq4repair_space>0;" ) ; } } outputln ( "\t\tif<seq2seq4repair_space>(!initialized)<seq2seq4repair_space>{" ) ; output ( "\t\t\tif<seq2seq4repair_space>(!hm)<seq2seq4repair_space>hm<seq2seq4repair_space>=<seq2seq4repair_space>LoadLibrary(" ) ; output ( name ) ; outputln ( "_LIB);" ) ; output ( "\t\t\tif<seq2seq4repair_space>(hm)<seq2seq4repair_space>fp<seq2seq4repair_space>=<seq2seq4repair_space>GetProcAddress(hm,<seq2seq4repair_space>\"" ) ; output ( name ) ; outputln ( "\");" ) ; outputln ( "\t\t\tinitialized<seq2seq4repair_space>=<seq2seq4repair_space>1;" ) ; outputln ( "\t\t}" ) ; outputln ( "\t\tif<seq2seq4repair_space>(fp)<seq2seq4repair_space>{" ) ; output ( "\t\t" ) ; generateFunctionCallLeftSide ( method , methodData , returnType , needsReturn ) ; output ( "fp" ) ; generateFunctionCallRightSide ( method , methodData , paramTypes , 0 ) ; output ( ";" ) ; outputln ( ) ; outputln ( "\t\t}" ) ; } else <START_BUG> if ( getPlatform ( ) . equals ( "carbon" ) ) { <END_BUG> outputln ( "\t\tstatic<seq2seq4repair_space>int<seq2seq4repair_space>initialized<seq2seq4repair_space>=<seq2seq4repair_space>0;" ) ; outputln ( "\t\tstatic<seq2seq4repair_space>CFBundleRef<seq2seq4repair_space>bundle<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; output ( "\t\ttypedef<seq2seq4repair_space>" ) ; output ( getTypeSignature2 ( returnType ) ) ; output ( "<seq2seq4repair_space>(*FPTR)(" ) ; for ( int i = 0 ; i < ( paramTypes . length ) ; i ++ ) { if ( i != 0 ) output ( ",<seq2seq4repair_space>" ) ; Class paramType = paramTypes [ i ] ; ParameterData paramData = getMetaData ( ) . getMetaData ( method , i ) ; String cast = paramData . getCast ( ) ; if ( ( cast . length ( ) ) > 2 ) { output ( cast . substring ( 1 , ( ( cast . length ( ) ) - 1 ) ) ) ; } else { output ( getTypeSignature4 ( paramType , paramData . getFlag ( FLAG_STRUCT ) ) ) ; } } outputln ( ");" ) ; outputln ( "\t\tstatic<seq2seq4repair_space>FPTR<seq2seq4repair_space>fptr;" ) ; if ( returnType != ( Void . TYPE ) ) { if ( needsReturn ) { outputln ( "\t\trc<seq2seq4repair_space>=<seq2seq4repair_space>0;" ) ; } } outputln ( "\t\tif<seq2seq4repair_space>(!initialized)<seq2seq4repair_space>{" ) ; output ( "\t\t\tif<seq2seq4repair_space>(!bundle)<seq2seq4repair_space>bundle<seq2seq4repair_space>=<seq2seq4repair_space>CFBundleGetBundleWithIdentifier(CFSTR(" ) ; output ( name ) ; outputln ( "_LIB));" ) ; output ( "\t\t\tif<seq2seq4repair_space>(bundle)<seq2seq4repair_space>fptr<seq2seq4repair_space>=<seq2seq4repair_space>(FPTR)CFBundleGetFunctionPointerForName(bundle,<seq2seq4repair_space>CFSTR(\"" ) ; output ( name ) ; outputln ( "\"));" ) ; outputln ( "\t\t\tinitialized<seq2seq4repair_space>=<seq2seq4repair_space>1;" ) ; outputln ( "\t\t}" ) ; outputln ( "\t\tif<seq2seq4repair_space>(fptr)<seq2seq4repair_space>{" ) ; output ( "\t\t" ) ; generateFunctionCallLeftSide ( method , methodData , returnType , needsReturn ) ; output ( "(*fptr)" ) ; generateFunctionCallRightSide ( method , methodData , paramTypes , 0 ) ; output ( ";" ) ; outputln ( ) ; outputln ( "\t\t}" ) ; } else { outputln ( "\t\tstatic<seq2seq4repair_space>int<seq2seq4repair_space>initialized<seq2seq4repair_space>=<seq2seq4repair_space>0;" ) ; outputln ( "\t\tstatic<seq2seq4repair_space>void<seq2seq4repair_space>*handle<seq2seq4repair_space>=<seq2seq4repair_space>NULL;" ) ; output ( "\t\ttypedef<seq2seq4repair_space>" ) ; output ( getTypeSignature2 ( returnType ) ) ; output ( "<seq2seq4repair_space>(*FPTR)(" ) ; for ( int i = 0 ; i < ( paramTypes . length ) ; i ++ ) { if ( i != 0 ) output ( ",<seq2seq4repair_space>" ) ; Class paramType = paramTypes [ i ] ; ParameterData paramData = getMetaData ( ) . getMetaData ( method , i ) ; String cast = paramData . getCast ( ) ; if ( ( cast . length ( ) ) > 2 ) { output ( cast . substring ( 1 , ( ( cast . length ( ) ) - 1 ) ) ) ; } else { output ( getTypeSignature4 ( paramType , paramData . getFlag ( FLAG_STRUCT ) ) ) ; } } outputln ( ");" ) ; outputln ( "\t\tstatic<seq2seq4repair_space>FPTR<seq2seq4repair_space>fptr;" ) ; if ( returnType != ( Void . TYPE ) ) { if ( needsReturn ) { outputln ( "\t\trc<seq2seq4repair_space>=<seq2seq4repair_space>0;" ) ; } } outputln ( "\t\tif<seq2seq4repair_space>(!initialized)<seq2seq4repair_space>{" ) ; output ( "\t\t\tif<seq2seq4repair_space>(!handle)<seq2seq4repair_space>handle<seq2seq4repair_space>=<seq2seq4repair_space>dlopen(" ) ; output ( name ) ; outputln ( "_LIB,<seq2seq4repair_space>RTLD_LAZY);" ) ; output ( "\t\t\tif<seq2seq4repair_space>(handle)<seq2seq4repair_space>fptr<seq2seq4repair_space>=<seq2seq4repair_space>(FPTR)dlsym(handle,<seq2seq4repair_space>\"" ) ; output ( name ) ; outputln ( "\");" ) ; outputln ( "\t\t\tinitialized<seq2seq4repair_space>=<seq2seq4repair_space>1;" ) ; outputln ( "\t\t}" ) ; outputln ( "\t\tif<seq2seq4repair_space>(fptr)<seq2seq4repair_space>{" ) ; output ( "\t\t" ) ; generateFunctionCallLeftSide ( method , methodData , returnType , needsReturn ) ; output ( "(*fptr)" ) ; generateFunctionCallRightSide ( method , methodData , paramTypes , 0 ) ; output ( ";" ) ; outputln ( ) ; outputln ( "\t\t}" ) ; } outputln ( "\t}" ) ; }

Fix:
if ( ( getPlatform ( ) . equals ( "carbon" ) ) || ( getPlatform ( ) . equals ( "cocoa" ) ) ) {