Aladdin - Scala Bugtracking
[#953] project: compiler priority: high category: bug
submitter assigned to status date submitted
Stephane Nikolay fixed 2007-02-15 12:42:28.0
subject NullPointerException in nsc.Main
code
--- src/compiler/scala/tools/nsc/Main.scala     (revision 9881)
+++ src/compiler/scala/tools/nsc/Main.scala     (revision 9907)
@@ -38,10 +38,8 @@
     }

   def process(args: Array[String]): unit = {
-    reporter = new ConsoleReporter();
-    val command = new CompilerCommand(List.fromArray(args), error, false);
-    reporter.prompt = command.settings.prompt.value
-    reporter.nowarn = command.settings.nowarnings.value
+    val command = new CompilerCommand(List.fromArray(args), error, false)
+    reporter = new ConsoleReporter(command.settings)
     if (command.settings.version.value)
       reporter.info(null, versionMsg, true)
     else if (command.settings.help.value)
what happened
error may be called before initialization of reporter:
scala> ./build/quick/bin/scalac test.s
Exception in thread "main" java.lang.NullPointerException
        at scala.tools.nsc.Main$.error(Main.scala:27)
        at scala.tools.nsc.Main$$anonfun$2.apply(Main.scala:41)
        at scala.tools.nsc.Main$$anonfun$2.apply(Main.scala:41)
        at scala.tools.nsc.CompilerCommand.(CompilerCommand.scala:74)
        at scala.tools.nsc.Main$.process(Main.scala:41)
        at scala.tools.nsc.Main$.main(Main.scala:78)
        at scala.tools.nsc.Main.main(Main.scala)
what expected
[back to overview]
Changes of this bug report
Stephane  edited on  2007-02-15 14:15:24.0
Nikolay  edited on  2007-02-19 15:47:50.0
I had to add Settings as CompilerCommand constructor parameter