RFR: 8184692: add Pattern.asMatchPredicate
Paul Sandoz
paul.sandoz at oracle.com
Mon Apr 9 17:43:28 UTC 2018
> On Apr 9, 2018, at 9:17 AM, Xueming Shen <xueming.shen at oracle.com> wrote:
>
>
> Paul,
>
> I don't recall any particular reason why we did Predicate<String> asPredicate() instead
> of Predicate<CharSequence> asPredicate() back 1.8? mutability?
>
Hmm… me neither i would like to think it was not an oversight :-)
Mutability should not be an issue *locally* for the predicate implementation since it captures no mutable state. I suspect we erred on the side of immutability in general, so the predicate would be safe to use if there were any concurrent operation going on.
I believe we could revisit this decision (as a separate issue) and a change to Predicate<CharSequence> would be both source and binary compatible. However, i would be inclined to leave things as they are and stick to the overall immutability story.
Paul.
More information about the core-libs-dev
mailing list