[java] Update rule UnnecessaryWrapperObjectCreation#3418
Conversation
Replaced by UnnecessaryBoxing
Generated by 🚫 Danger |
|
Thanks! Maybe if we do the "staged release" of pmd 7 we talked about, then we could remove it in pmd 7.1.0? Like other |
|
So, with #3365 we actually deprecated the rule UnnecessaryWrapperObjectCreation with PMD 6.37.0 without replacement. So we can actually delete it in PMD 7... |
Before deleting it, we should make sure, that we somewhere cover this case. |
I think it should be part of UnnecessaryBoxing |
|
So 85e9bfa ensures that UnnecessaryBoxing catches the string cases. So I'm going to merge this to open the pr removing deprecated rules, which includes this one |
Describe the PR
Updates the rule UnnecessaryWrapperObjectCreation. I've removed the check for the java version, as this looked wrong: Boolean.valueOf has been introduced with java 1.4, and all other *.valueOf method with java 1.5. So actually, this rule should have a minimum language version of 1.5, but I guess, that doesn't matter anymore.
The rule is also directly deprecated, as the new UnnecessaryBoxing replaces it.
The only useful check of this rule is this:
Integer.valueOf(1).toString()- calls to "toString()", where one should simply useString.valueOf(1)instead orInteger.toString(1).Related issues
Ready?
./mvnw clean verifypasses (checked automatically by github actions)