-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
remove UnusedLocalVariable
#34489
base: main
Are you sure you want to change the base?
remove UnusedLocalVariable
#34489
Conversation
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.
question
integration-tests/src/test/java/org/springframework/aot/test/SampleReflection.java
Outdated
Show resolved
Hide resolved
@@ -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 |
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.
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
520a35a
to
6a96950
Compare
String value = "Sample"; | ||
Method[] methods = String.class.getMethods(); | ||
methods = Integer.class.getMethods(); | ||
String.class.getMethods(); |
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.
not sure if the test is still working as expected, as I could not execute it locally.
6a96950
to
eb3f8cc
Compare
.editorconfig
Outdated
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space |
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.
is the intend space for all others as it was only specified on an explicit set?
indent_style = space | |
indent_style = tab |
src/checkstyle/checkstyle.xml
Outdated
|
||
<!-- Imports --> | ||
<module name="AvoidStarImport"/> | ||
<module name="UnusedImports"/> <!-- review: needs to be explicit activated --> |
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.
needs to be explicit activated, so the root configuration does not seem to work.
@@ -7145,8 +7145,7 @@ public TestClass9(int i) { | |||
static class HttpServlet3RequestFactory { | |||
|
|||
static Servlet3SecurityContextHolderAwareRequestWrapper getOne() { | |||
HttpServlet3RequestFactory outer = new HttpServlet3RequestFactory(); | |||
return outer.new Servlet3SecurityContextHolderAwareRequestWrapper(); |
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.
possible false positive on UnusedLocalVariable checkstyle/checkstyle#16419
4c99d76
to
c0b35a2
Compare
Signed-off-by: Vincent Potucek <[email protected]>
c0b35a2
to
13bcd56
Compare
@SuppressWarnings("unused") | ||
String result2 = this.restTemplate.getForObject("/number", String.class); | ||
// result == "2" | ||
assertThat(this.restTemplate.getForObject("/number", String.class)).isEqualTo("1"); |
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.
this is some real benefit, imho. Testing the real assertion rather commenting about it
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.