< prev index next >

src/java.base/share/classes/java/lang/Package.java

Print this page
rev 56290 : 8230648: Replace @exception tag with @throws in java.base
Summary: Minor coding style update of javadoc tag in any file in java.base
Reviewed-by: prappo, lancea


 254 
 255     /**
 256      * Compare this package's specification version with a
 257      * desired version. It returns true if
 258      * this packages specification version number is greater than or equal
 259      * to the desired version number. <p>
 260      *
 261      * Version numbers are compared by sequentially comparing corresponding
 262      * components of the desired and specification strings.
 263      * Each component is converted as a decimal integer and the values
 264      * compared.
 265      * If the specification value is greater than the desired
 266      * value true is returned. If the value is less false is returned.
 267      * If the values are equal the period is skipped and the next pair of
 268      * components is compared.
 269      *
 270      * @param desired the version string of the desired version.
 271      * @return true if this package's version number is greater
 272      *          than or equal to the desired version number
 273      *
 274      * @exception NumberFormatException if the current version is not known or
 275      *          the desired or current version is not of the correct dotted form.
 276      */
 277     public boolean isCompatibleWith(String desired)
 278         throws NumberFormatException
 279     {
 280         if (versionInfo.specVersion == null || versionInfo.specVersion.length() < 1) {
 281             throw new NumberFormatException("Empty version string");
 282         }
 283 
 284         String [] sa = versionInfo.specVersion.split("\\.", -1);
 285         int [] si = new int[sa.length];
 286         for (int i = 0; i < sa.length; i++) {
 287             si[i] = Integer.parseInt(sa[i]);
 288             if (si[i] < 0)
 289                 throw NumberFormatException.forInputString("" + si[i], 10);
 290         }
 291 
 292         String [] da = desired.split("\\.", -1);
 293         int [] di = new int[da.length];
 294         for (int i = 0; i < da.length; i++) {




 254 
 255     /**
 256      * Compare this package's specification version with a
 257      * desired version. It returns true if
 258      * this packages specification version number is greater than or equal
 259      * to the desired version number. <p>
 260      *
 261      * Version numbers are compared by sequentially comparing corresponding
 262      * components of the desired and specification strings.
 263      * Each component is converted as a decimal integer and the values
 264      * compared.
 265      * If the specification value is greater than the desired
 266      * value true is returned. If the value is less false is returned.
 267      * If the values are equal the period is skipped and the next pair of
 268      * components is compared.
 269      *
 270      * @param  desired the version string of the desired version.
 271      * @return true if this package's version number is greater
 272      *         than or equal to the desired version number
 273      *
 274      * @throws NumberFormatException if the current version is not known or
 275      *         the desired or current version is not of the correct dotted form.
 276      */
 277     public boolean isCompatibleWith(String desired)
 278         throws NumberFormatException
 279     {
 280         if (versionInfo.specVersion == null || versionInfo.specVersion.length() < 1) {
 281             throw new NumberFormatException("Empty version string");
 282         }
 283 
 284         String [] sa = versionInfo.specVersion.split("\\.", -1);
 285         int [] si = new int[sa.length];
 286         for (int i = 0; i < sa.length; i++) {
 287             si[i] = Integer.parseInt(sa[i]);
 288             if (si[i] < 0)
 289                 throw NumberFormatException.forInputString("" + si[i], 10);
 290         }
 291 
 292         String [] da = desired.split("\\.", -1);
 293         int [] di = new int[da.length];
 294         for (int i = 0; i < da.length; i++) {


< prev index next >