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

Take better advantage of generic MethodType cache

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 19
    • None
    • core-libs
    • None

    Description

      j.l.invoke.MethodType has a pair of public convenience methods genericMethodType(int) and genericMethodType(int, boolean) that will return a possibly cached method type. These operations are generally much faster than the equivalent methodType(..) calls.

      Rather than painstakingly use genericMethodType(int, ..) everywhere it might matter, an alternative solution is to refactor methodType(..) to check if the parameters match the genericMethodType and then automatically call genericMethodType method. Since generic type signatures are common, this appears to be a net win on both startup and helps enable constant folding.

      Attachments

        Issue Links

          Activity

            People

              redestad Claes Redestad
              redestad Claes Redestad
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: