Skip to content

Commit

Permalink
Fix for sbt#4148 (SessionSettingsSpec intermittently fails)
Browse files Browse the repository at this point in the history
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 sbt#3743 (see comment sbt#3170 (comment))
  • Loading branch information
Antonio Cunei committed May 28, 2018
1 parent 7e8e18b commit f2a7e1f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main/src/main/scala/sbt/internal/parser/SbtParser.scala
Expand Up @@ -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()
}
Expand Down

0 comments on commit f2a7e1f

Please sign in to comment.