Skip to content
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

apply UnusedLocalVariable #34489

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

pankratz76
Copy link

@pankratz76 pankratz76 commented Feb 25, 2025

Encounter unused code with help of CS module UnusedLocalVariable.

Wondering why the CS config needs to be duplicated. The rules seem not to be applied, some of the findings only emerge after adding the corresponding module again.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 25, 2025
Copy link
Author

@pankratz76 pankratz76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question

String value = "Sample";
Method[] methods = String.class.getMethods();
methods = Integer.class.getMethods();
// String.class.getMethods();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I'm wondering if the field is required for the test or if just the method call triggers the hint.

I was not able to run it locally—it seems to be special because of the annotation.
Normally, I test locally, but I was not able to. Please excuse this.

@@ -1,10 +1,10 @@
root = true

[*.{adoc,bat,groovy,html,java,js,jsp,kt,kts,md,properties,py,rb,sh,sql,svg,txt,xml,xsd}]
[*]
charset = utf-8
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for clarification, is the intent to not make this the default?

I have never seen it otherwise, only globally, with the most common encoding being UTF-8.

This is new to me—my previous knowledge was that properties files were the only files not normally encoded in UTF-8, but now even they have switched.

"As of Java 9, properties files switched from being loaded using ISO-8859-1."
Source

@pankratz76 pankratz76 changed the title rewise UnusedLocalVariable apply UnusedLocalVariable Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants