META-INF.rewrite.java-best-practices.yml Maven / Gradle / Ivy
Show all versions of rewrite-static-analysis Show documentation
#
# Copyright 2024 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.
#
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.staticanalysis.JavaApiBestPractices
displayName: Java API best practices
description: Use the Java standard library in a way that is most idiomatic.
recipeList:
- org.openrewrite.staticanalysis.UseMapContainsKey
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.staticanalysis.UseMapContainsKey
displayName: Use `Map#containsKey`
description: '`map.keySet().contains(a)` can be simplified to `map.containsKey(a)`.'
recipeList:
- org.openrewrite.java.SimplifyMethodChain:
methodPatternChain:
- 'java.util.Map keySet()'
- 'java.util.Set contains(..)'
newMethodName: containsKey
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.staticanalysis.ReplaceApacheCommonsLang3ValidateNotNullWithObjectsRequireNonNull
displayName: Replace `org.apache.commons.lang3.Validate#notNull` with `Objects#requireNonNull`
description: 'Replace `org.apache.commons.lang3.Validate.notNull(..)` with `Objects.requireNonNull(..)`.'
recipeList:
- org.openrewrite.staticanalysis.ReplaceValidateNotNullHavingSingleArgWithObjectsRequireNonNull
- org.openrewrite.staticanalysis.ReplaceValidateNotNullHavingVarargsWithObjectsRequireNonNull
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.staticanalysis.ReplaceValidateNotNullHavingSingleArgWithObjectsRequireNonNull
displayName: Replace `org.apache.commons.lang3.Validate#notNull` with `Objects#requireNonNull`
description: 'Replace `org.apache.commons.lang3.Validate.notNull(Object)` with `Objects.requireNonNull(Object)`.'
recipeList:
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.apache.commons.lang3.Validate notNull(Object)
newMethodName: requireNonNull
- org.openrewrite.java.ChangeMethodTargetToStatic:
methodPattern: org.apache.commons.lang3.Validate requireNonNull(Object)
fullyQualifiedTargetTypeName: java.util.Objects