Fix for #4148 (SessionSettingsSpec intermittently fails)

It turns out that `syntaxAnalyzer.UnitParser()` in global now also
needs to be synchronized. The alternative is adding `synchronizeNames = true`
in the global constructor, but that already proved unreliable in the
case of #3743 (see comment https://github.com/sbt/sbt/issues/3170#issuecomment-355218833)
This commit is contained in:
Antonio Cunei 2018-05-28 14:09:13 +02:00
parent 7e8e18b9fa
commit f2a7e1f1c3
1 changed files with 3 additions and 1 deletions

View File

@ -148,7 +148,9 @@ private[sbt] object SbtParser {
reporter.reset()
val wrapperFile = new BatchSourceFile(reporterId, code)
val unit = new CompilationUnit(wrapperFile)
val parser = new syntaxAnalyzer.UnitParser(unit)
val parser = SbtParser.synchronized { // see https://github.com/sbt/sbt/issues/4148
new syntaxAnalyzer.UnitParser(unit)
}
val parsedTrees = SbtParser.synchronized { // see https://github.com/scala/bug/issues/10605
parser.templateStats()
}