Jtest logo




Contents  Previous  Next  Index

DBC.PKGMPRE


All package-private methods should have the '@pre' contract

Description

This rule flags any package-private method that does not have an `@pre' contract in its Javadoc.

Example

 package DBC;
 
 /** @invariant toString ().equals ("Strategy") */
 class PKGMPRE {
    /**
      * @post ($return != null && $pre (size + 1) == size + 1)
      * @exception NegativeArraySizeException size < 0
      */
     int[] allocate (int size) {
         return new int [size];
     }
 }

Repair

Provide the `@pre' condition.

    /**
      * @pre size >= 0
      * @post ($return != null && $pre (size + 1) == size + 1)
      * @exception NegativeArraySizeException size < 0
      */

Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft