uschindler commented on PR #12016:
URL: https://github.com/apache/lucene/pull/12016#issuecomment-1350666129

   Hi, I agree with all Robert say. I would also like to make another 
suggestion (that could also be applied when this has been fixed). To me it 
looks like a bad decission of antlr, that the tool compiles code and creates 
some Java/Class files but at runtime it also needs some dependency JAR in 
exactly the correct version. This is a problem for a library like lucene that 
gets included into other projects. The same also applies for ASM, although this 
is no longer a big problem anymore, because ASM's APIs are now very stable and 
it does not matter if a project uses ASM 8 or ASM 9 if minimum requirements are 
guaranteed (so the user has more flexibility).
   
   In contrast javacc does not have the problem, because javacc or jflex 
generates all of the code and you don't need any runtime library to execute and 
access the AST.
   
   In Lucene both (ANTLR and ASM) are dependencies of one artifact: 
lucene-expressions, so it is only a real problem there. My suggestion would be: 
Let's shade the ANTLR (and possibly also ASM - until the JDK-included bytecode 
generator is out of incubation/preview) into the JAR file. With ASM this was 
hard to do but with Grade it is quite easy. Just add another configuration with 
those two dependencies and use the "Gradle Shadow Plugin" 
(https://imperceptiblethoughts.com/shadow/) to transform their package names 
into the Lucene namespace.
   
   I know some people don't like this, but I had exactly the same problems with 
ASM in the forbiddenapis plugin and shading ASM in there was the only way to 
work around different, old, incompatible versions of ASM inside Maven or 
Gradle's classpath, while forbiddenapis always needeing the newest one.
   
   If you like I could make a PR to demonstrate the shading for Lucene's Gradle 
build in Expressions. @dweiss : What do you think? Of course we should not use 
shading anywhere else, but ANTLR and ASM are the candidates that always bring 
problems. Their size is also small so the overhead is small, but you have a 
consistent package that is unlikely to break when other projects use different 
library versions.


-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to