- A Concurrent Affair - https://www.concurrentaffair.org -

Perforce-Inspired Patterns

Last night I started writing a class name matcher that uses Perforce-inspired patterns. Internally, those are converted to Java regexes. Using this matcher, it is a lot easier now to specify which classes in what packages should be excluded.

By now, I’ve found out that not the entire sun.* package has to be excluded, but actually just sun.reflect.* . I’m still working on java.* . Right now it seems like sun.util.* and sun.lang.* have to be excluded. I haven’t exactly considered the ramifications of that yet.

But more about those patterns. First of all, the entire string has to match, so ^ and $ for beginning and end are always implied. A ? matches a single character, a * matches zero or more characters but not a period (.), and \*\*\* truly matches zero or more characters. That way, * means just one package, \*\*\* means any number of packages. If a pattern is prefixed with !, then that match is negated. The matcher will indicate a match if there was at least one positive pattern that matched and no pattern that matched negatively.

[1] [2]Share [3]