Add overloads to MethodTypeDesc::of

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 21
    • Affects Version/s: None
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: