templateStats() is not thread-safe in 2.12.x (at least up to 2.12.4)
This commit is contained in:
Antonio Cunei 2017-11-14 18:50:36 +01:00
parent ee4dcee7cf
commit a050b73a46
1 changed files with 3 additions and 1 deletions

View File

@ -142,7 +142,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