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

non-static <clinit> method with no args is called during the class initialization process

    Details

    • Subcomponent:
    • Resolved In Build:
      b05
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        JVMS 2ed states the following regarding <clinit> methods:
          --- Excerpt-from-spec ---
          3.9 Specially Named Initialization Methods
          
          A class or interface has at most one class or interface initialization
          method and is initialized (2.17.4) by invoking that method. The
          initialization method of a class or interface is static and takes no
          arguments. It has the special name <clinit>. This name is supplied by
          a compiler. Because the name <clinit> is not a valid identifier, it
          cannot be used directly in a program written in the Java programming
          language. Class and interface initialization methods are invoked
          implicitly by the Java virtual machine; they are never invoked
          directly from any Java virtual machine instruction, but are invoked
          only indirectly as part of the class initialization process.
          --- End-Of-Excerpt ---

        However, if a class contains non-static <clinit>()V method then the method
        is still called by JVM as in case of "right" static <clinit>()V method.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  kamg Keith Mcguigan
                  Reporter:
                  ygaevsky Yuri Gaevsky
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: