mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Convert org.pkl.core.runtime POJOs to record classes (#807)
This commit is contained in:
@@ -131,15 +131,7 @@ public final class StackTraceRenderer {
|
||||
* former is public API and the latter isn't.
|
||||
*/
|
||||
// non-private for testing
|
||||
static class StackFrameLoop {
|
||||
final List<Object /*StackFrame|StackFrameLoop*/> frames;
|
||||
final int count;
|
||||
|
||||
StackFrameLoop(List<Object> frames, int count) {
|
||||
this.count = count;
|
||||
this.frames = frames;
|
||||
}
|
||||
}
|
||||
record StackFrameLoop(List<Object /*StackFrame|StackFrameLoop*/> frames, int count) {}
|
||||
|
||||
// non-private for testing
|
||||
static List<Object /*StackFrame|StackFrameLoop*/> compressFrames(List<StackFrame> frames) {
|
||||
|
||||
@@ -98,17 +98,9 @@ public abstract class VmException extends AbstractTruffleException {
|
||||
BUG
|
||||
}
|
||||
|
||||
public static final class ProgramValue {
|
||||
public record ProgramValue(String name, Object value) {
|
||||
private static final VmValueRenderer valueRenderer = VmValueRenderer.singleLine(80);
|
||||
|
||||
public final String name;
|
||||
public final Object value;
|
||||
|
||||
public ProgramValue(String name, Object value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@TruffleBoundary
|
||||
public String toString() {
|
||||
|
||||
@@ -112,11 +112,11 @@ public final class VmExceptionRenderer {
|
||||
}
|
||||
|
||||
var maxNameLength =
|
||||
exception.getProgramValues().stream().mapToInt(v -> v.name.length()).max().orElse(0);
|
||||
exception.getProgramValues().stream().mapToInt(v -> v.name().length()).max().orElse(0);
|
||||
|
||||
for (var value : exception.getProgramValues()) {
|
||||
out.append(value.name)
|
||||
.append(" ".repeat(Math.max(0, maxNameLength - value.name.length())))
|
||||
out.append(value.name())
|
||||
.append(" ".repeat(Math.max(0, maxNameLength - value.name().length())))
|
||||
.append(": ")
|
||||
.append(value)
|
||||
.append('\n');
|
||||
|
||||
Reference in New Issue
Block a user