Skip to content

Commit 2f5780b

Browse files
author
Nicolas Laurent
committed
clean comments
1 parent 3a2371d commit 2f5780b

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/main/java/org/truffleruby/language/backtrace/Backtrace.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,9 @@ public Backtrace(Node location, SourceSection sourceLocation, int omitted, Throw
9595
* Creates a backtrace for the given Truffle exception, setting the
9696
* {@link #getLocation() location} and {@link #getSourceLocation() source location} accordingly,
9797
* and computing the activations eagerly (since the exception itself is not retained).
98-
*
99-
* <p>This is not/should not be used for constructing the backtrace associated with Ruby
100-
* exceptions.
10198
*/
10299
public Backtrace(TruffleException exception) {
100+
assert !(exception instanceof RaiseException);
103101
this.location = exception.getLocation();
104102
this.sourceLocation = exception.getSourceLocation();
105103
this.omitted = 0;
@@ -148,8 +146,6 @@ public RaiseException getRaiseException() {
148146

149147
/**
150148
* Sets the wrapper for the Ruby exception associated with this backtrace.
151-
*
152-
* <p>Do not set the raise exception twice on the same backtrace!
153149
*/
154150
public void setRaiseException(RaiseException raiseException) {
155151
assert this.raiseException == null : "the RaiseException of a Backtrace must not be set again, otherwise the original backtrace is lost";
@@ -308,12 +304,10 @@ public DynamicObject getBacktraceLocations(int length, Node node) {
308304
: ArrayHelpers.createEmptyArray(context);
309305
}
310306

311-
// NOTE (norswap, 08 Jan 2020)
312-
// It used to be that TruffleException#getStackTraceElementLimit() wasn't respected
313-
// due to a mishandling of internal frames. That's why we used Math.min and not just
314-
// length. Leaving it in just in case.
315307
final int locationsLength = length < 0
316308
? activationsLength + 1 + length
309+
// We use Math.min because length > activationsLength is possible and
310+
// activationsLength > length is too whenever there is a #raiseException set.
317311
: Math.min(activationsLength, length);
318312

319313
final Object[] locations = new Object[locationsLength];

0 commit comments

Comments
 (0)