From 5c72c3b4879cf00a0e2ab8447cfa8dd4d2aa1d85 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Fri, 8 Dec 2017 19:21:14 +0100 Subject: [PATCH] Revert "Alt scala parser sync workaround" Although in theory the fix in #3776 should be preferable to synchronize templateStats() manually, it turns out that we still get errors in some tests. So, reverting to a synchronized section while we investigate. This reverts commit ee90917cc4bb0de8294fc4d93633c798a4866ff4. --- main/src/main/scala/sbt/internal/parser/SbtParser.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/src/main/scala/sbt/internal/parser/SbtParser.scala b/main/src/main/scala/sbt/internal/parser/SbtParser.scala index 6e89cdf28..18dfa2b5e 100644 --- a/main/src/main/scala/sbt/internal/parser/SbtParser.scala +++ b/main/src/main/scala/sbt/internal/parser/SbtParser.scala @@ -116,9 +116,7 @@ private[sbt] object SbtParser { scalacGlobalInitReporter = Some(new ConsoleReporter(settings)) // Mix Positions, otherwise global ignores -Yrangepos - val global = new Global(settings, globalReporter) with Positions { - override protected def synchronizeNames = true // https://github.com/scala/bug/issues/10605 - } + val global = new Global(settings, globalReporter) with Positions val run = new global.Run // Add required dummy unit for initialization... val initFile = new BatchSourceFile("", "") @@ -151,7 +149,9 @@ private[sbt] object SbtParser { val wrapperFile = new BatchSourceFile(reporterId, code) val unit = new CompilationUnit(wrapperFile) val parser = new syntaxAnalyzer.UnitParser(unit) - val parsedTrees = parser.templateStats() + val parsedTrees = SbtParser.synchronized { // see https://github.com/scala/bug/issues/10605 + parser.templateStats() + } parser.accept(scala.tools.nsc.ast.parser.Tokens.EOF) globalReporter.throwParserErrorsIfAny(reporter, filePath) parsedTrees -> reporterId