Fixed excessive warnings when switching themes

This commit is contained in:
dragonmacher 2024-02-27 17:41:14 -05:00
parent 23d471731e
commit 86d2bb4dff
5 changed files with 112 additions and 48 deletions

View file

@ -236,11 +236,9 @@ public class ReflectionUtilities {
StackTraceElement[] trace = t.getStackTrace();
int lastIgnoreIndex = -1;
for (int i = 0; i < trace.length; i++) {
StackTraceElement element = trace[i];
String className = element.getClassName();
int nameIndex = patterns.indexOf(className);
if (nameIndex != -1) {
String text = element.getClassName() + " " + element.getMethodName();
if (containsAny(text, patterns)) {
lastIgnoreIndex = i;
}
else {
@ -269,6 +267,15 @@ public class ReflectionUtilities {
return t;
}
private static boolean containsAny(String text, List<String> patterns) {
for (String pattern : patterns) {
if (text.contains(pattern)) {
return true;
}
}
return false;
}
/**
* Creates a throwable whose stack trace is based upon the current call stack, with any
* information coming before, and including, the given classes removed.