Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8251041 [lworld] Investigate interplay between Records and Inline types
  3. JDK-8271556

[lworld] java.lang.BootstrapMethodError in .equals() for primitive record

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      This may be related to the other subtask (regarding the parent class of a primitive object), but a simple test caused a java.lang.BootstrapMethodError on bootstrapping .equals():

      primitive record SimpleRecordPrimitive(int theInteger, String theString) { }

      public final class PrimitiveRecordEquals {

          public static void main(String[] args) {

              if (! new SimpleRecordPrimitive(42, "Fortytwo").equals(new SimpleRecordPrimitive(42, "Fortytwo"))) {
                  throw new AssertionError("Records should be equal");
              }
          }
      }

      -----------

      The exact error is java.lang.BootstrapMethodError: bootstrap method initialization exception
      at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:188)
      at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:315)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:281)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:271)
      at SimpleRecordPrimitive.equals(PrimitiveRecordEquals.java:32)
      at PrimitiveRecordEquals.main(PrimitiveRecordEquals.java:38)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:569)
      at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
      at java.base/java.lang.Thread.run(Thread.java:833)
      Caused by: java.lang.IllegalArgumentException: Bad method type: (SimpleRecordPrimitive,Object)boolean
      at java.base/java.lang.runtime.ObjectMethods.bootstrap(ObjectMethods.java:345)
      at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:168)
      ... 11 more

      I'll investigate and propose a fix.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mchung Mandy Chung
              Reporter:
              jespersm Jesper Møller
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: