void checkWithinBounds ( InferenceContext inferenceContext , Warner warn ) throws InferenceException { MultiUndetVarListener mlistener = new MultiUndetVarListener ( inferenceContext . undetvars ) ; List < Type > saved_undet = inferenceContext . save ( ) ; try { while ( true ) { mlistener . reset ( ) ; if ( ! allowGraphInference ) { //in legacy mode we lack of transitivity, so bound check //cannot be run in parallel with other incoprporation rounds for ( Type t : inferenceContext . undetvars ) { UndetVar uv = ( UndetVar ) t ; IncorporationStep . CHECK_BOUNDS . apply ( uv , inferenceContext , warn ) ; } } for ( Type t : inferenceContext . undetvars ) { UndetVar uv = ( UndetVar ) t ; //bound incorporation EnumSet < IncorporationStep > incorporationSteps = allowGraphInference ? incorporationStepsGraph : incorporationStepsLegacy ; for ( IncorporationStep is : incorporationSteps ) { if ( is . accepts ( uv , inferenceContext ) ) { is . apply ( uv , inferenceContext , warn ) ; } } } if ( ! mlistener . changed || ! allowGraphInference ) break ; } } finally { mlistener . detach ( ) ; if ( incorporationCache . size ( ) == MAX_INCORPORATION_STEPS ) { inferenceContext . rollback ( saved_undet ) ; } incorporationCache . clear ( ) ; } }
Check bounds and perform incorporation