[ 
https://issues.apache.org/jira/browse/LUCENE-6417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14655068#comment-14655068
 ] 

Uwe Schindler edited comment on LUCENE-6417 at 8/5/15 9:33 AM:
---------------------------------------------------------------

Hi,
there is actually a solution without any additional regexes. The main problem 
are not the inner autogenerated {{*Context}} classes. They can stay public, 
because the outer class is pkg private. The problem are more interfaces and 
their implementations using those private classes in public signatures.

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?).


was (Author: thetaphi):
Hi,
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: https://issues.apache.org/jira/browse/LUCENE-6417
>             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
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to