Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions core/src/main/java/org/jruby/RubyArrayNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,9 @@ public RubyArray concat(IRubyObject obj) {
/** inspect_ary
*
*/
protected IRubyObject inspectAry(ThreadContext context) {
protected IRubyObject inspectAry(ThreadContext context, boolean recur) {
if (recur) return newSharedString(context, RECURSIVE_ARRAY_BL);

RubyString str = RubyString.newStringLight(context.runtime, DEFAULT_INSPECT_STR_SIZE, USASCIIEncoding.INSTANCE);
str.cat((byte) '[');

Expand All @@ -1661,14 +1663,7 @@ protected IRubyObject inspectAry(ThreadContext context) {
public RubyString inspect(ThreadContext context) {
final Ruby runtime = context.runtime;
if (realLength == 0) return newSharedString(context, EMPTY_ARRAY_BL);
if (runtime.isInspecting(this)) return newSharedString(context, RECURSIVE_ARRAY_BL);

try {
runtime.registerInspecting(this);
return (RubyString) inspectAry(context);
} finally {
runtime.unregisterInspecting(this);
}
return (RubyString) context.execRecursive((ctx, state, obj, recur) -> state.inspectAry(ctx, recur), this, this, "inspect");
}

// MRI: rb_ary_first
Expand Down Expand Up @@ -1883,7 +1878,7 @@ private void recursiveJoin(final ThreadContext context, final IRubyObject outVal

first[0] = false;

context.safeRecurse(JOIN_RECURSIVE, new JoinRecursive.State(ary, outValue, sep, result, first), outValue, "join", true);
context.execRecursive(JOIN_RECURSIVE, new JoinRecursive.State(ary, outValue, sep, result, first), outValue, "join");
}

/** rb_ary_join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public int indexOf(Object element) {
}

@Override
protected IRubyObject inspectAry(ThreadContext context) {
if (!packed()) return super.inspectAry(context);
protected IRubyObject inspectAry(ThreadContext context, boolean recur) {
if (recur || !packed()) return super.inspectAry(context, recur);

final Ruby runtime = context.runtime;
RubyString str = RubyString.newStringLight(runtime, DEFAULT_INSPECT_STR_SIZE, USASCIIEncoding.INSTANCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public int indexOf(Object element) {
}

@Override
protected IRubyObject inspectAry(ThreadContext context) {
if (!packed()) return super.inspectAry(context);
protected IRubyObject inspectAry(ThreadContext context, boolean recur) {
if (recur || !packed()) return super.inspectAry(context, recur);

final Ruby runtime = context.runtime;
RubyString str = RubyString.newStringLight(runtime, DEFAULT_INSPECT_STR_SIZE, USASCIIEncoding.INSTANCE);
Expand Down
Loading