class PackageNameMatcher {

    public static PackageNameMatcher compile(final List<String> specs) {
        if (specs == null) {
            throw new IllegalArgumentException("null package name specifications");
        }

        final List<Pattern> list = new ArrayList<>();

        for (String part : specs) {
            list.add(buildPattern(part));
        }

        return new PackageNameMatcher(list);
    }

}

class PackageNameMatcherTest {

    @Test(expected = IllegalArgumentException.class)
    public void testPattern07() {

        final List<String> specs = new ArrayList<>();
        specs.add("com.example.*");
        specs.add("org.example.!");
        PackageNameMatcher.compile(specs);
    }

}