From 26bb39ea3b96520e76ff04a8675f5ab210857b78 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Tue, 7 Nov 2023 21:32:09 -0600 Subject: [PATCH] Separate two types of internal check * Starting with uri:classloader:/jruby/kernel are filenames that come from JRuby's internal Ruby sources. They should gain the internal prefix. * Starting with internal prefix indicates an internal source that may be appropriate to exclude under certain conditions. We check both of these at trace-construction time because the relevant rubyspec shows the behavior to also filter out user- provided filenames with the same internal prefix, which is used to test the masking and removal of these lines. In order to handle both true internal filenames and user-provided internal- prefixed filenames, both must be checked for omission here. I don't agree with the side effect of being able to mask any trace line, but I think that train has sailed. --- .../jruby/runtime/backtrace/BacktraceData.java | 5 ++--- .../org/jruby/runtime/backtrace/TraceType.java | 15 +++++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/jruby/runtime/backtrace/BacktraceData.java b/core/src/main/java/org/jruby/runtime/backtrace/BacktraceData.java index a4fd093eadc..c59dfe8e853 100644 --- a/core/src/main/java/org/jruby/runtime/backtrace/BacktraceData.java +++ b/core/src/main/java/org/jruby/runtime/backtrace/BacktraceData.java @@ -2,7 +2,6 @@ import com.headius.backport9.stack.StackWalker; import org.jruby.Ruby; -import org.jruby.runtime.builtin.IRubyObject; import org.jruby.util.JavaNameMangler; import java.io.Serializable; @@ -93,7 +92,7 @@ private RubyStackTraceElement[] constructBacktrace(Map mangledTuple = JavaNameMangler.decodeMethodTuple(methodName); if (mangledTuple != null) { @@ -173,7 +172,7 @@ private RubyStackTraceElement[] constructBacktrace(Map"; } return filename; } - public static boolean isInternal(String filename) { - return filename.startsWith("uri:classloader:/jruby/kernel/") || - filename.startsWith("