Skip to content

Polish Java recipe display names and descriptions (K7 of #1330) - #1359

Merged
timtebeek merged 10 commits into
mainfrom
tim/k7-java-display-names
Oct 25, 2026
Merged

timtebeek merged 10 commits into
mainfrom
tim/k7-java-display-names

Conversation

@timtebeek

Copy link
Copy Markdown
Member

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:

  • Typos: @Slf4 for @Slf4j, "lombok", "inSecurityManager", the garbled RemoveFinalizerFromZip texts, the stray quote after @Inject, "It is Replaced", embedded \n in AddColumnAnnotation, EnumSet of(..), List.Of(..)/Set.Of(..), doubled spaces, and the made-up Optional#or(Supplier<T extends java.util.Optional<T>>) signature (now Supplier<? extends Optional<? extends T>>, also closing a missing backtick).
  • Sentence case and verb-first: the listed sites, including the OpenJPA/EclipseLink javax recipes that were titled as rules, e.g. "@Entity objects with constructors must also have a default constructor" is now "Add a default constructor to @Entity and @MappedSuperclass classes". Also the three NoGuavaRefaster checkNotNull templates.
  • Backticks: the listed sites, plus a few more such as SimplifySecurityManagerThreadGroup, UpgradeDockerImageVersion image names and ReplaceMathRandomWithThreadLocalRandom.
  • Inaccurate texts, checked against each recipe's code: AddJaxbRuntime adds runtimeOnly/runtime dependencies, not compileOnly/provided. ApplicationPathWildcardNoLongerAccepted strips /*, not a slash. RemoveBeanIsNullable no longer contradicts itself. UpdateGetRealPath calls getServletContext(), not getContext(). OptionalStreamRecipe is gated on Java 9, not 11. ThreadStopUnsupported also adds its comment on older Java versions. The StringFormatted option and UseVarForGenericMethodInvocations texts are rewritten too.
  • Option metadata: distinct display names and descriptions for the seven ReplaceComSunAWTUtilitiesMethods and two ReplaceLocalizedStreamMethods options, a display name for AboutJavaVersion.whenUsesType, and labels instead of questions for the UseTextBlocks and Guava convertReturnType options.
  • UpdateAnnotationAttributeJavaxToJakarta: signature was required = false but a missing value threw a NullPointerException in AnnotationMatcher. All three YAML usages pass a signature, so it is now required. The example now uses @jakarta.jms..* to match those usages.
  • recipes.csv regenerated with ./gradlew rCG.

Skipped: the java.lang.Char typo, which is tracked as E4. HttpSessionInvalidate no longer says "Add" and already has backticks, so it is unchanged. The new NoMapsAndSetsWithExpectedSize description matches what the recipe does today: it emits constructors such as new HashMap<>(n). E6 tracks switching to HashMap.newHashMap(n), and the description needs another update when that lands.

Verified with ./gradlew test on the test classes for every touched recipe, plus the Guava, Lombok, JakartaEE10 and UpdateAnnotationAttributeJavaxToJakarta tests. 130 test classes, 1052 tests: 0 failures, 9 skipped. No test asserts on display names or descriptions.

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.
…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
@timtebeek
timtebeek merged commit 91443e8 into main Oct 25, 2026
2 checks passed
@timtebeek
timtebeek deleted the tim/k7-java-display-names branch October 25, 2026 12:56
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant