@@ -113,18 +113,25 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None) {
113
113
infoDiagnostic(d.symbol.showUser, d)
114
114
115
115
/** Render value definition result */
116
- def renderVal (d : Denotation )(using Context ): Option [Diagnostic ] = {
116
+ def renderVal (d : Denotation )(using Context ): Option [Diagnostic ] =
117
117
val dcl = d.symbol.showUser
118
118
119
- try {
119
+ try
120
120
if (d.symbol.is(Flags .Lazy )) Some (infoDiagnostic(dcl, d))
121
121
else valueOf(d.symbol).map(value => infoDiagnostic(s " $dcl = $value" , d))
122
- }
123
- catch { case ex : InvocationTargetException => Some (infoDiagnostic(renderError(ex), d)) }
124
- }
125
-
126
- /** Render the stack trace of the underlying exception */
127
- private def renderError (ex : InvocationTargetException ): String = {
122
+ catch case ex : InvocationTargetException => Some (infoDiagnostic(renderError(ex), d))
123
+ end renderVal
124
+
125
+ /** Force module initialization in the absence of members. */
126
+ def forceModule (sym : Symbol )(using Context ): Seq [Diagnostic ] =
127
+ def load () =
128
+ val objectName = sym.fullName.encode.toString
129
+ val resObj : Class [? ] = Class .forName(objectName, true , classLoader())
130
+ Nil
131
+ try load() catch case e : ExceptionInInitializerError => List (infoDiagnostic(renderError(e), sym.denot))
132
+
133
+ /** Render the stack trace of the underlying exception. */
134
+ private def renderError (ex : InvocationTargetException | ExceptionInInitializerError ): String = {
128
135
val cause = ex.getCause match {
129
136
case ex : ExceptionInInitializerError => ex.getCause
130
137
case ex => ex
0 commit comments