lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <>
Subject [jira] [Commented] (LUCENE-6417) Upgrade ANTLR to version 4.5
Date Wed, 05 Aug 2015 09:33:04 GMT


Uwe Schindler commented on LUCENE-6417:

there is actually a solution without any additional regexes. The main problem are not the
implementation classes. They can stay public, because the outer class is pkg private. The
problem are more interfaces and their implementations in public classes.

The problem here is the following: JavascriptCompiter is public API but it implements an interface
using pkg private classes in method signatures. This causes issues, because all methods implementing
an interface must be public :-( Because JavascriptCompiter is public those methods get visible
to everybody, but their signatures use pkg-protected (sub-)classes. This breaks visibility
and Javadocs linting fails (404 not found errors).

The solution is the following:
- make JavascriptErrorHandlingLexer, JavascriptParserErrorStrategy pkg private (its impl detail)
- make JavascriptVisitor interface pkg-private (this one is the main issue)
- the problem is now that JavaScript compiler implement JavascriptVisitor, and therefore all
implemented methods get public (which is bad). The workaround is the following: Make the actual
visitor implementation not part of public API, instead create the visitor (that extends JavascriptBaseVisitor)
inside JavascriptCompiler as anonymous, private instance and call the visit method on it,
but not implement the interface method directly in the top-level class. Because it is anonymous
inner class it has access to all methods/fields, but the implemented interface keeps private.
You can move most methods handling the visiting process into the anonymous inner class. On
top-level you just have the compiler (as before).

I have not much time today to implement this, but this might work. [~jdconradson]: If you
work on this, can you use my patch as base? I already solved the license issues, so precommit
passes, except the visibility problems.

Finally, the VariableContext should be pkg-private, too - it was made public in some earlier
commit, but it does not need to be public at all (I think?).

> Upgrade ANTLR to version 4.5
> ----------------------------
>                 Key: LUCENE-6417
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Jack Conradson
>            Assignee: Uwe Schindler
>         Attachments: LUCENE-6471.patch, LUCENE-6471.patch, LUCENE-6471.patch
> I would like to upgrade ANTLR from 3.5 to 4.5.  This version adds several features that
will improve the existing grammars.  The main improvement would be the allowance of left-hand
recursion in grammar rules which will reduce the number of rules significantly for expressions.
> This change will require some code refactoring to the existing expressions work.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message