Skip to content

Commit

Permalink
Factor out WholeProgramInferenceJavaParserStorage#isInvisible (typeto…
Browse files Browse the repository at this point in the history
  • Loading branch information
kelloggm authored and wmdietl committed Jul 13, 2022
1 parent 2521f34 commit 887189c
Showing 1 changed file with 13 additions and 4 deletions.
Expand Up @@ -36,6 +36,7 @@
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
Expand Down Expand Up @@ -123,14 +124,22 @@ public class WholeProgramInferenceJavaParserStorage
*/
public static Set<String> getInvisibleQualifierNames(AnnotatedTypeFactory atypeFactory) {
return atypeFactory.getSupportedTypeQualifiers().stream()
.filter(
qual ->
Arrays.stream(qual.getAnnotations())
.anyMatch(anno -> anno.annotationType() == InvisibleQualifier.class))
.filter(WholeProgramInferenceJavaParserStorage::isInvisible)
.map(Class::getCanonicalName)
.collect(Collectors.toSet());
}

/**
* Is the definition of the given annotation class annotated with {@link InvisibleQualifier}?
*
* @param qual an annotation class
* @return true iff {@code qual} is meta-annotated with {@link InvisibleQualifier}
*/
public static boolean isInvisible(Class<? extends Annotation> qual) {
return Arrays.stream(qual.getAnnotations())
.anyMatch(anno -> anno.annotationType() == InvisibleQualifier.class);
}

/**
* Constructs a new {@code WholeProgramInferenceJavaParser} that has not yet inferred any
* annotations.
Expand Down

0 comments on commit 887189c

Please sign in to comment.