Package cs1302.tracer.trace
Record Class ExecutionSnapshot.StackSnapshot
java.lang.Object
java.lang.Record
cs1302.tracer.trace.ExecutionSnapshot.StackSnapshot
- Record Components:
methodName- The name of the method this frame is associated with.methodLine- The line number this snapshot was taken at.visibleVariables- The stack variables that are accessible in this method at line methodLine.thisObject- A reference to the value ofthisfor the frame, or empty if the method is native or static.sourcePath- Optional relative source file path for this stack frame.
- Enclosing class:
ExecutionSnapshot
public static record ExecutionSnapshot.StackSnapshot(String methodName, long methodLine, List<ExecutionSnapshot.Field> visibleVariables, Optional<ExecutionSnapshot.StackSnapshot.ThisObject> thisObject, Optional<String> sourcePath)
extends Record
A snapshot of the state of a method's stack.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA pair that includes the type name of and a reference to the value ofthis. -
Constructor Summary
ConstructorsConstructorDescriptionStackSnapshot(String methodName, long methodLine, List<ExecutionSnapshot.Field> visibleVariables, Optional<ExecutionSnapshot.StackSnapshot.ThisObject> thisObject) Constructs a stack frame snapshot without an explicit source file path.StackSnapshot(String methodName, long methodLine, List<ExecutionSnapshot.Field> visibleVariables, Optional<ExecutionSnapshot.StackSnapshot.ThisObject> thisObject, Optional<String> sourcePath) Creates an instance of aStackSnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of themethodLinerecord component.Returns the value of themethodNamerecord component.Returns the value of thesourcePathrecord component.Returns the value of thethisObjectrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thevisibleVariablesrecord component.
-
Constructor Details
-
StackSnapshot
public StackSnapshot(String methodName, long methodLine, List<ExecutionSnapshot.Field> visibleVariables, Optional<ExecutionSnapshot.StackSnapshot.ThisObject> thisObject) Constructs a stack frame snapshot without an explicit source file path.- Parameters:
methodName- The method name.methodLine- The line number.visibleVariables- Accessible stack variables.thisObject- Optional reference tothis.
-
StackSnapshot
public StackSnapshot(String methodName, long methodLine, List<ExecutionSnapshot.Field> visibleVariables, Optional<ExecutionSnapshot.StackSnapshot.ThisObject> thisObject, Optional<String> sourcePath) Creates an instance of aStackSnapshotrecord class.- Parameters:
methodName- the value for themethodNamerecord componentmethodLine- the value for themethodLinerecord componentvisibleVariables- the value for thevisibleVariablesrecord componentthisObject- the value for thethisObjectrecord componentsourcePath- the value for thesourcePathrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
methodName
Returns the value of themethodNamerecord component.- Returns:
- the value of the
methodNamerecord component
-
methodLine
public long methodLine()Returns the value of themethodLinerecord component.- Returns:
- the value of the
methodLinerecord component
-
visibleVariables
Returns the value of thevisibleVariablesrecord component.- Returns:
- the value of the
visibleVariablesrecord component
-
thisObject
Returns the value of thethisObjectrecord component.- Returns:
- the value of the
thisObjectrecord component
-
sourcePath
Returns the value of thesourcePathrecord component.- Returns:
- the value of the
sourcePathrecord component
-