public NullnessHint analyzeReturnType ( ) { if ( method . getReturnType ( ) . isPrimitiveType ( ) ) { LOG ( DEBUG , "DEBUG" , "Skipping method with primitive return type: " + method . getSignature ( ) ) ; return NullnessHint . UNKNOWN ; } LOG ( DEBUG , "DEBUG" , "@ Return type analysis for: " + method . getSignature ( ) ) ; // Get ExceptionPrunedCFG if ( prunedCFG == null ) { prunedCFG = ExceptionPrunedCFG . make ( cfg ) ; } // In case the only control flows are exceptional, simply return. if ( prunedCFG . getNumberOfNodes ( ) == 2 && prunedCFG . containsNode ( cfg . entry ( ) ) && prunedCFG . containsNode ( cfg . exit ( ) ) && GraphUtil . countEdges ( prunedCFG ) == 0 ) { return NullnessHint . UNKNOWN ; } for ( ISSABasicBlock bb : prunedCFG . getNormalPredecessors ( prunedCFG . exit ( ) ) ) { for ( int i = bb . getFirstInstructionIndex ( ) ; i <= bb . getLastInstructionIndex ( ) ; i ++ ) { SSAInstruction instr = ir . getInstructions ( ) [ i ] ; if ( instr instanceof SSAReturnInstruction ) { SSAReturnInstruction retInstr = ( SSAReturnInstruction ) instr ; if ( ir . getSymbolTable ( ) . isNullConstant ( retInstr . getResult ( ) ) ) { LOG ( DEBUG , "DEBUG" , "Nullable return in method: " + method . getSignature ( ) ) ; return NullnessHint . NULLABLE ; } } } } return NullnessHint . UNKNOWN ; }
This is the nullability analysis for the method return value .