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

Tried to run main() declared in a record, which resulted in a crash

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Ubuntu 18.04.3 LTS, openjdk 14-internal 2020-03-17

      I compiled the amber repository with a debug level of slowdebug.

      A DESCRIPTION OF THE PROBLEM :
      I wrote a simple point class to test out records. I decided to add main() to the record in order to make experimentation easier. The code compiled, but resulted in a crash at runtime.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      # To suppress the following error report, specify this argument
      # after -XX: or in .hotspotrc: SuppressErrorAt=/classFileParser.cpp:3263
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/home/lbk/amber/src/hotspot/share/classfile/classFileParser.cpp:3263), pid=26001, tid=26002
      # assert(__null == _record_params) failed: invariant
      #
      # JRE version: OpenJDK Runtime Environment (14.0) (slowdebug build 14-internal+0-adhoc.lbk.amber)
      # Java VM: OpenJDK 64-Bit Server VM (slowdebug 14-internal+0-adhoc.lbk.amber, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x7addf0] ClassFileParser::parse_classfile_record_attribute(ClassFileStream const*, unsigned char const*, ConstantPool*, int*, Thread*)+0x50
      #
      # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/lbk/core.26001)
      #
      # An error report file with more information is saved as:
      # /home/lbk/hs_err_pid26001.log
      #
      # If you would like to submit a bug report, please visit:
      # http://bugreport.java.com/bugreport/crash.jsp
      #
      Current thread is 26002
      Dumping core ...
      Aborted (core dumped)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile the code using javac
      2. Run the generated class file using java

      ACTUAL -
      The VM appeared to crash, and displayed the given error.

      ---------- BEGIN SOURCE ----------
      public record PointXY(int x, int y) {
          public static void main(String[] args) {
      PointXY origin = new PointXY(0, 0);

      System.out.println(origin);
          } //main
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            fmatte Fairoz Matte
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: