zacharymorn edited a comment on pull request #34:
URL: https://github.com/apache/lucene/pull/34#issuecomment-805464492


   > > Is the plan to have both ecj & error prone to co-exist in Lucene to 
catch different kinds of bugs?
   > 
   > I think the union of all these tools is different than their intersection 
so they help catch issues, even if they do some duplicate work?
   
   
   > > Thanks Robert for working on this! And yeah I didn't quite anticipate so 
much dead code lingering around when I created the issue! From your latest 
comment this PR is very much ready now? Any aspect I can still look into in 
this PR to help out as well at this point? (and sorry for coming in late in the 
discussion!)
   > 
   > We may always followup with more checks. I mentioned a good one in my 
comment above, i'd really like to enforce that `@Override` annotation is used 
everywhere, to help prevent dead `public` and `protected` methods in the future?
   > 
   > In the preferences file, we would set 
`org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error` and 
then fix all the problems. It would be good as a standalone followup issue
   > 
   > > In addition, I have a newbie question. It appears error prone was 
integrated fairly recently this year 
https://issues.apache.org/jira/browse/LUCENE-9497, but the issue itself didn't 
seems to mention why error prone was needed when there's already ecj lint, and 
which one should be preferred for which scenario. Is the plan to have both ecj 
& error prone to co-exist in Lucene to catch different kinds of bugs?
   > 
   > I don't know the error-prone well, but it is more of a "static analysis 
tool": I immediately think that it leans towards heuristics and "false 
positives".
   > 
   > On the other hand, ECJ is a "compiler", but with a lot of nice checks. 
Maybe they are not as fancy as the kind of checks that error-prone might be 
able to do, instead they are simpler, more like "additional compiler warnings". 
We've used ECJ for a long time: It runs efficiently, has a TON more eyes 
looking at its output every day, and provides great error messages. IMO, for 
solving your problem of "my IDE can detect it is dead code, why doesn't the 
build", it is the perfect tool: since it is the thing doing that in your IDE 
(to my knowledge not just eclipse but intellij may use it too).
   
   
   
   > > On the other hand, ECJ is a "compiler", but with a lot of nice checks. 
Maybe they are not as fancy as the kind of checks that error-prone might be 
able to do, instead they are simpler, more like "additional compiler warnings". 
We've used ECJ for a long time: It runs efficiently, has a TON more eyes 
looking at its output every day, and provides great error messages. IMO, for 
solving your problem of "my IDE can detect it is dead code, why doesn't the 
build", it is the perfect tool: since it is the thing doing that in your IDE 
(to my knowledge not just eclipse but intellij may use it too).
   > 
   > I fully agree with that. I was also thinking about further improving 
compile time in Java by using ECJ as the official compiler and move it from 
"Lint" stage. We can maybe reimplement compileJava tasks in Gradle to use ECJ 
(maybe it works out of box!?). So people would see those errors as soon as they 
compile or run tests. ECJ is just an alternative compiler and may work as 
replacement for javac.
   > 
   > This is no suggestion, but something to discuss on a separate issue. 
There's also a Grade plugin to do this: 
https://github.com/TwoStone/gradle-eclipse-compiler-plugin (and it allows to 
supply the properties file with warning/error config).
   
   
   Thanks for the explanation and insight on ecj vs. error prone. They make a 
lot of sense! To keep the fun going, I have opened another jira issue 
(https://issues.apache.org/jira/browse/LUCENE-9864) to enforce the use of 
`@Override` with 
`org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error` as 
suggested, and will try to see if I can get a PR out soon.  
   
   


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

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to