Skip to main content

Find uses of deprecated classes, methods, and fields

org.openrewrite.java.search.FindDeprecatedUses

Find deprecated uses of methods, fields, and types. Optionally ignore those classes that are inside deprecated scopes.

Recipe source

GitHub: FindDeprecatedUses.java, Issue Tracker, Maven Central

info

This recipe is composed of more than one recipe. If you want to customize the set of recipes this is composed of, you can find and copy the GitHub source for the recipe from the link above.

This recipe is available under the Apache License Version 2.0.

Options

TypeNameDescriptionExample
StringtypePatternOptional. A type pattern that is used to find deprecations from certain types.org.springframework..*
BooleanmatchInheritedOptional. When enabled, find types that inherit from a deprecated type.
BooleanignoreDeprecatedScopesOptional. When a deprecated type is used in a deprecated method or class, ignore it.

Definition

Used by

This recipe is used as part of the following composite recipes:

Usage

This recipe has no required configuration parameters and comes from a rewrite core library. It can be activated directly without adding any dependencies.

  1. Add the following to your build.gradle file:
    build.gradle
    plugins {
    id("org.openrewrite.rewrite") version("latest.release")
    }

    rewrite {
    activeRecipe("org.openrewrite.java.search.FindDeprecatedUses")
    setExportDatatables(true)
    }

    repositories {
    mavenCentral()
    }
  2. Run gradle rewriteRun to run the recipe.

See how this recipe works across multiple open-source repositories

Run this recipe on OSS repos at scale with the Moderne SaaS.

The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.

Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.

Data Tables

Method calls

org.openrewrite.java.table.MethodCalls

The text of matching method invocations.

Column NameDescription
Source fileThe source file that the method call occurred in.
Method callThe text of the method call.
Class nameThe class name of the method call.
Method nameThe method name of the method call.
Argument typesThe argument types of the method call.