> I'm not sure I understand how that helps. In fact, the comment is pretty much useless, any thread-safe class is thread-safe only after construction.

I disagree, the comment *was* helpful! :-)

> AFAIK unsafe publication can happen if this escapes the thread during the constructor call.

Right, but your design can prevent this from happening. Here is what I have in mind:

```
object LexicalStructure {
  def apply(source: SourceFile): LexicalStructure = {
    val token = new ArrayBuffer[Int]
    val startOffset = new ArrayBuffer[Int]
    val endOffset = new ArrayBuffer[Int] 
    
    val scanner = new syntaxAnalyzer.UnitScanner(new CompilationUnit(source))
    scanner.init()
    while (scanner.token != Tokens.EOF) {
      startOffset += scanner.offset
      token += scanner.token
      scanner.nextToken
      endOffset += scanner.lastOffset
    }
    new LexicalStructure(token, startOffset, endOffset)

  }
}

class LexicalStructure private (token: ArrayBuffer[Int], startOffset: ArrayBuffer[Int], endOffset: ArrayBuffer[Int]) {
  //...
}
```