[icedtea-web] RFC: Clean up some code in ClasspathMatcher
Omair Majid
omajid at redhat.com
Wed Apr 2 17:04:11 UTC 2014
* Jiri Vanek <jvanek at redhat.com> [2014-04-02 12:53]:
> On 04/02/2014 06:17 PM, Omair Majid wrote:
> >* Jiri Vanek <jvanek at redhat.com> [2014-04-02 11:02]:
> >>On 04/02/2014 04:51 PM, Omair Majid wrote:
> >>>The attached patch renames a method in ClasspathMatcher to better
> >>>reflect what the method does.
> >>
> >>If you really insists - then converToRegEx would be even more
> >>suitable, or not? The method is not quoting or just chnaging
> >>wildcards * to .*, It is doing both :)
> >
> >How about convertWildcardPatternToRegEx? I want to make it clear that
> >if you pass a non-wildcard pattern to this function, you are on your
> >own.
>
> If there are no wildcards, thenit is quoted as follows.,
>
> return "^" + Pattern.quote(s) + "$";
>
> The result IS java regexWhat am I missing?
Oh you are not missing anything. But this function name trie to clarify
that if you pass in a wildcard character, it will be treated as a
wildcard and get turned into an equivalent regex.
Just like if you use 'abcd' as a regex, it will match 'abcd', but if you
use '$abc' as a regex, dont expect it to match '$abc'. A function doing
this matching will still call the input regex.
Can you think of an alternate name that conveys that intention? I am
happy to rename it to something that is even more meaningful.
Thanks,
Omair
--
PGP Key: 66484681 (http://pgp.mit.edu/)
Fingerprint = F072 555B 0A17 3957 4E95 0056 F286 F14F 6648 4681
More information about the distro-pkg-dev
mailing list