I don't think the suggestion is a good idea. You should understand that a Token object is, in principle, associated with a specific TokenSource/Lexer object. That's what the getTokenSource() API is about. It is true that this dummy start token is not having that field set at the moment (but that could be an oversight, come to think of it) But anyway, in principle, the tokenSource field could be used.. Once we (or maybe somebody) uses the getTokenSource/setTokenSource API's, then that would tend to cause the code to be thread-unsafe. It's certainly a possibility and the memory savings from making this a static field is infinitesimal really, so....
I don't think the suggestion is a good idea. You should understand that a Token object is, in principle, associated with a specific TokenSource/Lexer object. That's what the getTokenSource() API is about. It is true that this dummy start token is not having that field set at the moment (but that could be an oversight, come to think of it) But anyway, in principle, the
tokenSource
field could be used.. Once we (or maybe somebody) uses the getTokenSource/setTokenSource API's, then that would tend to cause the code to be thread-unsafe. It's certainly a possibility and the memory savings from making this a static field is infinitesimal really, so....