JDK-8282573 : ByteBufferTest.java: replace endless recursion with RuntimeException in void ck(double x, double y)
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2022-03-02
  • Updated: 2022-03-07
  • Resolved: 2022-03-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 19
19 masterFixed
Related Reports
Cloners :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8282661 :  
Description
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.
Comments
Changeset: a584c904 Author: Emanuel Peter <emanuel.peter@oracle.com> Committer: Tobias Hartmann <thartmann@openjdk.org> Date: 2022-03-04 12:55:57 +0000 URL: https://git.openjdk.java.net/jdk/commit/a584c904a9e386d7ce80fb9cc6d49fece065d3da
04-03-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7674 Date: 2022-03-03 11:24:04 +0000
03-03-2022