Bind the Check record to the checker

After you add @Check, bind the data to the issue, using @Bind("NPE.RET"):

package junit.framework;


@Bind("NPE.RET")
class Assert { 
   public static void assertNotNull(@Check Object object);

}

Test the knowledge base

To test your knowledge base:

  1. Import the knowledge base into your project using kwcheck:
    kwcheck import check.jkb
    
  2. Run the analysis:
    kwcheck run
    

When the code is analyzed using this knowledge base, Klocwork now knows assertNotNull is the check; consequently, NPE.RET is not reported.

Related Topics Link IconSee also