- 
                Notifications
    
You must be signed in to change notification settings  - Fork 11.1k
 
          Apply UnnecessaryParentheses
          #7930
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 
           if you consider this let me know i need to revert the maven suggestions then if these could not be applied as well.  | 
    
6d65a5c    to
    1650af1      
    Compare
  
    | 
           [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pom.xml changes seem unrelated to the application of the Refaster rules. Just some drive-by comments.
        
          
                android/guava-tests/test/com/google/common/collect/ListsTest.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
      
          
 yes sorry, had dirty working copy including: 
 Will undo/assuming we gonna merge this dedicated:  | 
    
1650af1    to
    8123b1d      
    Compare
  
    8123b1d    to
    3f5befb      
    Compare
  
    3f5befb    to
    02bcc72      
    Compare
  
    | 
           of course this change should not be merges this way, considering simple replication of the   | 
    
| 
           I'd be happy to take the   | 
    
| 
           Can rebase at any time, but due to the code density, conflicts are likely to arise soon. This is another good example why the plugin is in need to avoid spending time on issues like this. As it will be happen very soon after its fixed once but not forever. Making the whole effort most efficient if fixed for the future as well. It's either a one-time effort to fix it now, or dealing with it constantly—which is inefficient until it's properly resolved once.  | 
    
| 
           The best way to avoid spending time on this level of issue is often just to ignore it, sadly. I do think that the mass fix here (which looks to be more aggressive than Error Prone was in #7696 and #7771) is worthwhile, and I have sent it for review internally. Still, I think the cost of the first breakage from a build-time check here would outweigh the benefits of the backsliding protection, and I am happy to leave the checking off. If we want to clean up such errors in the future, I think the most efficient way to do that will be another mass run of the check.  | 
    
          
 What about tools like Checkstyle? Looking at large-scale projects like PMD and Checkstyle, they don’t have this issue. Maven also uses Spotless to automate these tedious tasks and discussions, no offence. Its about fixing issues like you mentioning not about ignoring stuff. Its not an improvement leaving the flaws open considering this hindering to an easy access of the code. Investing all the time spent on manual formatting fixes would be better spent on a single commit with a plugin. We’re past the era where formatting errors require: 
 Major projects like Maven, Quarkus, and Spring all rely on automation—because at scale, there’s no other practical way.  | 
    
| 
           This could be made simply by merging and activating the   | 
    
| 
           There is a lot that can be said about both the importance of code simplifications/improvements and the way to make those improvements at the lowest cost (e.g., build errors/warnings vs. automated code-review comments vs. human action vs. periodic cleanups vs. presubmits). (I think that there may be a presentation of one perspective on this in https://storage.googleapis.com/gweb-research2023-media/pubtools/4365.pdf.) Our situation is more complicated still because our Maven build is sort of "secondary" in our normal workflow. Breakages that are delayed to that phase need to provide a lot of value before they pay off.  | 
    
| 
           As I should probably have anticipated, and as I hinted at in #7934 (comment), there's some disagreement over the value of parentheses on ternary conditions. (Opinions range from "always" to "never," with space for intermediate options like "only if the conditional is 'complex' (e.g.,   | 
    
          
 yes "unfortunately" thats true, theres always the need for some exception, using suppression serving both parties. Having a little freedom, while not having to strive in chaos.  | 
    
And sneak in a few other simplifications, mostly to remove explicit type arguments. Fixes #7930 RELNOTES=n/a PiperOrigin-RevId: 793670129
| 
           Assuming something much broader like   | 
    
02bcc72    to
    87719ee      
    Compare
  
    | 
           I forgot to also post: A teammate referred me to https://google.github.io/styleguide/javaguide.html#s4.7-grouping-parentheses, which is the standard we're up against. The Java changes in #7938 look good except for the ones that appear to be removing serialization methods that Java calls automatically.  | 
    
          
 Thanks very interesting. Need to ignore these, in the recipe, if this is actually true/good.  | 
    
| 
           but again this effort is considered waste, as its not done, it will happen again. We should try to stop starting and start finishing. As this obsolete stuff will occur anytime again if there is no quality gate imposed. Currently its bug/issue/flaw eldorado. I have fixed bugs in maven due to this kind of issue, so please dont argue its not important.  | 
    
          
 Is this something real or just some random google stuff? @timtebeek https://github.com/search?q=repo%3Agoogle%2Fguava%20writeReplace&type=code Inconsistent again. Its private. Is it called via reflection then or how should this work in runtime ?  
Not even the code format is working, its really sad to see this important project in such conditions.  
       | 
    
          
 This case was missed; fixed now and likely released later today: openrewrite/rewrite-static-analysis@976d366  | 
    


enabler for:
rewritesupport forUnnecessaryParentheses#7934