Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8239520

ValueRange.of(long, long, long) does not throw IAE on invalid inputs

XMLWordPrintable

    • b12
    • Not verified

      A DESCRIPTION OF THE PROBLEM :
      The javadoc for ValueRange.of(long min, long maxSmallest, long maxLargest) states that an exception will be thrown if the minimum is greater than the smallest maximum. However, an exception only occurs if the minimum is greater than the largest maximum.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a ValueRange with the following parameters:
      ValueRange vr = ValueRange.of(5, 2, 10);



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      An IllegalArgumentException should be thrown
      ACTUAL -
      A ValueRange is returned, with a range of 5 - 2/10

      ---------- BEGIN SOURCE ----------
      import java.time.temporal.ValueRange;
      public class TestValueRange {
        public static void main(String[] args) {
          ValueRange vr = ValueRange.of(5, 2, 10);
          System.out.println(vr.toString());
        }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            naoto Naoto Sato
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: