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

Add overloads to MethodTypeDesc::of

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • None
    • core-libs
    • None
    • b24

      Add MethodTypeDesc.of(ClassDesc) and MethodTypeDesc.of(ClassDesc, Collection<ClassDesc>) for convenience to users.

      MethodTypeDesc.of(ClassDesc) avoids extra array allocation at javac-generated call site. For instance, 18/40 MethodTypeDesc creations in JDK-8294972 are benefitted by this new overload.

      MethodTypeDesc.of(ClassDesc, Collection<ClassDesc>) allows users to pass in immutable lists and collections directly. In a future patch, if the passed parameter type collection is an immutable list, MethodTypeDesc.of(ClassDesc, Collection<ClassDesc>) can avoid copying the collection with List::copyOf(Collection), while using arrays always require defensive copying against malicious users.

            liach Chen Liang
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: