11package dotty .tools .dotc
22
3+ import scala .language .{unsafeNulls => _ }
4+
35import java .nio .file .{Files , Paths }
46
57import dotty .tools .FatalError
@@ -32,15 +34,18 @@ class Driver {
3234
3335 protected def emptyReporter : Reporter = new StoreReporter (null )
3436
35- protected def doCompile (compiler : Compiler , files : List [AbstractFile ])(using Context ): Reporter =
37+ protected def doCompile (compiler : Compiler , files : List [AbstractFile ])(using Context ): Reporter =
3638 if files.nonEmpty then
3739 try
3840 val run = compiler.newRun
3941 run.compile(files)
4042 finish(compiler, run)
4143 catch
4244 case ex : FatalError =>
43- report.error(ex.getMessage) // signals that we should fail compilation.
45+ val msg = ex.getMessage
46+ if msg != null then
47+ report.error(msg) // signals that we should fail compilation.
48+ else report.error(" null" )
4449 case ex : TypeError =>
4550 println(s " ${ex.toMessage} while compiling ${files.map(_.path).mkString(" , " )}" )
4651 throw ex
@@ -115,7 +120,7 @@ class Driver {
115120 .distinct
116121 val ctx1 = ctx.fresh
117122 val fullClassPath =
118- (newEntries :+ ctx.settings.classpath.value).mkString(java.io.File .pathSeparator)
123+ (newEntries :+ ctx.settings.classpath.value).mkString(java.io.File .pathSeparator.nn )
119124 ctx1.setSetting(ctx1.settings.classpath, fullClassPath)
120125 else ctx
121126
@@ -138,8 +143,8 @@ class Driver {
138143 * process. No callbacks will be executed if this is `null`.
139144 * @return
140145 */
141- final def process (args : Array [String ], simple : interfaces.SimpleReporter ,
142- callback : interfaces.CompilerCallback ): interfaces.ReporterResult = {
146+ final def process (args : Array [String ], simple : interfaces.SimpleReporter | Null ,
147+ callback : interfaces.CompilerCallback | Null ): interfaces.ReporterResult = {
143148 val reporter = if (simple == null ) null else Reporter .fromSimpleReporter(simple)
144149 process(args, reporter, callback)
145150 }
@@ -157,8 +162,8 @@ class Driver {
157162 * @return The `Reporter` used. Use `Reporter#hasErrors` to check
158163 * if compilation succeeded.
159164 */
160- final def process (args : Array [String ], reporter : Reporter = null ,
161- callback : interfaces.CompilerCallback = null ): Reporter = {
165+ final def process (args : Array [String ], reporter : Reporter | Null = null ,
166+ callback : interfaces.CompilerCallback | Null = null ): Reporter = {
162167 val compileCtx = initCtx.fresh
163168 if (reporter != null )
164169 compileCtx.setReporter(reporter)
@@ -176,7 +181,7 @@ class Driver {
176181 * with sbt.
177182 */
178183 final def process (args : Array [String ]): Reporter =
179- process(args, null : Reporter , null : interfaces.CompilerCallback )
184+ process(args, null : Reporter | Null , null : interfaces.CompilerCallback | Null )
180185
181186 /** Entry point to the compiler using a custom `Context`.
182187 *
0 commit comments