Use switch expressions where appropriate

See gh-31527
This commit is contained in:
dreis2211
2022-06-24 15:55:11 +02:00
committed by Andy Wilkinson
parent 836b08f49d
commit 458f989cf3
19 changed files with 136 additions and 252 deletions

View File

@@ -85,13 +85,12 @@ public class FilterAnnotations implements Iterable<TypeFilter> {
}
private TypeFilter createTypeFilter(FilterType filterType, String pattern) {
switch (filterType) {
case ASPECTJ:
return new AspectJTypeFilter(pattern, this.classLoader);
case REGEX:
return new RegexPatternTypeFilter(Pattern.compile(pattern));
}
throw new IllegalArgumentException("Filter type not supported with String pattern: " + filterType);
return switch (filterType) {
case ASPECTJ -> new AspectJTypeFilter(pattern, this.classLoader);
case REGEX -> new RegexPatternTypeFilter(Pattern.compile(pattern));
default ->
throw new IllegalArgumentException("Filter type not supported with String pattern: " + filterType);
};
}
@Override