Skip to content

Fix unused assignment: the value changed at constructorArgNum++ is never used #35091

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

Pankraz76
Copy link

@Pankraz76 Pankraz76 commented Jun 21, 2025

  • Fix unused assignment: the value changed at constructorArgNum++ is never used
100% (1/1) 75% (3/4) 78% (54/69) 68% (26/38)
100% (1/1) 100% (4/4) 91% (63/69) 84% (32/38)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 21, 2025
@Pankraz76 Pankraz76 changed the title Fix the value changed at 'constructor arg num++' is never used Fix unused assignment: the value changed at 'constructorArgNum++' is never used Jun 21, 2025
@Pankraz76 Pankraz76 changed the title Fix unused assignment: the value changed at 'constructorArgNum++' is never used Fix unused assignment: the value changed at constructorArgNum++ is never used Jun 21, 2025
@Pankraz76 Pankraz76 force-pushed the fix-The-value-changed-at-'constructorArgNum++'-is-never-used- branch 2 times, most recently from d0cdf31 to 442f6cf Compare June 21, 2025 21:06
@Pankraz76 Pankraz76 marked this pull request as ready for review June 21, 2025 21:06
@Pankraz76
Copy link
Author

Pankraz76 commented Jun 21, 2025

please give me a change to improve QA, as dev team does not have resources to take care about quality in details.

im here to server the needs of spring.

@bclozel

its all related to toleration of chaos, instead of lead by example using proper tooling.

@Pankraz76 Pankraz76 closed this Jun 21, 2025
@Pankraz76

This comment was marked as off-topic.

@Pankraz76 Pankraz76 reopened this Jun 21, 2025
@bclozel bclozel added the in: core Issues in core modules (aop, beans, core, context, expression) label Jun 21, 2025
@Pankraz76
Copy link
Author

Pankraz76 commented Jun 22, 2025

build is not fixing whitespaces like maven or quarkus does.

Assuming its not configured properly to apply mentioned auto fix

How to fix these flaws, as not done with gradle clean build?

Dont want to spend time in whitespaces, thank you.

> Task :spring-context:checkstyleTest
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:1: File does not end with a newline. [NewlineAtEndOfFile]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:1: Line does not match expected header line of '^\Q/*\E$'. [SpringHeader]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:3:1: Illegal import - org.junit.jupiter.api.Test. [bannedJUnitJupiterImports]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:4:1: 'org.springframework.beans.factory.support.BeanDefinitionDefaults' should be separated from previous imports. [ImportOrder]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:6:1: Wrong order for 'org.w3c.dom.Element' import. [ImportOrder]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:8:1: 'org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder' should be separated from previous imports. [ImportOrder]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:14: Please use AssertJ assertions. [junitJupiterAssertions]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:14:1: Illegal import - org.junit.jupiter.api.Assertions.*. [bannedJUnitJupiterImports]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:14:47: Using the '.*' form of import should be avoided - org.junit.jupiter.api.Assertions.*. [AvoidStarImport]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:15:34: Using the '.*' form of import should be avoided - org.mockito.Mockito.*. [AvoidStarImport]
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:20:7: Class name 'ScriptBeanDefinitionParserTest' must not end with 'Test' (checked pattern '^[A-Z][a-zA-Z0-9_$]*(?<!Test)$'). [TypeName]

@Pankraz76
Copy link
Author

why not forbid import ? and migrate existing?

ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParserTest.java:17: Please use AssertJ assertions. [junitJupiterAssertions]

@Pankraz76 Pankraz76 force-pushed the fix-The-value-changed-at-'constructorArgNum++'-is-never-used- branch from 442f6cf to 2f9ad87 Compare June 22, 2025 09:39
@Pankraz76
Copy link
Author

Pankraz76 commented Jun 22, 2025

thanks for telling me its wrong, but how to fix this?

➜ spring-context git:(fix-The-value-changed-at-'constructorArgNum++'-is-never-used-) gis

Task :spring-context:checkstyleTest
[ant:checkstyle] [ERROR] /Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/src/test/java/org/springframework/scripting/config/ScriptBeanDefinitionParser2Tests.java:30:1: Wrong order for 'org.w3c.dom.Element' import. [ImportOrder]

Task :spring-context:checkstyleTest FAILED

[Incubating] Problems report is available at: file:///Users/vincent.potucek/IdeaProjects/spring-framework/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':spring-context:checkstyleTest'.

A failure occurred while executing org.gradle.api.plugins.quality.internal.CheckstyleAction
Checkstyle rule violations were found. See the report at: file:///Users/vincent.potucek/IdeaProjects/spring-framework/spring-context/build/reports/checkstyle/test.html
Checkstyle files with violations: 1
Checkstyle violations by severity: [error:1]

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.14.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 7s
55 actionable tasks: 1 executed, 54 up-to-date
➜ spring-context git:(fix-The-value-changed-at-'constructorArgNum++'-is-never-used-)

try and error very expensive

as its only 1 <importOrder> element to fix:

note, has to be like this:

import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionDefaults;
import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.beans.factory.xml.XmlReaderContext;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.DESTROY_METHOD_ATTRIBUTE;
import static org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.INIT_METHOD_ATTRIBUTE;
import static org.springframework.scripting.support.ScriptFactoryPostProcessor.PROXY_TARGET_CLASS_ATTRIBUTE;

@Pankraz76 Pankraz76 force-pushed the fix-The-value-changed-at-'constructorArgNum++'-is-never-used- branch 3 times, most recently from 7300084 to bcaa1d8 Compare June 22, 2025 10:35
…ver used

Signed-off-by: Vincent Potucek <vpotucek@me.com>
@Pankraz76 Pankraz76 force-pushed the fix-The-value-changed-at-'constructorArgNum++'-is-never-used- branch from bcaa1d8 to 78ae3d3 Compare June 22, 2025 10:37
Copy link
Author

@Pankraz76 Pankraz76 left a comment

Choose a reason for hiding this comment

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

kindly request some feedback.

@sbrannen sbrannen marked this pull request as draft June 22, 2025 10:41
@bclozel bclozel closed this Jun 22, 2025
@bclozel bclozel added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 22, 2025
@bclozel
Copy link
Member

bclozel commented Jun 22, 2025

Unless you have found an issue while writing a Spring application, I don't think we should invest time in this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants