diff --git a/.run/InlineMethodCallsRecipeGenerator.run.xml b/.run/InlineMethodCallsRecipeGenerator.run.xml deleted file mode 100644 index 3a0df113..00000000 --- a/.run/InlineMethodCallsRecipeGenerator.run.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/build.gradle.kts b/build.gradle.kts index 5bf2837c..93a5594b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,6 +31,7 @@ dependencies { implementation("org.openrewrite:rewrite-xml") implementation("org.openrewrite.recipe:rewrite-java-dependencies:${rewriteVersion}") implementation("org.openrewrite.recipe:rewrite-static-analysis:${rewriteVersion}") + implementation("org.openrewrite.recipe:rewrite-third-party:${rewriteVersion}") runtimeOnly("org.openrewrite:rewrite-java-21") compileOnly("org.apache.logging.log4j:log4j-core:2.+") diff --git a/src/main/resources/META-INF/rewrite/inline-logging-methods.yml b/src/main/resources/META-INF/rewrite/inline-logging-methods.yml deleted file mode 100644 index b0e89d0e..00000000 --- a/src/main/resources/META-INF/rewrite/inline-logging-methods.yml +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2025 the original author or authors. -#

-# Licensed under the Moderne Source Available License (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -#

-# https://docs.moderne.io/licensing/moderne-source-available-license -#

-# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated InlineMe recipes from TypeTable -# - -type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.java.logging.log4j.InlineMethods -displayName: Inline methods annotated with `@InlineMe` -description: >- - Automatically generated recipes to inline method calls based on `@InlineMe` annotations - discovered in the type table. -recipeList: - - # From org.apache.logging.log4j:log4j-api:2.25.2 - - org.openrewrite.java.InlineMethodCalls: - methodPattern: 'org.apache.logging.log4j.message.StructuredDataId StructuredDataId(java.lang.String, int, java.lang.String[], java.lang.String[])' - replacement: 'this(name, String.valueOf(enterpriseNumber), required, optional)' - classpathFromResources: - - 'log4j-api-2.25.2' - - org.openrewrite.java.InlineMethodCalls: - methodPattern: 'org.apache.logging.log4j.message.StructuredDataId StructuredDataId(java.lang.String, int, java.lang.String[], java.lang.String[], int)' - replacement: 'this(name, String.valueOf(enterpriseNumber), required, optional, maxLength)' - classpathFromResources: - - 'log4j-api-2.25.2' - - org.openrewrite.java.InlineMethodCalls: - methodPattern: 'org.apache.logging.log4j.message.StructuredDataId makeId(java.lang.String, int)' - replacement: 'this.makeId(defaultId, String.valueOf(anEnterpriseNumber))' - classpathFromResources: - - 'log4j-api-2.25.2' - - org.openrewrite.java.InlineMethodCalls: - methodPattern: 'org.apache.logging.log4j.message.ParameterizedMessage ParameterizedMessage(java.lang.String, java.lang.String[], java.lang.Throwable)' - replacement: 'this(pattern, Arrays.stream(args).toArray(Object[]::new), throwable)' - imports: - - 'java.util.Arrays' - classpathFromResources: - - 'log4j-api-2.25.2' - - org.openrewrite.java.InlineMethodCalls: - methodPattern: 'org.apache.logging.log4j.MarkerManager getMarker(java.lang.String, org.apache.logging.log4j.Marker)' - replacement: 'MarkerManager.getMarker(name).addParents(parent)' - imports: - - 'org.apache.logging.log4j.MarkerManager' - classpathFromResources: - - 'log4j-api-2.25.2' diff --git a/src/main/resources/META-INF/rewrite/log4j.yml b/src/main/resources/META-INF/rewrite/log4j.yml index 03931bd6..47f00f89 100644 --- a/src/main/resources/META-INF/rewrite/log4j.yml +++ b/src/main/resources/META-INF/rewrite/log4j.yml @@ -137,7 +137,7 @@ recipeList: newArtifactId: log4j-slf4j-impl newVersion: 2.x - org.openrewrite.java.logging.log4j.UpgradeLog4J2DependencyVersion - - org.openrewrite.java.logging.log4j.InlineMethods + - org.apache.logging.log4j.InlineLog4jApiMethods --- type: specs.openrewrite.org/v1beta/recipe