google-java-format icon indicating copy to clipboard operation
google-java-format copied to clipboard

fix `RemoveUnusedImportsStep` leftovers

Open Pankraz76 opened this issue 6 months ago • 4 comments

fix #1261

@iddeepak kindly request your eyes on this.

  • execute and debug some test locally on IDE?
  • maybe work this out?
    • tc exposed some issues
[ERROR] Failures: 
[ERROR]   RemoveUnusedImportsTest.removeUnused:485 value of:
    removeUnusedImports(...)
expected:
    interface Test { private static void foo() {} }
    
    
but was:
    import java.lang.Foo;
    interface Test { private static void foo() {} }
    
    
[ERROR]   RemoveUnusedImportsTest.removeUnused:485 value of:
    removeUnusedImports(...)
expected:
    …pkg.Constants.FOO;
    
    public class Test …
but was:
    …pkg.Constants.FOO;
    
    
    public class Test …
[ERROR]   RemoveUnusedImportsTest.removeUnused:485 value of:
    removeUnusedImports(...)
diff (-expected +actual):
    @@ -1,3 +1,4 @@
    +import static java.util.Collections.*;
     import static java.util.Collections.emptyList;
     
     class Test {
[ERROR]   RemoveUnusedImportsTest.removeUnused:485 value of:
    removeUnusedImports(...)
expected:
    class Test {
      java.…
but was:
    
    class Test {
      java.…
[ERROR]   RemoveUnusedImportsTest.removeUnused:485 value of:
    removeUnusedImports(...)
diff (-expected +actual):
    @@ -1,3 +1,4 @@
    +import static java.lang.Math.*;
     import static java.lang.Math.PI;
     
     class Test {
[ERROR]   RemoveUnusedImportsTest.removeUnused:485 value of:
    removeUnusedImports(...)
expected:
    // This is a comment mentioning ArrayList
    class Test {}
    
    
but was:
    
    // This is a comment mentioning ArrayList
    class Test {}
    
    
[ERROR]   RemoveUnusedImportsTest.removeUnused:485 value of:
    removeUnusedImports(...)
diff (-expected +actual):
    @@ -1,5 +1,6 @@
     package com.foo;
     import static com.foo.Outer.A;
    +import com.foo.*;
     import com.foo.B;
     import com.bar.C;
     class Test {
[INFO] 
[ERROR] Tests run: 1580, Failures: 7, Errors: 0, Skipped: 0

Pankraz76 avatar Jun 26 '25 10:06 Pankraz76

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Jun 26 '25 10:06 google-cla[bot]

@Pankraz76 I have pushed a few small tweaks—feel free to pull them into your branch and let me know what you think or if anything needs further adjustment PR #1266 Thank you!

iddeepak avatar Jun 28 '25 00:06 iddeepak

  • https://github.com/palantir/palantir-java-format/pull/1337

Pankraz76 avatar Jul 02 '25 12:07 Pankraz76

can not fix remaining tests, ether disable or fix.

Kindly request some feedback. Thanks.

Pankraz76 avatar Aug 06 '25 10:08 Pankraz76