@@ -32,7 +32,8 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
32
32
33
33
private var myClassLoader : AbstractFileClassLoader = _
34
34
35
- private var myReplStringOf : Object => String = _
35
+ /** (value, maxElements) => String */
36
+ private var myReplStringOf : (Object , Int ) => String = _
36
37
37
38
/** Class loader used to load compiled code */
38
39
private [repl] def classLoader ()(using Context ) =
@@ -64,12 +65,12 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
64
65
val meth = scalaRuntime.getMethod(renderer, classOf [Object ], classOf [Int ], classOf [Boolean ])
65
66
val truly = java.lang.Boolean .TRUE
66
67
67
- (value : Object ) => meth.invoke(null , value, Integer .valueOf(maxPrintElements) , truly).asInstanceOf [String ]
68
+ (value : Object , maxElements : Int ) => meth.invoke(null , value, maxElements , truly).asInstanceOf [String ]
68
69
} catch {
69
70
case _ : NoSuchMethodException =>
70
71
val meth = scalaRuntime.getMethod(renderer, classOf [Object ], classOf [Int ])
71
72
72
- (value : Object ) => meth.invoke(null , value, Integer .valueOf(maxPrintElements) ).asInstanceOf [String ]
73
+ (value : Object , maxElements : Int ) => meth.invoke(null , value, maxElements ).asInstanceOf [String ]
73
74
}
74
75
}
75
76
myClassLoader
@@ -91,7 +92,8 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
91
92
private [repl] def replStringOf (value : Object )(using Context ): String =
92
93
assert(myReplStringOf != null ,
93
94
" replStringOf should only be called on values creating using `classLoader()`, but `classLoader()` has not been called so far" )
94
- val res = myReplStringOf(value)
95
+ val maxPrintElements = ctx.settings.VreplMaxPrintElements .valueIn(ctx.settingsState)
96
+ val res = myReplStringOf(value, maxPrintElements)
95
97
if res == null then " null // non-null reference has null-valued toString" else truncate(res)
96
98
97
99
/** Load the value of the symbol using reflection.
0 commit comments