Repository navigation
Polish Java recipe display names and descriptions (K7 of #1330) - #1359
Merged
Merged
Conversation
Covers `@Slf4` for `@Slf4j`, a stray quote after `@Inject`, embedded newlines in `AddColumnAnnotation`, `EnumSet of(..)`, `List.Of(..)`, an unclosed backtick and made-up `Optional#or` signature, garbled `RemoveFinalizerFromZip` text and doubled spaces.
Display names now start with the action the recipe takes, rather than stating a rule such as "`@Entity` objects with constructors must also have a default constructor", and only capitalize proper nouns and product names such as SDKMAN!.
Method calls, types, file names, Maven plugins and Docker images in display names and descriptions now render as code, as elsewhere.
`AddJaxbRuntime` adds the runtime in `runtimeOnly`/`runtime` scope rather than `compileOnly`/`provided`, `ApplicationPathWildcardNoLongerAccepted` strips `/*` rather than a slash, `NoMapsAndSetsWithExpectedSize` emits constructors, `OptionalStreamRecipe` is gated on Java 9, and `ThreadStopUnsupported` also comments on older Java versions.
The seven `ReplaceComSunAWTUtilitiesMethods` and two `ReplaceLocalizedStreamMethods` options each shared one display name and description, and `AboutJavaVersion.whenUsesType` had no display name. Option display names that were phrased as questions or carried their default value now read as short labels, and descriptions end in a period.
…uired The option was declared optional, but a missing signature failed with a `NullPointerException` when building the `AnnotationMatcher`. Every declarative use passes a signature, so require it instead.
22 of 72 tasks
…ames-v1 # Conflicts: # src/main/java/org/openrewrite/java/migrate/UpgradeDockerImageVersion.java # src/main/resources/META-INF/rewrite/recipes.csv
…ames-v1 # Conflicts: # src/main/resources/META-INF/rewrite/recipes.csv
…ames-v1 # Conflicts: # src/main/java/org/openrewrite/java/migrate/javax/AddTableGenerator.java # src/main/resources/META-INF/rewrite/recipes.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recipe display names and descriptions are what users see in the marketplace and docs, and several of the Java recipes had typos, rule-style titles, unformatted identifiers or texts that no longer matched what the recipe does. This brings them in line with the OpenRewrite conventions: sentence case, verb-first display names without a trailing period, full-sentence descriptions, and code in backticks. Addresses K7 of #1330.
Changes, one commit per concern:
@Slf4for@Slf4j, "lombok", "inSecurityManager", the garbledRemoveFinalizerFromZiptexts, the stray quote after@Inject, "It is Replaced", embedded\ninAddColumnAnnotation,EnumSet of(..),List.Of(..)/Set.Of(..), doubled spaces, and the made-upOptional#or(Supplier<T extends java.util.Optional<T>>)signature (nowSupplier<? extends Optional<? extends T>>, also closing a missing backtick).javaxrecipes that were titled as rules, e.g. "@Entityobjects with constructors must also have a default constructor" is now "Add a default constructor to@Entityand@MappedSuperclassclasses". Also the threeNoGuavaRefastercheckNotNulltemplates.SimplifySecurityManagerThreadGroup,UpgradeDockerImageVersionimage names andReplaceMathRandomWithThreadLocalRandom.AddJaxbRuntimeaddsruntimeOnly/runtimedependencies, notcompileOnly/provided.ApplicationPathWildcardNoLongerAcceptedstrips/*, not a slash.RemoveBeanIsNullableno longer contradicts itself.UpdateGetRealPathcallsgetServletContext(), notgetContext().OptionalStreamRecipeis gated on Java 9, not 11.ThreadStopUnsupportedalso adds its comment on older Java versions. TheStringFormattedoption andUseVarForGenericMethodInvocationstexts are rewritten too.ReplaceComSunAWTUtilitiesMethodsand twoReplaceLocalizedStreamMethodsoptions, a display name forAboutJavaVersion.whenUsesType, and labels instead of questions for theUseTextBlocksand GuavaconvertReturnTypeoptions.UpdateAnnotationAttributeJavaxToJakarta:signaturewasrequired = falsebut a missing value threw aNullPointerExceptioninAnnotationMatcher. All three YAML usages pass a signature, so it is now required. The example now uses@jakarta.jms..*to match those usages.recipes.csvregenerated with./gradlew rCG.Skipped: the
java.lang.Chartypo, which is tracked as E4.HttpSessionInvalidateno longer says "Add" and already has backticks, so it is unchanged. The newNoMapsAndSetsWithExpectedSizedescription matches what the recipe does today: it emits constructors such asnew HashMap<>(n). E6 tracks switching toHashMap.newHashMap(n), and the description needs another update when that lands.Verified with
./gradlew teston the test classes for every touched recipe, plus the Guava, Lombok,JakartaEE10andUpdateAnnotationAttributeJavaxToJakartatests. 130 test classes, 1052 tests: 0 failures, 9 skipped. No test asserts on display names or descriptions.