opwvhk commented on a change in pull request #1377:
URL: https://github.com/apache/avro/pull/1377#discussion_r763167700
##########
File path:
lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj
##########
@@ -1020,13 +1020,17 @@ TOKEN :
Protocol CompilationUnit():
{
Protocol p;
+ DocCommentHelper.getAndClearWarnings(); // Throw away previous results.
}
{
p = ProtocolDeclaration()
( < "\u001a" > )?
( <STUFF_TO_IGNORE: ~[]> )?
<EOF>
- { return SchemaResolver.resolve(p); }
+ {
+ parserWarnings = DocCommentHelper.getAndClearWarnings();
Review comment:
Lines 1023 and 1031 are executed in the same method, and hence always on
the same thread. This guarantees that between these lines, the use of
`ThreadLocal` fields in the class `DocCommentHelper` works the same way as
instance fields.
(note: we need to use `ThreadLocal` fields, because the generated class
`IdlTokenManager` needs to store documentation somewhere (due to the leniency
of the parser), and we cannot we cannot add instance fields to it)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]