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

Declare private constructors for FFM internal Architecture implementations

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • None
    • None
    • core-libs
    • None

      Both the implementations of [jdk.internal.foreign.abi.Architecture] are singletons but do not have a privat constructor and is not final. This means a default constructor is generated:

        public jdk.internal.foreign.abi.x64.X86_64Architecture();
          Code:
             0: aload_0
             1: invokespecial #1 // Method java/lang/Object."<init>":()V
             4: return

      Declaring the class final and introduce a private constructor would save 5 byte byte code and might potentially unlock other optimisations.

            pminborg Per-Ake Minborg
            pminborg Per-Ake Minborg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: