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

java.lang.NoSuchMethodError: java.lang.Math.multiplyExact(JI)J

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      ```
            long millis = Math.multiplyExact(seconds + 1, 1000);
      ```
      compiled by Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode), run in docker using OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode), getting
       java.lang.NoSuchMethodError: java.lang.Math.multiplyExact(JI)J

      REGRESSION : Last worked in version 8

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      should work calling java.lang.NoSuchMethodError: java.lang.Math.multiplyExact(JJ)J
      ACTUAL -
       java.lang.NoSuchMethodError: java.lang.Math.multiplyExact(JI)J

      ---------- BEGIN SOURCE ----------
      There is no test case, here is code snippet
      final long seconds = avro.getSec();
      long millis = Math.multiplyExact(seconds + 1, 1000);
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Qualifying literal as long helps:

      long millis = Math.multiplyExact(seconds + 1, 1000L);

      FREQUENCY : often


        Attachments

          Activity

            People

            Assignee:
            adev ANUPAM DEV
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: