This article describes the format and priority rules of class name patterns that are used in BugJail Agent and BugJail Server options.
Class name pattern formats
Literal class name
Class name in the format returned by Class.getName() method, i.e. inner classes are prefixed by '$' (dollar sign).
Example - Class name of a normal class and an inner class
Regular expression pattern
Regular expression specified using JDK6 format (https://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)
Example - a pattern that matches all classes whose top-level package name starts with "test", and later part of the package OR class name contains the string "generated".
Trailing wildcard pattern
Partial name of the package, starting from top-level but ending in '**' (two asterisks).
Trailing '.' (period) between the last package name and the asterisks is optional (e.g. foo** and foo.** are equal).
Example - Wildcard patterns (first two are equivalent)
Tip: while using a regular expression ending with .* would provide the same match, the trailing wildcard patterns are more performant, and are resolved from most specific (most package levels) to least specific, which makes them more suitable for most uses.
Class name pattern priority
- Literal class names
- Regular expressions, in the order they are specified
- Postfix wildcards, in order from most specific (most package levels) to least specific