Buggy code:
public class RuleSet < E > implements IRuleSet < E > { private final List < IRule < E , E > > rules = new ArrayList < IRule < E , E > > ( ) ; private final List < E > universe ; private static final FFunctionOps fBuilder = new StandardFunctionOps ( ) ; private static final int varInferrenceIterations = 2 ; public RuleSet ( Collection < E > universe ) { } @ Override public void addRule ( FFuncAnt < E > antecedent , FFuncCons < E > consequent ) { } @ Override public float valueOf ( IProperty < E > searching , Object [ ] value ) { } @ Override public Object [ ] missing ( FFuncProp < E > func , Object ... parameters ) { if ( ( func . getProperty ( ) . arity ( ) ) != ( parameters . length ) ) { throw new InvalidNumberOfArgumentsException ( ) ; } final List < IRule < E , E > > rules = new ArrayList < > ( ) ; <START_BUG> for ( final IRule < E , E > rule : rules ) { <END_BUG> final FFuncProp < E > property = rule . getConsequent ( ) . getPropFunc ( ) ; if ( property . equals ( func ) ) { rules . add ( rule ) ; } } int missingParams = 0 ; final int [ ] indices = new int [ parameters . length ] ; for ( int i = 0 ; i < ( parameters . length ) ; i ++ ) { if ( ( parameters [ i ] ) == null ) { indices [ i ] = missingParams ; missingParams ++ ; } else { indices [ i ] = - 1 ; } } final Map < Object [ ] , Float > map = new HashMap < > ( this . universe . size ( ) ) ; final Set < Map . Entry < List < Object > , IProperty < E > > > inferred = new HashSet < > ( 0 ) ; for ( final IRule < E , E > rule : rules ) { final Map . Entry < Map < Variable , Object > , Set < Variable > > entry = this . getInterpretationAndMissingVariables ( rule , parameters , inferred ) ; final Map < Variable , Object > interpretation = entry . getKey ( ) ; final Set < Variable > missingVars = entry . getValue ( ) ; final FFuncAnt < E > antFunc = rule . getAntecedent ( ) ; final FFuncCons < E > consFunc = rule . getConsequent ( ) ; final Variable [ ] consVariables = consFunc . variables ( ) ; final Object [ ] missing = new Object [ missingParams ] ; int count = 0 ; for ( int i = 0 ; i < ( parameters . length ) ; i ++ ) { final Variable variable = consVariables [ i ] ; final Object param = parameters [ i ] ; if ( param == null ) { if ( interpretation . containsKey ( variable ) ) { missing [ count ] = interpretation . get ( variable ) ; } else { missing [ count ] = variable ; } count ++ ; } } final Set < Map . Entry < IProperty < E > , Parameter [ ] > > vars = antFunc . propertiesWithVars ( ) ; if ( ! ( missingVars . isEmpty ( ) ) ) { for ( final Map < Variable , ? > interpretationIt : this . variableIterator ( missingVars , interpretation ) ) { final float membership = this . getMembership ( antFunc , vars , interpretationIt , inferred ) ; final Object [ ] finalMissing = new Object [ missingParams ] ; for ( int i = 0 ; i < missingParams ; i ++ ) { final Object inMissing = missing [ i ] ; if ( inMissing instanceof Variable ) { finalMissing [ i ] = interpretationIt . get ( inMissing ) ; } else { finalMissing [ i ] = inMissing ; } } this . setInMap ( map , finalMissing , membership ) ; } } else { final float membership = this . getMembership ( antFunc , vars , interpretation , inferred ) ; this . setInMap ( map , missing , membership ) ; } } Object [ ] best = null ; float bestf = - 1.0F ; for ( final Map . Entry < Object [ ] , Float > entry : map . entrySet ( ) ) { final float v = entry . getValue ( ) ; if ( v > bestf ) { bestf = v ; best = entry . getKey ( ) ; } } return best ; } private void setInMap ( Map < Object [ ] , Float > queue , Object [ ] params , float membership ) { } private float inferProperty ( IProperty < E > searching , Object [ ] parameters , Set < Map . Entry < List < Object > , IProperty < E > > > inferred ) { } private FFunction < Float > evaluateRule ( IRule < E , E > rule , IProperty < E > searching , Object [ ] parameters , Set < Map . Entry < List < Object > , IProperty < E > > > inferred ) { } private Map . Entry < Map < Variable , Object > , Set < Variable > > getInterpretationAndMissingVariables ( IRule < E , E > rule , Object [ ] parameters , Set < Map . Entry < List < Object > , IProperty < E > > > inferred ) { }

Fix:
for ( final IRule < E , E > rule : this . rules ) {