调整代码。

dev
ZhouXY108 2024-04-16 21:05:07 +08:00
parent b9d4901b67
commit 22687605b2
1 changed files with 3 additions and 9 deletions

View File

@ -291,7 +291,6 @@ public final class RegexTools {
* @param cachePattern {@link Pattern}
* @return {@link Pattern}
*/
@SuppressWarnings("null")
@Nonnull
private static Pattern getAndCachePatternInternal(@Nonnull final String pattern) {
if (PATTERN_CACHE.size() < MAX_CACHE_SIZE) {
@ -310,7 +309,6 @@ public final class RegexTools {
* @param pattern
* @return {@link Pattern}
*/
@SuppressWarnings("null")
@Nonnull
private static Pattern getPatternInternal(@Nonnull final String pattern) {
Pattern result = PATTERN_CACHE.get(pattern);
@ -326,7 +324,6 @@ public final class RegexTools {
* @param patterns
* @return {@link Pattern}
*/
@SuppressWarnings("null")
@Nonnull
private static Pattern[] getAndCachePatternsInternal(@Nonnull final String[] patterns) {
return Arrays.stream(patterns)
@ -340,7 +337,6 @@ public final class RegexTools {
* @param patterns
* @return {@link Pattern}
*/
@SuppressWarnings("null")
@Nonnull
private static Pattern[] getPatternsInternal(@Nonnull final String[] patterns) {
return Arrays.stream(patterns)
@ -359,26 +355,24 @@ public final class RegexTools {
return input != null && pattern.matcher(input).matches();
}
@SuppressWarnings("null")
private static boolean matchesOneInternal(@Nullable final CharSequence input, @Nonnull final Pattern[] patterns) {
if (input == null) {
return false;
}
for (Pattern pattern : patterns) {
if (matchesInternal(input, pattern)) {
if (matchesInternal(input, Objects.requireNonNull(pattern))) {
return true;
}
}
return false;
}
@SuppressWarnings("null")
private static boolean matchesAllInternal(final CharSequence input, final Pattern[] patterns) {
private static boolean matchesAllInternal(@Nullable final CharSequence input, @Nonnull final Pattern[] patterns) {
if (input == null) {
return false;
}
for (Pattern pattern : patterns) {
if (!matchesInternal(input, pattern)) {
if (!matchesInternal(input, Objects.requireNonNull(pattern))) {
return false;
}
}