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; /* loaded from: com.discord-118108.apk:lombok/core/debug/DebugSnapshot.SCL.lombok */ public class DebugSnapshot implements Comparable { private static AtomicLong counter = new AtomicLong(); private final long bits; private final List trace; private final String threadName; private final String message; private final Object[] params; private final WeakReference owner; /* renamed from: id reason: collision with root package name */ private final long f3779id = counter.getAndIncrement(); 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 it = this.trace.iterator(); while (it.hasNext()) { sb.append(" ").append(it.next().toString()).append("\n"); } } return sb.toString(); } public int compareTo(DebugSnapshot debugSnapshot) { return Long.valueOf(this.f3779id).compareTo(Long.valueOf(debugSnapshot.f3779id)); } }