-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
UnusedImports does not report unused static imports when the method is used as a method reference #12923
Comments
@ksobolew interesting nuance, thanks for raising this issue! |
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Mar 29, 2023
…mports when the method is used as a method reference Added an additional check to not include method ref into referenced types.
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Mar 29, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Mar 30, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Mar 30, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Mar 31, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Mar 31, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 1, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 1, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 1, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 1, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 2, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 5, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 13, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 14, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 17, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 18, 2023
…mports with method reference
nrmancuso
pushed a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 19, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
Apr 19, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
May 1, 2023
…mports with method reference
renjith7189
added a commit
to renjith7189/checkstyle
that referenced
this issue
May 2, 2023
…mports with method reference
This was referenced Jul 4, 2023
@mahfouz72 , can you help us to finish this issue ? fix is almost done at #12933, only small step is required. please create new PR and resuse code |
@romani ok will take it.will send a new PR asap |
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 25, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 25, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 25, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 25, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 25, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 27, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 28, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 28, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 28, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 28, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 28, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 28, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Feb 28, 2024
rnveach
pushed a commit
to mahfouz72/checkstyle
that referenced
this issue
Mar 18, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Mar 19, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Mar 19, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Mar 27, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Apr 1, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Apr 1, 2024
mahfouz72
added a commit
to mahfouz72/checkstyle
that referenced
this issue
Apr 1, 2024
romani
pushed a commit
that referenced
this issue
Apr 4, 2024
@romani I think this should be closed now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have read check documentation: https://checkstyle.sourceforge.io/config_imports.html#UnusedImports
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
The Java file contains three unused imports: the import of
java.util.Set
and static imports ofjava.lang.String#format
andjava.lang.String#join
. Only two of them are reported, while the static import ofjava.lang.String#format
is a false negative. From what it looks like, it's not reported because it's "used" as a method reference, as intest.map(String::format);
, which is wrong, because with a method reference only the type needs to be imported and that's enough to resolve the method itself.The text was updated successfully, but these errors were encountered: