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

Empty method parameter type should generate ClassFormatError

    XMLWordPrintable

Details

    • b26
    • Verified

    Backports

      Description

        Below code snippet is expected to generate ClassFormatError on class loading. Instead we observe java.lang.NoClassDefFoundError.

        Parameter to method 'func' here is a reference to empty class name ie, "L;". As per JVMS: "4.2.1 Binary Class and Interface Names", individual identifiers of the binary class name should be minimum 1 unicode character. Hence a class loading error is more apt for this scenario.

        --------------------------------------------------
        super public class method_param
                version 56:0
        {


        public Method "<init>":"()V"
                stack 1 locals 1
        {
                        aload_0;
                        invokespecial Method java/lang/Object."<init>":"()V";
                        return;
        }

        public static Method main:"([Ljava/lang/String;)V"
                stack 2 locals 1
        {
                        getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
                        ldc String "Testing method param types";
                        invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
                        return;
        }

        public static Method func:"(L;)V"
                stack 0 locals 1
        {
                        return;
        }

        } // end Class method_param
        -----------------------------------------

        Attachments

          Issue Links

            Activity

              People

                hseigel Harold Seigel (Inactive)
                pgundarlahal Prashanthram Gundarlahally
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: