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

incorrect java.lang.VerifyError during initialize main class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P4
    • None
    • 18.0.2.1
    • tools
    • generic
    • generic

    Description

      A DESCRIPTION OF THE PROBLEM :
      the presence of a class with the name identical to that of the package causes an error in the verification of another class in the same package at the time of execution with java

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      compile test.java and WhyVerifyError.java in the test package and execute the WhyVerifyError.class

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      normal end of WhyVerifyError main method
      ACTUAL -
      [0.003s][info][arguments] VM Arguments:
      [0.003s][info][arguments] jvm_args: -Xlog:arguments -Dfile.encoding=Cp1252 --enable-preview -XX:+ShowCodeDetailsInExceptionMessages
      [0.003s][info][arguments] java_command: prova.WhyVerifyError
      [0.003s][info][arguments] java_class_path (initial): D:\Git\Wat\bin
      [0.003s][info][arguments] Launcher Type: SUN_STANDARD
      Error: Unable to initialize main class prova.WhyVerifyError
      Caused by: java.lang.VerifyError: Bad return type
      Exception Details:
        Location:
          prova/WhyVerifyError.m(Ljava/lang/Object;)Lprova/WhyVerifyError$B; @94: areturn
        Reason:
          Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'prova/WhyVerifyError$B' (from method signature)
        Current Frame:
          bci: @94
          flags: { }
          locals: { 'prova/WhyVerifyError', 'java/lang/Object' }
          stack: { 'java/lang/Object' }
        Bytecode:
          0000000: 2b59 b800 1057 4d03 3e2c 1dba 0016 0000
          0000010: aa00 0000 0000 0036 0000 0000 0000 0001
          0000020: 0000 0018 0000 0023 2cc0 001a 3a04 1904
          0000030: a700 2e2c c000 1c3a 05bb 001a 592a 1905
          0000040: b700 1ea7 001b bb00 2159 bb00 2359 1225
          0000050: b700 272b b600 2ab6 002e b700 32bf b0
        Stackmap Table:
          append_frame(@40,Object[#3],Integer)
          same_frame(@51)
          same_frame(@70)
          full_frame(@94,{Object[#1],Object[#3]},{Object[#3]})

      ---------- BEGIN SOURCE ----------
      -- test/test.java ----
      package test;
      public class test {
      }
      -- test/WhyVerifyError.java
      package test;
      public class WhyVerifyError/*?!*/ {
      class A {}
      class B { B(A a) {}}
      @SuppressWarnings("preview")
      B m(Object arg) {
      return switch (arg) {
      case B b-> b;
      case A a-> new B(a);
      default-> throw new RuntimeException("error: " + arg);
      };
      }
      public static void main(String[] args) {
      System.out.println("end");
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      give a different case name to the class test

      FREQUENCY : always


      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: