[ 
https://issues.apache.org/jira/browse/OPENNLP-1932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18119051#comment-18119051
 ] 

ASF GitHub Bot commented on OPENNLP-1932:
-----------------------------------------

krickert commented on PR #1278:
URL: https://github.com/apache/opennlp/pull/1278#issuecomment-5827823341

   Thanks for the review. I pushed changes for all of it.  AI provided a better 
summary than myself:
   
   > - Removed `asRegex` and `matchesPattern` outright, along with their tests. 
`model-loading.xml` now says they are gone in 3.0 and that subclasses should 
call `matchesWildcard(url, "*.bin")`.
   > - A null `jarModelPrefix` now throws `IllegalArgumentException`, the same 
as `matchesWildcard`.
   > - The matcher walks both strings by code point in place, so it no longer 
allocates two `int[]` per call. The Javadoc now says "code point" throughout.
   > - Renamed `GlobMatcher` to `WildcardMatcher`.
   > - `splitClassPath` now delegates to a new 
`StringUtil.splitNonEmpty(CharSequence, char...)`. #1320 and #1321 can use the 
same helper instead of their own loops.
   > - Moved the `matchesWildcard` tests into a new 
`AbstractClassPathModelFinderTest`. `WildcardMatcherTest` now covers only the 
matcher.
   > - Added `testPathologicalWildcardRejectsQuickly`, which runs `*a*a*a*b` 
against 100k `a`s.
   > - `DirectoryModelFinderTest` now counts the jars it copies instead of 
assuming 4.
   > - A class loader URL that is not a valid URI, for example one with an 
unescaped space, is matched on its file part as is instead of failing the scan.
   > - Shortened the model loading chapter paragraph, and put the removal note 
in its own paragraph.
   > - Updated the title.




> RegEx removal part 4: wildcard matching in the model resolver
> -------------------------------------------------------------
>
>                 Key: OPENNLP-1932
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1932
>             Project: OpenNLP
>          Issue Type: Improvement
>            Reporter: Kristian Rickert
>            Assignee: Kristian Rickert
>            Priority: Major
>             Fix For: 3.0.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> {{AbstractClassPathModelFinder}}, {{DirectoryModelFinder}}, and 
> {{SimpleClassPathModelFinder}} converted wildcard strings to regular 
> expressions and split the class path with compiled patterns. A 
> package-private {{GlobMatcher}} now matches {{*}} (any run) and {{?}} (one 
> code point) directly, anchored on the whole name and, as before, not crossing 
> line terminators; the class path split is a character scan with 
> {{String.split}} semantics.
> One behavior change, intended: characters the old conversion never quoted 
> ({{( ) [ ] { } + | ^ $ \}}) had regex meaning or threw 
> {{PatternSyntaxException}}; they are literal now.
> API: the protected {{asRegex}} and {{matchesPattern(URL, Pattern)}} on the 
> public abstract {{AbstractClassPathModelFinder}} are replaced by protected 
> {{matchesWildcard(URL, String)}}. No code in the repository used them; this 
> is a 3.0 change.
> Verification: 39 globs by 46 inputs plus a 300,000-pair fuzz compared with 
> the old regex path; all differences come from the unquoted characters above. 
> {{GlobMatcherTest}} adds 64 cases and the module gains its first 
> {{DirectoryModelFinderTest}}. The module pom adds the managed 
> {{junit-jupiter-params}} dependency.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to