Skip to content

Commit 91443e8

Browse files
authored
Polish Java recipe display names and descriptions (K7 of #1330) (#1359)
* Fix typos in recipe display names and 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. * Use sentence case and verb-first recipe display names 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!. * Wrap code identifiers in recipe texts in backticks Method calls, types, file names, Maven plugins and Docker images in display names and descriptions now render as code, as elsewhere. * Correct recipe descriptions that misstate what the recipe does `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. * Give recipe options distinct, sentence-case display names 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. * Make `UpdateAnnotationAttributeJavaxToJakarta` `signature` option required 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. * Regenerate `recipes.csv`
1 parent 4c56260 commit 91443e8

69 files changed

Lines changed: 221 additions & 208 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/main/java/org/openrewrite/java/migrate/AddJDeprScanPlugin.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
@RequiredArgsConstructor
3131
public class AddJDeprScanPlugin extends Recipe {
3232

33-
@Option(displayName = "release", description = "Specifies the Java SE release that provides the set of deprecated APIs for scanning.", required = false, example = "11")
33+
@Option(displayName = "Release", description = "Specifies the Java SE release that provides the set of deprecated APIs for scanning.", required = false, example = "11")
3434
private final String release;
3535

3636
@Getter
37-
final String displayName = "Add `JDeprScan` Maven Plug-in";
37+
final String displayName = "Add `JDeprScan` Maven plugin";
3838

3939
@Getter
4040
final String description = "Add the `JDeprScan` Maven plugin to scan class files for uses of deprecated APIs.";

‎src/main/java/org/openrewrite/java/migrate/AddMissingMethodImplementation.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,23 @@
3636
public class AddMissingMethodImplementation extends Recipe {
3737

3838
@Option(displayName = "Fully qualified class name",
39-
description = "A fully qualified class being implemented with missing method.",
39+
description = "The fully qualified name of the interface whose method may be missing from its implementations.",
4040
example = "com.yourorg.FooBar")
4141
String fullyQualifiedClassName;
4242

4343
@Option(displayName = "Method pattern",
44-
description = "A method pattern for matching required method definition.",
44+
description = "A method pattern matching the required method declaration.",
4545
example = "*..* hello(..)")
4646
String methodPattern;
4747

4848
@Option(displayName = "Method template",
49-
description = "Template of method to add",
49+
description = "Template of the method to add.",
5050
example = "public String hello() { return \\\"Hello from #{}!\\\"; }")
5151
String methodTemplateString;
5252

53-
String displayName = "Adds missing method implementations";
53+
String displayName = "Add missing method implementations";
5454

55-
String description = "Check for missing methods required by interfaces and adds them.";
55+
String description = "Add a method to classes that implement the given interface but are missing the method.";
5656

5757
@Override
5858
public TreeVisitor<?, ExecutionContext> getVisitor() {

‎src/main/java/org/openrewrite/java/migrate/AddMockitoJavaAgentToMavenSurefirePlugin.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class AddMockitoJavaAgentToMavenSurefirePlugin extends Recipe {
6161
private static final String CONFIGURATION_TAG_TEMPLATE = "<configuration>\n<!--suppress MavenModelInspection --><argLine>%s</argLine></configuration>";
6262

6363
@Getter
64-
final String displayName = "Add Mockito Java Agent to Maven Surefire Plugin";
64+
final String displayName = "Add Mockito Java agent to Maven Surefire plugin";
6565

6666
@Getter
6767
final String description = "Mockito attaches its Byte Buddy agent to the running JVM at test time, which the JDK has " +

‎src/main/java/org/openrewrite/java/migrate/AddStaticVariableOnProducerSessionBean.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class AddStaticVariableOnProducerSessionBean extends ScanningRecipe<Set<S
3838
private static final XPathMatcher EJB_PATH = new XPathMatcher("ejb-jar/enterprise-beans/session");
3939

4040
@Getter
41-
final String displayName = "Adds `static` modifier to `@Produces` fields that are in session beans";
41+
final String displayName = "Add `static` modifier to `@Produces` fields in session beans";
4242

4343
@Getter
4444
final String description = "Ensures that the fields annotated with `@Produces` which is inside the session bean (`@Stateless`, `@Stateful`, or `@Singleton`) are declared `static`.";

‎src/main/java/org/openrewrite/java/migrate/AddSuppressionForIllegalReflectionWarningsPlugin.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public class AddSuppressionForIllegalReflectionWarningsPlugin extends Recipe {
4141
private final String version;
4242

4343
@Getter
44-
final String displayName = "Add maven jar plugin to suppress illegal reflection warnings";
44+
final String displayName = "Add `maven-jar-plugin` to suppress illegal reflection warnings";
4545

4646
@Getter
47-
final String description = "Adds a maven jar plugin that's configured to suppress Illegal Reflection Warnings.";
47+
final String description = "Adds a `maven-jar-plugin` with `Add-Opens` manifest entries to `war` and `ear` modules to suppress illegal reflection warnings.";
4848

4949
@Override
5050
public TreeVisitor<?, ExecutionContext> getVisitor() {

‎src/main/java/org/openrewrite/java/migrate/AddSurefireFailsafeArgLine.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636
public class AddSurefireFailsafeArgLine extends Recipe {
3737

3838
@Option(displayName = "Arg line",
39-
description = "The arguments to add to the surefire and failsafe plugin `argLine` configuration. " +
40-
"Individual arguments are space-separated. Arguments already present in the existing argLine are not duplicated.",
39+
description = "The arguments to add to the Maven Surefire and Failsafe plugin `argLine` configuration. " +
40+
"Individual arguments are space-separated. Arguments already present in the existing `argLine` are not duplicated.",
4141
example = "--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED")
4242
String argLine;
4343

44-
String displayName = "Add `argLine` to surefire and failsafe plugins";
44+
String displayName = "Add `argLine` to Maven Surefire and Failsafe plugins";
4545

4646
String description = "Adds the specified arguments to the `argLine` configuration of the Maven Surefire and Failsafe plugins, " +
47-
"merging with any existing argLine value without duplicating arguments. " +
47+
"merging with any existing `argLine` value without duplicating arguments. " +
4848
"The `@{argLine}` [late property reference](https://maven.apache.org/surefire/maven-surefire-plugin/faq.html) is prepended " +
4949
"so that an agent injected by another plugin during the build, such as the JaCoCo coverage agent from " +
5050
"`jacoco-maven-plugin:prepare-agent`, is preserved rather than overwritten. It is not added when the existing " +

‎src/main/java/org/openrewrite/java/migrate/BeanDiscovery.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public class BeanDiscovery extends Recipe {
3535
private static final XPathMatcher BEANS_MATCHER = new XPathMatcher("/beans");
3636
private static final Pattern VERSION_PATTERN = Pattern.compile("_([^\\/\\.]+)\\.xsd");
3737

38-
String displayName = "Behavior change to bean discovery in modules with `beans.xml` file with no version specified";
38+
String displayName = "Add `version` and `bean-discovery-mode` to `beans.xml` files without a version";
3939

40-
String description = "Alters beans with missing version attribute to include this attribute as well as the bean-discovery-mode=\"all\" attribute to maintain an explicit bean archive.";
40+
String description = "Alters `beans.xml` files with a missing `version` attribute to include this attribute as well as `bean-discovery-mode=\"all\"`, to maintain an explicit bean archive.";
4141

4242
@Override
4343
public TreeVisitor<?, ExecutionContext> getVisitor() {

‎src/main/java/org/openrewrite/java/migrate/ChangeDefaultKeyStore.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ public class ChangeDefaultKeyStore extends Recipe {
3535
private static final MethodMatcher KEYSTORE_METHOD_REF = new MethodMatcher("java.security.KeyStore getDefaultType()");
3636

3737
@Getter
38-
final String displayName = "Return String `jks` when `KeyStore.getDefaultType()` is called";
38+
final String displayName = "Replace `KeyStore.getDefaultType()` with `\"jks\"`";
3939

4040
@Getter
4141
final String description = "In Java 11 the default keystore was updated from JKS to PKCS12. " +
42-
"As a result, applications relying on KeyStore.getDefaultType() may encounter issues after migrating, " +
42+
"As a result, applications relying on `KeyStore.getDefaultType()` may encounter issues after migrating, " +
4343
"unless their JKS keystore has been converted to PKCS12. " +
4444
"This recipe returns default key store of `jks` when `KeyStore.getDefaultType()` method is called to " +
4545
"use the pre Java 11 default keystore.";

‎src/main/java/org/openrewrite/java/migrate/IllegalArgumentExceptionToAlreadyConnectedException.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class IllegalArgumentExceptionToAlreadyConnectedException extends Recipe
3838
final String displayName = "Replace `IllegalArgumentException` with `AlreadyConnectedException` in `DatagramChannel.send()` method";
3939

4040
@Getter
41-
final String description = "Replace `IllegalArgumentException` with `AlreadyConnectedException` for DatagramChannel.send() to ensure compatibility with Java 11+.";
41+
final String description = "Replace `IllegalArgumentException` with `AlreadyConnectedException` for `DatagramChannel.send()` to ensure compatibility with Java 11+.";
4242

4343
@Override
4444
public TreeVisitor<?, ExecutionContext> getVisitor() {

‎src/main/java/org/openrewrite/java/migrate/JREThrowableFinalMethods.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ public JREThrowableFinalMethods(
6363
final String displayName = "Rename final method declarations `getSuppressed()` and `addSuppressed(Throwable exception)` in classes that extend `Throwable`";
6464

6565
@Getter
66-
final String description = "The recipe renames `getSuppressed()` and `addSuppressed(Throwable exception)` methods in classes " +
66+
final String description = "The recipe renames `getSuppressed()` and `addSuppressed(Throwable exception)` methods in classes " +
6767
"that extend `java.lang.Throwable` to `myGetSuppressed` and `myAddSuppressed(Throwable)`. " +
68-
"These methods were added to Throwable in Java 7 and are marked final which cannot be overridden.";
68+
"These methods were added to `Throwable` in Java 7 and are marked final which cannot be overridden.";
6969

7070
@Override
7171
public TreeVisitor<?, ExecutionContext> getVisitor() {

0 commit comments

Comments
 (0)