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

Clean up java.util.regex.CharPredicates after JDK-8160302

    Details

    • Type: Enhancement
    • Status: New
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9, 10
    • Fix Version/s: tbd_minor
    • Component/s: core-libs
    • Labels:

      Description

      JDK-8160302 addressed a startup regression in java.util.regex.Pattern/CharPredicates by moving eagerly created lambda predicates into methods and switches to only create the lambda expression lazily when used, but the mechanical transformation applied to turn constants into methods/switches is a bit of an eye-sore.

      Evaluate cleaner/nicer ways of writing this code in a way that doesn't re-introduce eagerness during startup - or re-evaluate the
      change when/if lambda initialization can improve to the point where the eagerness in this case would have negligible startup effect.

      [~mcimadamore] suggested: "I believe an enum could do quite well in this particular situation - when we revisit the code in 10, and lead to a more 'declarative' version of the same code. For example, each enum constant could have strings for storing posix/unix predicates, and a method that returns your lazy method reference. That should clean up the code quite a bit."

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            sherman Xueming Shen
            Reporter:
            redestad Claes Redestad
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: