2022-03-07 09:34:54 +00:00
|
|
|
package lombok.core.debug;
|
|
|
|
|
|
|
|
import java.lang.ref.WeakReference;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
|
2022-03-28 08:10:50 +00:00
|
|
|
/* loaded from: com.discord-121108.apk:lombok/core/debug/DebugSnapshot.SCL.lombok */
|
2022-03-07 09:34:54 +00:00
|
|
|
public class DebugSnapshot implements Comparable<DebugSnapshot> {
|
|
|
|
private static AtomicLong counter = new AtomicLong();
|
|
|
|
private final long bits;
|
|
|
|
private final List<StackTraceElement> trace;
|
|
|
|
private final String threadName;
|
|
|
|
private final String message;
|
|
|
|
private final Object[] params;
|
|
|
|
private final WeakReference<CompilationUnitDeclaration> owner;
|
|
|
|
|
|
|
|
/* renamed from: id reason: collision with root package name */
|
2022-03-28 08:10:50 +00:00
|
|
|
private final long f3800id = counter.getAndIncrement();
|
2022-03-07 09:34:54 +00:00
|
|
|
private final long when = System.currentTimeMillis();
|
|
|
|
|
|
|
|
public DebugSnapshot(CompilationUnitDeclaration compilationUnitDeclaration, int i, String str, Object... objArr) {
|
|
|
|
this.bits = compilationUnitDeclaration.bits;
|
|
|
|
if (i < 0) {
|
|
|
|
this.trace = null;
|
|
|
|
} else {
|
|
|
|
StackTraceElement[] stackTrace = new Throwable().getStackTrace();
|
|
|
|
this.trace = new ArrayList(Math.max(0, (stackTrace.length - i) - 1));
|
|
|
|
for (int i2 = 1 + i; i2 < stackTrace.length; i2++) {
|
|
|
|
this.trace.add(stackTrace[i2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.threadName = Thread.currentThread().getName();
|
|
|
|
this.message = str;
|
|
|
|
this.params = objArr == null ? new Object[0] : objArr;
|
|
|
|
this.owner = new WeakReference<>(compilationUnitDeclaration);
|
|
|
|
}
|
|
|
|
|
|
|
|
private String ownerName() {
|
|
|
|
CompilationUnitDeclaration compilationUnitDeclaration = this.owner.get();
|
|
|
|
if (compilationUnitDeclaration == null) {
|
|
|
|
return "--GCed--";
|
|
|
|
}
|
|
|
|
char[] mainTypeName = compilationUnitDeclaration.getMainTypeName();
|
|
|
|
char[] fileName = compilationUnitDeclaration.getFileName();
|
|
|
|
return (mainTypeName == null || mainTypeName.length == 0) ? (fileName == null || fileName.length == 0) ? "--UNKNOWN--" : new String(fileName) : new String(mainTypeName);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String shortToString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
Object[] objArr = new Object[4];
|
|
|
|
objArr[0] = Long.valueOf(this.when);
|
|
|
|
objArr[1] = this.threadName;
|
|
|
|
objArr[2] = ownerName();
|
|
|
|
objArr[3] = Boolean.valueOf(0 != (this.bits & 16));
|
|
|
|
sb.append(String.format("WHEN: %14d THREAD: %s AST: %s HAMB: %b -- ", objArr));
|
|
|
|
if (this.message != null) {
|
|
|
|
sb.append(" ").append(String.format(this.message, this.params));
|
|
|
|
}
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.append(shortToString()).append("\n");
|
|
|
|
if (this.trace == null) {
|
|
|
|
sb.append(" Stack Omitted");
|
|
|
|
} else {
|
|
|
|
Iterator<StackTraceElement> it = this.trace.iterator();
|
|
|
|
while (it.hasNext()) {
|
|
|
|
sb.append(" ").append(it.next().toString()).append("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sb.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
public int compareTo(DebugSnapshot debugSnapshot) {
|
2022-03-28 08:10:50 +00:00
|
|
|
return Long.valueOf(this.f3800id).compareTo(Long.valueOf(debugSnapshot.f3800id));
|
2022-03-07 09:34:54 +00:00
|
|
|
}
|
|
|
|
}
|