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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9, 10
    • core-libs

      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."

            rgiulietti Raffaello Giulietti
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: