Buggy code:
} } else if ( ( ( ( ( ( RelevanceQuery . KW_TYPE_INT . equals ( type ) ) || ( RelevanceQuery . KW_TYPE_DOUBLE . equals ( type ) ) ) || ( RelevanceQuery . KW_TYPE_LONG . equals ( type ) ) ) || ( RelevanceQuery . KW_TYPE_FLOAT . equals ( type ) ) ) || ( RelevanceQuery . KW_TYPE_STRING . equals ( type ) ) ) || ( RelevanceQuery . KW_TYPE_BOOL . equals ( type ) ) ) { JSONArray sets = jsonVariables . getJSONArray ( type ) ; for ( int i = 0 ; i < ( sets . length ( ) ) ; i ++ ) { String symbol = sets . getString ( i ) ; if ( ( symbol . equals ( RelevanceQuery . KW_INNER_SCORE ) ) || ( symbol . equals ( RelevanceQuery . KW_NOW ) ) ) throw new JSONException ( "variable<seq2seq4repair_space>name<seq2seq4repair_space>can<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>reserved<seq2seq4repair_space>keyword." ) ; if ( hm_var . containsKey ( symbol ) ) throw new JSONException ( ( ( "Symbol<seq2seq4repair_space>" + symbol ) + "<seq2seq4repair_space>already<seq2seq4repair_space>defined." ) ) ; if ( ! ( jsonValues . has ( symbol ) ) ) throw new JSONException ( ( ( "Symbol<seq2seq4repair_space>" + symbol ) + "<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>assigned<seq2seq4repair_space>with<seq2seq4repair_space>a<seq2seq4repair_space>value." ) ) ; if ( RelevanceQuery . KW_TYPE_INT . equals ( type ) ) { hm_var . put ( symbol , jsonValues . getInt ( symbol ) ) ; hm_type . put ( symbol , TYPE_INT ) ; } else if ( RelevanceQuery . KW_TYPE_DOUBLE . equals ( type ) ) { hm_var . put ( symbol , jsonValues . getDouble ( symbol ) ) ; hm_type . put ( symbol , TYPE_DOUBLE ) ; } else if ( RelevanceQuery . KW_TYPE_FLOAT . equals ( type ) ) { hm_var . put ( symbol , ( ( float ) ( jsonValues . getDouble ( symbol ) ) ) ) ; hm_type . put ( symbol , TYPE_FLOAT ) ; } else if ( RelevanceQuery . KW_TYPE_LONG . equals ( type ) ) { hm_var . put ( symbol , jsonValues . getLong ( symbol ) ) ; hm_type . put ( symbol , TYPE_LONG ) ; } else if ( RelevanceQuery . KW_TYPE_STRING . equals ( type ) ) { hm_var . put ( symbol , jsonValues . getString ( symbol ) ) ; hm_type . put ( symbol , TYPE_STRING ) ; } else if ( RelevanceQuery . KW_TYPE_BOOL . equals ( type ) ) { hm_var . put ( symbol , jsonValues . getBoolean ( symbol ) ) ; hm_type . put ( symbol , TYPE_STRING ) ; } } } } String symbolNow = RelevanceQuery . KW_NOW ; long now = System . currentTimeMillis ( ) ; hm_var . put ( symbolNow , now ) ; hm_type . put ( symbolNow , TYPE_LONG ) ; String symbolInnerScore = RelevanceQuery . KW_INNER_SCORE ; hm_var . put ( symbolInnerScore , symbolInnerScore ) ; hm_type . put ( symbolInnerScore , TYPE_INNER_SCORE ) ; if ( ( ( funcBody ) == null ) || ( ( funcBody . length ( ) ) == 0 ) ) throw new JSONException ( "No<seq2seq4repair_space>function<seq2seq4repair_space>body<seq2seq4repair_space>found." ) ; if ( ( funcBody . indexOf ( "return<seq2seq4repair_space>" ) ) == ( - 1 ) ) throw new JSONException ( "No<seq2seq4repair_space>return<seq2seq4repair_space>statement<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>function<seq2seq4repair_space>body." ) ; for ( int i = 0 ; i < ( lls_params . size ( ) ) ; i ++ ) { String symbol = lls_params . get ( i ) ; if ( ! ( hm_type . containsKey ( symbol ) ) ) throw new JSONException ( ( ( "function<seq2seq4repair_space>parameter:<seq2seq4repair_space>" + symbol ) + "<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>defined." ) ) ; String type = hm_type . get ( symbol ) ; if ( type . startsWith ( TYPE_FACET_HEAD ) ) { if ( ( ! ( hm_symbol_facet . containsKey ( symbol ) ) ) && ( ! ( hm_symbol_mfacet . containsKey ( symbol ) ) ) ) throw new JSONException ( ( ( "function<seq2seq4repair_space>parameter:<seq2seq4repair_space>" + symbol ) + "<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>defined." ) ) ; } else { if ( ! ( hm_var . containsKey ( symbol ) ) ) throw new JSONException ( ( ( "function<seq2seq4repair_space>parameter:<seq2seq4repair_space>" + symbol ) + "<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>defined." ) ) ; } } lls_params = filterParameters ( lls_params , funcBody ) ; String paramString = getParamString ( lls_params , hm_type ) ; classIDString = ( funcBody ) + paramString ; String className = "CRel" + ( classIDString . hashCode ( ) ) ; RelevanceQuery . logger . info ( ( "Custom<seq2seq4repair_space>relevance<seq2seq4repair_space>class<seq2seq4repair_space>name<seq2seq4repair_space>is:" + className ) ) ; if ( RelevanceQuery . hmModels . containsKey ( className ) ) cscorer = RelevanceQuery . hmModels . get ( className ) ; else { <START_BUG> synchronized ( this ) { <END_BUG> if ( RelevanceQuery . hmModels . containsKey ( className ) ) { cscorer = RelevanceQuery . hmModels . get ( className ) ; return ; } CtClass ch = RelevanceQuery . pool . makeClass ( className ) ; CtClass ci ; try { ci = RelevanceQuery . pool . get ( "com.senseidb.search.relevance.CustomScorer" ) ; } catch ( NotFoundException e ) { RelevanceQuery . logger . info ( e . getMessage ( ) ) ; throw new JSONException ( e ) ; } ch . addInterface ( ci ) ; String functionString = makeFuncString ( funcBody , hm_type , lls_params ) ; addFacilityMethods ( ch ) ; CtMethod m ; try { m = CtNewMethod . make ( functionString , ch ) ; } catch ( CannotCompileException e ) { RelevanceQuery . logger . info ( e . getMessage ( ) ) ; throw new JSONException ( e ) ; } try { ch . addMethod ( m ) ; } catch ( CannotCompileException e ) { RelevanceQuery . logger . info ( e . getMessage ( ) ) ; throw new JSONException ( e ) ; } Class h ; try { h = RelevanceQuery . pool . toClass ( ch , new RelevanceQuery . CustomLoader ( RelevanceQuery . class . getClassLoader ( ) , className ) ) ; }

Fix:
synchronized ( RelevanceQuery . class ) {