From daead5063f9c030d4c13cc49d264e68cc4e13f34 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 24 Sep 2015 21:57:24 -0400 Subject: fix bug where -Xprint-icode leaked an InputStream and a file handle usually it hardly matters, but it's still a bug, and on Windows we can't delete an open file, so this can cause trouble for someone writing a test that relies on being able to generate icode files and then clean them up afterwards. (and in fact, two IcodeComparison-based tests were failing.) --- src/compiler/scala/tools/nsc/Global.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 3469726455..936bed7c8f 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -1686,7 +1686,10 @@ class Global(var currentSettings: Settings, var reporter: Reporter) try { val stream = new FileOutputStream(file) printer.setWriter(new PrintWriter(stream, true)) - printer.printClass(cls) + try + printer.printClass(cls) + finally + stream.close() informProgress(s"wrote $file") } catch { case e: IOException => -- cgit v1.2.3 From 80e4f5431c3c7efe3e13406b79a10ab9d274d460 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 24 Sep 2015 23:49:15 -0400 Subject: add missing newline at eof in Scala source this was causing a mysterious compilation failure on Windows. (it may not have been a sufficient cause in itself -- which is why I say "mysterious" -- but in any case, adding the newline made the failure go away. and besides, the newline should be there. so here it is.) (it's tempting to make a big commit that fixes this in every source file. resisting for now) --- .../scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzer.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzer.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzer.scala index 700b2f2f6c..594fd8923c 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzer.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzer.scala @@ -475,4 +475,4 @@ class InitialProducerSourceInterpreter extends SourceInterpreter { override def newExceptionValue(tryCatchBlockNode: TryCatchBlockNode, handlerFrame: Frame[_ <: Value], exceptionType: Type): SourceValue = { new SourceValue(1, ExceptionProducer(handlerFrame)) } -} \ No newline at end of file +} -- cgit v1.2.3