private boolean compareCryptoListTypes()

in src/main/java/com/amazon/checkerframework/cryptopolicy/CryptoPolicyComplianceAnnotatedTypeFactory.java [77:90]


        private boolean compareCryptoListTypes(final AnnotationMirror subtype, final AnnotationMirror supertype) {
            List<String> subtypeRegexes =
                AnnotationUtils.getElementValueArray(subtype, "value", String.class, true);

            List<String> supertypeRegexes =
                AnnotationUtils.getElementValueArray(supertype, "value", String.class, true);

            // It is expensive to check whether two different regexes actually accept the same set of values
            // (or, as would be ideal here, whether one accepts a strict subset of the other): doing so requires
            // constructing DFAs, etc.; and, to make matters worse, Java regexes aren't regular in the technical
            // sense. So we avoid the problem entirely and just check if the subtype has only regexes that literally
            // appear in the supertype. This is a sound approximation of the actual check.
            return supertypeRegexes.containsAll(subtypeRegexes);
        }