-
Notifications
You must be signed in to change notification settings - Fork 92
Closed as duplicate of#446
Closed as duplicate of#446
Copy link
Labels
Description
CodeCleanup breaking spaces in as keyword as Matcher -> asMatcher
What version of OpenRewrite are you using?
EDIT by @greg-at-moderne - removed mentioned version numbers as they were likely copy&paste and therefore misleading.
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>6.12.1</version>
<configuration>
<exclusions>
<exclusion>**AbstractJavaRule.java</exclusion>
<exclusion>**AbstractPLSQLRule.java</exclusion>
<exclusion>**Chars.java</exclusion> <!-- // @SuppressWarnings("PMD.MissingOverride") -->
<exclusion>**DesignerCommand.java</exclusion>
<exclusion>**MatchAlgorithm.java</exclusion>
<exclusion>**PmdRootCommand.java</exclusion>
<exclusion>**TypeScriptLexerBase.java</exclusion>
<exclusion>**TypeSystem.java</exclusion>
<exclusion>**generated-sources**</exclusion>
<exclusion>**jdkversiontests/java21/Jep**.java</exclusion> <!-- https://github.com/openrewrite/rewrite/issues/5302 -->
<exclusion>**jdkversiontests/java24p/Jep**.java</exclusion>
<exclusion>**testdata**</exclusion>
</exclusions>
<activeRecipes>
<!-- <recipe>org.openrewrite.java.RemoveUnusedImports</recipe>-->
<!--<!– <recipe>org.openrewrite.java.format.BlankLines</recipe>–>-->
<!-- <recipe>org.openrewrite.staticanalysis.EqualsAvoidsNull</recipe>-->
<!-- <recipe>org.openrewrite.staticanalysis.MissingOverrideAnnotation</recipe>-->
<!-- <recipe>org.openrewrite.staticanalysis.ModifierOrder</recipe>-->
<!-- <recipe>org.openrewrite.staticanalysis.RedundantFileCreation</recipe>-->
<!-- <recipe>org.openrewrite.staticanalysis.StringLiteralEquality</recipe>-->
<recipe>org.openrewrite.text.EndOfLineAtEndOfFile</recipe>
<!--<!– <recipe>org.openrewrite.java.migrate.UpgradeToJava17</recipe>–>-->
<!--<!– <recipe>org.openrewrite.java.migrate.UpgradeToJava21</recipe>–>-->
<!--<!– <recipe>org.openrewrite.java.testing.assertj.Assertj</recipe>–>-->
<!--<!– <recipe>org.openrewrite.java.testing.cleanup.AssertTrueNullToAssertNull</recipe>–>-->
<!--<!– <recipe>org.openrewrite.java.testing.cleanup.TestsShouldNotBePublic</recipe>–>-->
<!--<!– <recipe>org.openrewrite.java.testing.junit5.JUnit5BestPractices</recipe>–>-->
<!--<!– <recipe>org.openrewrite.maven.OrderPomElements</recipe>–>-->
<recipe>org.openrewrite.staticanalysis.CodeCleanup</recipe>
<!-- <recipe>org.openrewrite.staticanalysis.CommonStaticAnalysis</recipe>-->
<!-- <recipe>org.openrewrite.staticanalysis.FinalizeLocalVariables</recipe>-->
<!-- <recipe>org.openrewrite.staticanalysis.RemoveUnusedLocalVariables</recipe>-->
<!-- <recipe>org.openrewrite.staticanalysis.RemoveUnusedPrivateFields</recipe>-->
<!-- <recipe>org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods</recipe>-->
</activeRecipes>
<failOnDryRunResults>true</failOnDryRunResults>
<checkstyleConfigFile>.rewrite/pmd-checkstyle-config.xml</checkstyleConfigFile>
<rewriteSkip>${rewrite.skip}</rewriteSkip>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>dryRun</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-static-analysis</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>
</plugin>What is the smallest, simplest way to reproduce the problem?
infix fun <N, V : N> KCallable<N>.shouldEqual(expected: V?) =
assertWrapper(this, expected) { n, v ->
// using shouldBe would perform numeric conversion
// eg (3.0 shouldBe 3L) passes, even though (3.0 != 3L)
// equalityMatcher doesn't do this conversion
n.should(equalityMatcher(v) as Matcher<N>)
}What did you expect to see?
infix fun <N, V : N> KCallable<N>.shouldEqual(expected: V?) =
assertWrapper(this, expected) { n, v ->
// using shouldBe would perform numeric conversion
// eg (3.0 shouldBe 3L) passes, even though (3.0 != 3L)
// equalityMatcher doesn't do this conversion
n.should(equalityMatcher(v) as Matcher<N>)
}What did you see instead?
infix fun <N, V : N> KCallable<N>.shouldEqual(expected: V?) =
assertWrapper(this, expected) { n, v ->
// using shouldBe would perform numeric conversion
// eg (3.0 shouldBe 3L) passes, even though (3.0 != 3L)
// equalityMatcher doesn't do this conversion
n.should( equalityMatcher(v) asMatcher<N>)
}What is the full stack trace of any errors you encountered?
stacktrace output here
Are you interested in contributing a fix to OpenRewrite?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done