private void noteUnconditionallyDereferencedNullValue ( Location thisLocation , Map < ValueNumber , SortedSet < Location > > bugLocations , Map < ValueNumber , NullValueUnconditionalDeref > nullValueGuaranteedDerefMap , UnconditionalValueDerefSet derefSet , IsNullValue isNullValue , ValueNumber valueNumber ) { if ( DEBUG ) { System . out . println ( "%%% HIT for value number " + valueNumber + " @ " + thisLocation ) ; } Set < Location > unconditionalDerefLocationSet = derefSet . getUnconditionalDerefLocationSet ( valueNumber ) ; if ( unconditionalDerefLocationSet . isEmpty ( ) ) { AnalysisContext . logError ( "empty set of unconditionally dereferenced locations at " + thisLocation . getHandle ( ) . getPosition ( ) + " in " + classContext . getClassDescriptor ( ) + "." + method . getName ( ) + method . getSignature ( ) ) ; return ; } // OK, we have a null value that is unconditionally // derferenced. Make a note of the locations where it // will be dereferenced. NullValueUnconditionalDeref thisNullValueDeref = nullValueGuaranteedDerefMap . get ( valueNumber ) ; if ( thisNullValueDeref == null ) { thisNullValueDeref = new NullValueUnconditionalDeref ( ) ; nullValueGuaranteedDerefMap . put ( valueNumber , thisNullValueDeref ) ; } thisNullValueDeref . add ( isNullValue , unconditionalDerefLocationSet ) ; if ( thisLocation != null ) { SortedSet < Location > locationsForThisBug = bugLocations . get ( valueNumber ) ; if ( locationsForThisBug == null ) { locationsForThisBug = new TreeSet <> ( ) ; bugLocations . put ( valueNumber , locationsForThisBug ) ; } locationsForThisBug . add ( thisLocation ) ; } }
Note the locations where a known - null value is unconditionally dereferenced .