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

[REDO] ByteBufferTest.java: replace endless recursion with RuntimeException in void ck(double x, double y)

XMLWordPrintable

    • b13

        We have two functions ck, that are supposed to compare the two inputs and make the test fail if they are not equal.

            void ck(long x, long y) {
                if (x != y) {
                    throw new RuntimeException(" x = " + Long.toHexString(x) + ", y = " + Long.toHexString(y));
                }
            }

            void ck(double x, double y) {
                if (x == x && y == y && x != y) {
                    ck(x, y);
                }
            }

        The long throws a RuntimeException.
        The one for double goes into an infinite recursion, and eventually throws a StackOverflowError. This does not make much sense.
        I spoke with the original author [~psandoz], he agrees to replace it with an analogue RuntimeException.

            void ck(double x, double y) {
                if (x == x && y == y && x != y) {
                    throw new RuntimeException(...);
                }
            }

        Code introduced in JDK-8151163.
        Bug in JDK-8282555 encountered both this endless recursion as the RuntimeException, of the respective ck functions.

              epeter Emanuel Peter
              epeter Emanuel Peter
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: