- Introduction to OpenRewrite
- Running Recipes
- Quickstart: Setting up your project and running recipes
- Running Rewrite on a Gradle project without modifying the build
- Running Rewrite on a Maven project without modifying the build
- Running Rewrite without build tool plugins
- Popular recipe guides
- Common static analysis issue remediation
- Automatically fix Checkstyle violations
- Migrate to Java 17
- Migrate to JUnit 5 from JUnit 4
- Migrate to Spring Boot 3 from Spring Boot 2
- Migrate to Spring Boot 2 from Spring Boot 1
- Migrate to Quarkus 2 from Quarkus 1
- Migrate to Micronaut 3 from Micronaut 2
- Migrate to SLF4J from Log4J
- Use SLF4J parameterized logging
- Refactoring with declarative YAML recipes
- Automating Maven dependency management
- Authoring Recipes
- Recipe catalog
- Kotlin
- Python
- Analysis
- CircleCI
- Cloud suitability analyzer
- Find EJB message-driven beans (MDBs)
- Find EJB stateful beans
- Find EJB stateless beans
- Find JMS files
- Find code unsuitable for the cloud
- Find java key store files
- Find remote method invocations
- Find unhandled TERM signals
- Find use of JAX-RS
- Find use of JavaFX
- Find uses of JCA
- Find uses of JCache
- Find uses of JNI
- Find uses of Java file IO
- Find uses of Jersey
- Find uses of Jetty
- Find uses of file:// scheme in string literals
- Find uses of hardcoded IP addresses
- Uses of CORBA
- Uses of JNDI
- Uses of Java Batch annotations
- Uses of caches
- Uses of distributed caches
- Uses of ehcache
- Concourse
- Cucumber
- Jvm
- Cucumber to JUnit Test Suites
- Cucumber-Java8 migration to Cucumber-Java
- Drop SummaryPrinter
- Replace @Cucumber with @Suite
- Replace Cucumber-Java step definition regexes with Cucumber expressions
- Replace Cucumber-Java8 hook definition with Cucumber-Java
- Replace Cucumber-Java8 step definitions with Cucumber-Java
- Upgrade to Cucumber-JVM 2.x
- Upgrade to Cucumber-JVM 5.x
- Upgrade to Cucumber-JVM 7.x
- Jvm
- GitHub Actions
- Add cron workflow trigger
- Add manual workflow trigger
- Cancel in-progress workflow when it is triggered again
- Change dependabot schedule interval
- Check for github-actions updates daily
- Check for github-actions updates weekly
- Remove all cron triggers
- Replace runners for a job
- Setup Java dependency caching
- Upgrade actions/setup-java java-version
- Use actions/setup-java IBM semeru distribution
- Use actions/setup-java temurin distribution
- Use actions/setup-java temurin distribution as they are cached in hosted runners
- Hibernate
- Java
- Add ASLv2 license header
- Add imports for fully qualified references to types
- Add license header
- Add or update annotation attribute
- Change method access level
- Change method name
- Change method target to static
- Change method target to variable
- Change static field access to static method access
- Change type
- Delete method argument
- Demonstrate rendering of Markup markers
- Order imports
- Randomize tree IDs
- Remove annotation
- Remove interface implementations
- Remove static import
- Remove unused imports
- Rename package name
- Reorder method arguments
- Replace String literal with constant
- Replace constant with another constant
- Replace constant with literal value
- Simplify a call chain
- Transform calls to Objects.isNull(..) and Objects.nonNull(..)
- Update source positions
- Use static import
- Cleanup
- Dependencies
- Format
- Blank lines
- End files with a single newline
- Format Java code
- Method parameter padding
- No whitespace after
- No whitespace before
- Normalize format
- Normalize the line breaks
- Normalize to tabs or spaces
- Operator wrapping
- Pad empty for loop components
- Remove trailing whitespace
- Single line comments begin with a whitespace
- Spaces
- Tabs and indents
- Typecast parentheses padding
- Wrapping and braces
- JHipster
- Logging
- Parameterize logging statements
- Use logger instead of printStackTrace()
- Use logger instead of system print statements
- Use logger instead of system print statements
- Use logger instead of system print statements
- Log4j
- Logback
- SLF4J
- Enhances logging of exceptions by including the full stack trace in addition to the exception message
- Loggers should be named for their enclosing classes
- Migrate Log4j 1.x to SLF4J 1.x
- Migrate Log4j 2.x to SLF4J 1.x
- Migrate Log4j to SLF4J
- Parameterize SLF4J logging statements
- SLF4J best practices
- SLF4J logging statements should begin with constants
- Micronaut
- Add @Introspected to classes requiring a map representation
- Add Micronaut build plugins to 4.x
- Add snakeyaml dependency if needed
- Change Maven annotation processor path
- Change factory method return types to reflect their resolved return type
- Convert OncePerRequestServerFilter extensions to HttpServerFilter
- Copy non-inherited annotations from super class
- De-capitalize BeanIntrospection getProperty(..) and getRequiredProperty(..) name arguments
- Find Micronaut properties config
- Find Micronaut yaml config
- Fix deprecated no-arg ExceptionHandler constructors
- Migrate from Micronaut 2.x to 3.x
- Migrate from Micronaut 3.x to 4.x
- Provider implementation beans to Micronaut @Factory
- Update jakarta annotations dependency
- Update relocated Micronaut Security config properties
- Update relocated Micronaut Security config yaml keys
- Update the Micronaut Retry support
- Update the Micronaut Security library
- Update the Micronaut Session support
- Update the Micronaut Websocket support
- Update the Micronaut version to 4.x
- Update to Micronaut 4.x platform BOM
- Update to Micronaut Validation 4.x
- Update to Micronaut Validation 4.x
- Upgrade gradle.properties Micronaut version
- Upgrade micronaut.version Maven property
- Modernize
- Add JDeprScan Maven Plug-in
- Add Maven Jar Plugin to suppress Illegal Reflection Warnings
- Change Maven Java version property values to 11
- Change Maven Java version property values to 17
- Change Maven Java version property values to 20
- Migrate to Java 11
- Migrate to Java 17
- Migrate to Java 20
- Prefer java.util.Base64 instead of sun.misc
- Upgrade Java version
- Apache
- Cobertura
- Guava
- Prefer Files#createTempDirectory()
- Prefer Integer#compare
- Prefer Integer#compareUnsigned
- Prefer Integer#divideUnsigned
- Prefer Integer#parseUnsignedInt
- Prefer Integer#remainderUnsigned
- Prefer List.of(..) in Java 9 or higher
- Prefer Long#compare
- Prefer Long#compareUnsigned
- Prefer Long#divideUnsigned
- Prefer Long#parseUnsignedInt
- Prefer Long#remainderUnsigned
- Prefer Map.of(..) in Java 9 or higher
- Prefer Math#addExact
- Prefer Math#multiplyExact
- Prefer Math#subtractExact
- Prefer Runnable::run
- Prefer Set.of(..) in Java 9 or higher
- Prefer Short#compare
- Prefer java.lang.Char#compare
- Prefer java.util.Collections#synchronizedNavigableMap
- Prefer java.util.Collections#unmodifiableNavigableMap
- Prefer java.util.Objects#equals
- Prefer java.util.Objects#hash
- Prefer java.util.Optional
- Prefer java.util.Optional#or(Supplier<T extends java.util.Optional>)
- Prefer java.util.Optional#orElse(null) over com.google.common.base.Optional#orNull()
- Prefer java.util.function.Function
- Prefer java.util.function.Predicate
- Prefer java.util.function.Supplier
- Prefer new ArrayList<>()
- Prefer new AtomicReference<>()
- Prefer new ConcurrentHashMap<>()
- Prefer new CopyOnWriteArrayList<>()
- Prefer new HashSet<>()
- Prefer new LinkedHashMap<>()
- Prefer new LinkedHashSet<>()
- Prefer new LinkedList<>()
- Prefer the Java standard library instead of Guava
- Remove com.google.common.base.Optional#toJavaUtil()
- Replace com.google.common.base.Optional#fromJavaUtil(java.util.Optional) with argument
- Hibernate
- JaCoCo
- Jakarta
- Maybe add jakarta.servlet-api dependency
- Migrate Ehcache from javax to jakarta namespace
- Migrate Jackson from javax to jakarta namespace
- Migrate Johnzon from javax to jakarta namespace
- Migrate RestAssured from javax to jakarta namespace by upgrading to a version compatible with J2EE9
- Migrate deprecated javax.activation packages to jakarta.activation
- Migrate deprecated javax.annotation packages to jakarta.annotation
- Migrate deprecated javax.annotation packages to jakarta.annotation
- Migrate deprecated javax.annotation packages to jakarta.annotation
- Migrate deprecated javax.annotation.security packages to jakarta.annotation.security
- Migrate deprecated javax.annotation.sql packages to jakarta.annotation.sql
- Migrate deprecated javax.batch packages to jakarta.batch
- Migrate deprecated javax.decorator packages to jakarta.decorator
- Migrate deprecated javax.ejb packages to jakarta.ejb
- Migrate deprecated javax.el packages to jakarta.el
- Migrate deprecated javax.enterprise packages to jakarta.enterprise
- Migrate deprecated javax.faces packages to jakarta.faces
- Migrate deprecated javax.inject packages to jakarta.inject
- Migrate deprecated javax.interceptor packages to jakarta.interceptor
- Migrate deprecated javax.jms packages to jakarta.jms
- Migrate deprecated javax.json packages to jakarta.json
- Migrate deprecated javax.jws packages to jakarta.jws
- Migrate deprecated javax.mail packages to jakarta.mail
- Migrate deprecated javax.persistence packages to jakarta.persistence
- Migrate deprecated javax.resource packages to jakarta.resource
- Migrate deprecated javax.security.auth.message packages to jakarta.security.auth.message
- Migrate deprecated javax.security.enterprise packages to jakarta.security.enterprise
- Migrate deprecated javax.security.jacc packages to jakarta.security.jacc
- Migrate deprecated javax.servlet packages to jakarta.servlet
- Migrate deprecated javax.soap packages to jakarta.soap
- Migrate deprecated javax.transaction packages to jakarta.transaction
- Migrate deprecated javax.validation packages to jakarta.validation
- Migrate deprecated javax.websocket packages to jakarta.websocket
- Migrate deprecated javax.ws packages to jakarta.ws
- Migrate deprecated javax.xml.bind packages to jakarta.xml.bind
- Migrate deprecated javax.xml.ws packages to jakarta.xml.ws
- Migrate to Jakarta EE 9
- Migrate xmlns entries in persistence.xml files
- Lombok
- Maven
- Metrics
- [Simplify Micrometer meter tags](reference/recipes/java/migrate/metrics/simplifymicrometermetertags.md)
- Search
- Wro4j
- java.lang APIs
- Prefer String#formatted(Object...)
- Refaster template UseStringIsEmpty
- Use Character#isJavaIdentifierPart(char)
- Use Character#isJavaIdentifierStart(char)
- Use Character#isWhitespace(char)
- Use Class#getDeclaredConstructor().newInstance()
- Use ClassLoader#defineClass(String, byte[], int, int)
- Use Runtime.Version#feature()
- Use Runtime.Version#interim()
- Use Runtime.Version#update()
- Use SecurityManager#checkMulticast(InetAddress)
- Use modernized java.lang APIs
- Use text blocks
- java.net APIs
- java.sql APIs
- java.util APIs
- java.util.concurrent APIs
- Use AtomicBoolean#weakCompareAndSetPlain(boolean, boolean)
- Use AtomicInteger#weakCompareAndSetPlain(int, int)
- Use AtomicIntegerArray#weakCompareAndSetPlain(int, int, int)
- Use AtomicLong#weakCompareAndSetPlain(long, long)
- Use AtomicLongArray#weakCompareAndSetPlain(int, long, long)
- Use AtomicReference#weakCompareAndSetPlain(T, T)
- Use AtomicReferenceArray#weakCompareAndSetPlain(int, T, T)
- Use modernized java.util.concurrent APIs
- java.util.logging APIs
- javax APIs
- Add explicit Inject dependencies
- Add explicit JAX-WS dependencies
- Add explicit JAXB dependencies
- Use javax.lang.model.util.AbstractAnnotationValueVisitor9
- Use javax.lang.model.util.AbstractElementVisitor9
- Use javax.lang.model.util.AbstractTypeVisitor9
- Use javax.lang.model.util.ElementKindVisitor9
- Use javax.lang.model.util.ElementScanner9
- Use javax.lang.model.util.SimpleAnnotationValueVisitor9
- Use javax.lang.model.util.SimpleElementVisitor9
- Use javax.lang.model.util.SimpleTypeVisitor9
- Use javax.lang.model.util.TypeKindVisitor9
- Use javax.management.monitor.CounterMonitor#setInitThreshold
- Use javax.xml.stream.XMLEventFactory#newFactory(String, ClassLoader)
- Use javax.xml.stream.XMLInputFactory#newFactory(String, ClassLoader)
- Use javax.xml.stream.XMLOutputFactory#newFactory(String, ClassLoader)
- Use latest JAXB API and runtime for Jakarta EE 8
- Use modernized javax.lang.model.util APIs
- Use modernized javax.management.monitor APIs
- Use modernized javax.xml.stream APIs
- Use the latest JAX-WS API and runtime for Jakarta EE 8
- OpenRewrite best practices
- Automatically select recipe examples from the unit test cases of a recipe
- Find OpenRewrite recipes
- Migrate JavaTemplate to accommodate Rewrite 8
- Migrate Rewrite recipes from version 7 to 8
- Migrate deprecated org.openrewrite.marker.Markers#SearchResult(..)
- Migrate rewrite unit test from version 7 to 8
- Minimal indentation for SourceSpecs text blocks
- Remove applicability test from Yaml recipe
- Set default estimated effort
- Update moved package class name
- Update moved package recipe
- Update moved package recipe in pom.xml
- Update moved package recipe in yaml file
- Use JavaParser.Builder when constructing JavaTemplate
- Use a standard name for ExecutionContext
- Search
- Build call graph
- Find annotations
- Find class declarations implementing an interface
- Find empty classes
- Find fields
- Find fields of type
- Find files compiled at a specific Java version
- Find files in a source set
- Find files that are likely not tests
- Find literals
- Find method usages
- Find methods with empty bodies
- Find missing type information on Java ASTs
- Find plain text secrets
- Find source files with imports
- Find sources that are likely tests
- Find types
- Find uses of @Repeatable annotations
- Find uses of deprecated classes
- Find uses of deprecated classes, methods, and fields
- Find uses of deprecated fields
- Find uses of deprecated methods
- Find within comments and literals
- Result of method call ignored
- Security
- Find text-direction changes
- Java security best practices
- Partial path traversal vulnerability
- Regular Expression Denial of Service (ReDOS)
- Secure random
- SecureRandom seeds are not constant or predictable
- Use Files#createTempDirectory
- Use secure temporary file creation
- XML parser XXE vulnerability
- Zip slip
- Marshalling
- Search
- Secrets
- Find AWS secrets
- Find Artifactory secrets
- Find Azure secrets
- Find Discord secrets
- Find GitHub secrets
- Find Google secrets
- Find Heroku secrets
- Find JWT secrets
- Find MailChimp secrets
- Find Mailgun secrets
- Find NPM secrets
- Find PGP secrets
- Find PayPal secrets
- Find Picatic secrets
- Find RSA private keys
- Find SSH secrets
- Find SendGrid secrets
- Find Slack secrets
- Find Square secrets
- Find Stripe secrets
- Find Telegram secrets
- Find Twilio secrets
- Find Twitter secrets
- Find generic secrets
- Find passwords used in URLs
- Find secrets
- Find secrets with regular expressions
- Spring
- Spring
- Add a spring configuration property
- Change the key of a spring application property
- Change the value of a spring application property
- Delete a spring configuration property
- Expand Spring YAML properties
- Normalize Spring properties to kebab-case
- Remove @RequestMapping annotations
- Remove implicit web annotation names
- Remove public from @Bean methods
- Remove the @Autowired annotation on inferred constructor
- Remove unnecessary @Repository annotation from Spring Data Repository sub-interface
- Rename bean
- Separate application YAML by profile
- Update the API manifest
- Amqp
- Cloud2022
- Http
- Search
- Security5
- Migrate to Spring Security 5.8
- Rename the package name from com.nimbusds.jose.shaded.json.JSONObject to net.minidev.json.JSONObject
- Replace global method security with method security
- Replace global method security with method security
- Spring Security 5.4 introduces the ability to configure HttpSecurity by creating a SecurityFilterChain bean
- Use new Argon2PasswordEncoder factory methods
- Use new Pbkdf2PasswordEncoder factory methods
- Use new SCryptPasswordEncoder factory methods
- Use the new requestMatchers methods
- Use the new securityMatcher() method
- Search
- Security6
- Keep the default RequestCache querying behavior in Spring Security 5
- Migrate to Spring Security 6.0
- Remove calls matching AuthenticationEntryPointFailureHandler.setRethrowAuthenticationServiceException(true)
- Remove explicit SecurityContextConfigurer.requireExplicitSave(true) opt-in
- Remove explicit configuration of SHA-256 as encoding and matching algorithm for TokenBasedRememberMeServices
- Remove the useAuthorizationManager=true attribute from @EnableReactiveMethodSecurity
- Remove unnecessary filterSecurityInterceptorOncePerRequest(false) when upgrading to Spring Security 6
- Remove unnecessary use-authorization-manager for message security in Spring security 6
- Remove unneeded oauth2Login config when upgrading to Spring Security 6
- Spring Batch
- Migrate ItemWriter
- Migrate JobBuilderFactory to JobBuilder
- Transform classes that extend ChunkListenerSupport to implement the ChunkListener interface instead
- Transform classes that extend JobExecutionListenerSupport to implement the JobExecutionListener interface instead
- Transform classes that extend RepeatListenerSupport to implement the RepeatListener interface instead
- Transform classes that extend SkipListenerSupport to implement the SkipListener interface instead
- Transform classes that extend StepExecutionListenerSupport to implement the StepExecutionListener interface instead
- Transform classes that extend a given Class to implement the given Interface instead
- Spring Boot 2.x
- Add missing @Configuration annotation
- Adds @DependsOnDatabaseInitialization to Spring Beans and Components depending on javax.sql.DataSource
- Adjust configuration classes to use the WebServerFactoryCustomizer interface
- Convert HttpSecurity chained calls into Lambda DSL
- Convert ServerHttpSecurity chained calls into Lambda DSL
- Merge Spring bootstrap.yml with application.yml
- Migrate @OutputCaptureRule to @ExtendWith(OutputCaptureExtension.class)
- Migrate RestTemplateBuilder
- Migrate Spring Boot 2.x projects to JUnit 5 from JUnit 4.
- Migrate Spring Boot properties to 2.0
- Migrate Spring Boot properties to 2.1
- Migrate Spring Boot properties to 2.2
- Migrate Spring Boot properties to 2.3
- Migrate Spring Boot properties to 2.4
- Migrate Spring Boot properties to 2.5
- Migrate Spring Boot properties to 2.6
- Migrate Spring Boot properties to 2.7
- Migrate deprecated ActuatorMediaType to ApiVersion#getProducedMimeType
- Migrate deprecated Spring-Boot EmbeddedDatabaseConnection.HSQL
- Migrate flyway and liquibase credentials
- Migrate multi-condition @ConditionalOnBean annotations
- Migrate to Spring Boot 2.0
- Migrate to Spring Boot 2.1
- Migrate to Spring Boot 2.2
- Migrate to Spring Boot 2.3
- Migrate to Spring Boot 2.4
- Migrate to Spring Boot 2.6
- Migrate to Spring Boot 2.7
- Migrate to recommended constants in LogbackLoggingSystemProperties from deprecated values in LoggingSystemProperties
- Move SAML relying party identity provider property to asserting party
- Remove @SpringExtension
- Remove obsolete Spring JUnit runners
- Remove unnecessary Spring @RunWith
- Replace @ExtendWith and @ContextConfiguration with @SpringJunitConfig
- Replace EnvironmentTestUtils with TestPropertyValues
- Replace HttpSecurity.authorizeRequests(...) with HttpSecurity.authorizeHttpRequests(...) and ExpressionUrlAuthorizationConfigurer, AbstractInterceptUrlConfigurer with AuthorizeHttpRequestsConfigurer, etc
- Spring Boot 2.x best practices
- Upgrade to Spring Boot 2.5
- Use AutoConfiguration#imports
- Use DiskSpaceHealthIndicator(File, DataSize)
- Use EnableConfigurationProperties.VALIDATOR_BEAN_NAME
- Use ErrorAttributes#getErrorAttributes(WebRequest, ErrorAttributeOptions)
- Use ErrorProperties#IncludeStacktrace.ON_PARAM
- Use MultipartConfigFactory with DataSize arguments
- Use PingHealthIndicator
- Use RestClientBuilderCustomizer
- Use RestTemplateBuilder#basicAuthentication
- Use RestTemplateBuilder#setConnectTimeout(Duration) and RestTemplateBuilder#setReadTimeout(Duration)
- Use WebServerFactoryCustomizer
- Use WebTestClientBuilderCustomizer
- Use isEagerFilterInit()
- Use javax.validation.constraints
- Use org.springframework.boot.autoconfigure.http.HttpMessageConverters
- Use org.springframework.boot.web.server.LocalServerPort
- Use org.springframework.boot.web.servlet.error.ErrorController
- Use org.springframework.boot.web.servlet.support.SpringBootServletInitializer
- Use setEagerFilterInit(boolean)
- Use spring-boot.run.agents configuration key in spring-boot-maven-plugin
- Search
- Applications using logging shutdown hooks
- Find patterns that require updating for Spring Boot 2.5
- Find projects affected by changes to the default error view message attribute
- In Spring Boot 2.5 a DefaultConfigurationCustomizer can now be used in favour of defining one or more *Provider beans
- Integration scheduler pool size
- Spring Boot 3.x
- Add @Configuration to classes with @EnableXXXSecurity annotations
- Add SetUseTrailingSlashMatch() in configuration
- Add trailing slash to Spring routes
- Bean methods should return concrete types
- Downgrade Jakarta Servlet API to 5.0 when using Jetty
- Enable Spring Batch Annotation
- Maintain trailing slash URL mappings
- Migrate Spring Boot properties to 3.0
- Migrate Spring Boot properties to 3.1
- Migrate thymeleaf dependencies to Spring Boot 3.0.x
- Migrate to Spring Batch 5.0 from 4.3
- Migrate to Spring Boot 3.0
- Migrate to Spring Boot 3.1
- Remove Unnecessary @ConstructorBinding
- Remove the deprecated properties additional-keys-to-sanitize from the configprops and env end points
- Rename server.max-http-header-size to server.max-http-request-header-size
- Upgrade Maven POM to Spring Boot 3.0 from 2.x
- Upgrade Maven POM to Spring Boot 3.1 from 3.0
- Spring Data
- Spring Framework
- Convert InstantiationAwareBeanPostProcessorAdapter to SmartInstantiationAwareBeanPostProcessor
- Migrate HandlerInterceptorAdapter to HandlerInterceptor
- Migrate deprecated Spring Web UTF8 MediaType enums
- Migrate to Spring Framework 5.0
- Migrate to Spring Framework 5.1
- Migrate to Spring Framework 5.2
- Migrate to Spring Framework 5.3
- Replace WebMvcConfigurerAdapter with WebMvcConfigurer
- Upgrade spring-framework Maven dependencies
- Use Environment#acceptsProfiles(Profiles)
- Use ObjectUtils#isEmpty(Object)
- Use varargs equivalents for deprecated JdbcTemplate signatures
- Testing
- AssertJ
- AssertJ best practices
- JUnit AssertThrows to AssertJ exceptionType
- JUnit assertArrayEquals To AssertJ
- JUnit assertEquals to AssertJ
- JUnit assertFalse to AssertJ
- JUnit assertNotEquals to AssertJ
- JUnit assertNotNull to AssertJ
- JUnit assertNull to AssertJ
- JUnit assertSame to AssertJ
- JUnit assertTrue to AssertJ
- JUnit fail to AssertJ
- Migrate JUnit asserts to AssertJ
- Statically import AssertJ's assertThat
- Use AssertJ contains() on collections
- Use AssertJ hasSize() on collections
- Use AssertJ isEmpty() on collections
- Cleanup
- Assertion arguments should be passed in the correct order
- Include an assertion in tests
- Junit assertTrue(a == b) to assertEquals(a,b)
- Remove empty tests without comments
- Remove public visibility of JUnit 5 tests
- Remove test prefix from JUnit 5 tests
- Replace JUnit assertFalse(!) to assertTrue()
- Replace JUnit assertFalse(a == null) to assertNotNull(a)
- Replace JUnit assertFalse(a.equals(b)) to assertNotEquals(a,b)
- Replace JUnit assertTrue(!) to assertFalse()
- Replace JUnit assertTrue(a == null) to assertNull(a)
- Replace JUnit assertTrue(a.equals(b)) to assertEquals(a,b)
- Testing best practices
- assertEquals(a, null) to assertNull(a)
- Hamcrest
- JUnit Jupiter
- Add missing @ParameterizedTest annotation when @ValueSource is used or replace @Test with @ParameterizedTest
- Clean Up Assertions
- Cleanup JUnit imports
- JUnit 4 @Category to JUnit Jupiter @Tag
- JUnit 4 @RunWith to JUnit Jupiter @ExtendWith
- JUnit 4 @RunWith(Enclosed.class) to JUnit Jupiter @Nested
- JUnit 4 @RunWith(Parameterized.class) to JUnit Jupiter parameterized tests
- JUnit 4 Assert To JUnit Jupiter Assertions
- JUnit 4 ExpectedException To JUnit Jupiter's assertThrows()
- JUnit 4 MockitoJUnit to JUnit Jupiter MockitoExtension
- JUnit 5 inner test classes should be annotated with @Nested
- JUnit Jupiter best practices
- JUnit Jupiter migration from JUnit 4.x
- JUnit TestName @Rule to JUnit Jupiter TestInfo
- Make @TempDir fields non final
- Make lifecycle methods non private
- Migrate JUnit 4 @Test annotations to JUnit 5
- Migrate JUnit 4 TestCase to JUnit Jupiter
- Migrate JUnit 4 lifecycle annotations to JUnit Jupiter
- Migrate from JUnit 4 @FixedMethodOrder to JUnit 5 @TestMethodOrder
- OkHttp 3.x MockWebServer @Rule To 4.x MockWebServer
- Pragmatists @RunWith(JUnitParamsRunner.class) to JUnit Jupiter Parameterized Tests
- Remove JUnit 4 @RunWith annotations that do not require an @ExtendsWith replacement
- Remove duplicates uses of @TestTemplate implementations for a single method
- Statically import JUnit Jupiter assertions
- Use Assertions#assume*(..) and Hamcrest's MatcherAssume#assume*(..)
- Use JUnit Jupiter @Disabled
- Use JUnit Jupiter @TempDir
- Use JUnit Jupiter Executable
- Use MatcherAssert#assertThat(..)
- Use Mockito JUnit Jupiter extension
- Use OkHttp 3 MockWebServer for JUnit 5
- Use Vert.x JUnit 5 Extension
- Use wiremock extension
- Mockito
- Cleanup Mockito imports
- JUnit 4 MockitoJUnitRunner.Silent to JUnit Jupiter MockitoExtension with LENIENT settings
- Mockito 3.x migration from 1.x
- Mockito 4.x upgrade
- Replace Mockito 1.x any(Class) and anyString() with nullable(Class)
- Replace Mockito 1.x anyString() with nullable(String.class)
- Replace PowerMock with raw Mockito
- Replace PowerMock.mockStatic() with Mockito.mockStatic()
- Use static form of Mockito MockUtil
- Uses Mockito all from v1.x
- AssertJ
- Upgrade
- Kubernetes
- Add Kubernetes configuration
- Ensure CPU limits are set
- Ensure CPU request is set
- Ensure image pull policy is Always
- Ensure lifecycle rule on StorageBucket
- Ensure liveness probe is configured
- Ensure memory limits are set
- Ensure memory request is set
- Ensure readiness probe is configured
- Kubernetes best practices
- Limit root capabilities in a container
- No host IPC sharing
- No host network sharing
- No host process ID sharing
- No privilege escalation
- No privileged containers
- No root containers
- Read-only root filesystem
- Update image name
- RBAC
- Resource
- Search
- Services
- Quarkus
- Recommendations
- Maven
- Add Gradle Enterprise Maven Extension to maven projects
- Add Maven dependency
- Add Maven plugin
- Add Maven plugin dependencies
- Add Maven profile
- Add Maven project property
- Add Repository
- Add a comment to a Maven dependency
- Add managed Maven dependency
- Change Maven Parent Pom
- Change Maven dependency classifier
- Change Maven dependency groupId, artifactId and/or the version
- Change Maven dependency scope
- Change Maven managed dependency groupId, artifactId and optionally the version
- Change Maven plugin configuration
- Change Maven plugin dependencies
- Change Maven plugin executions
- Change Maven plugin groupId and artifactId
- Change Maven project property value
- Exclude Maven dependency
- Manage dependencies
- Normalize Maven variables
- Order POM elements
- Remove Maven dependency
- Remove Maven managed dependency
- Remove Maven plugin
- Remove Maven plugin dependency
- Remove Maven project property
- Remove duplicate Maven dependencies
- Remove exclusion
- Remove redundant explicit dependency versions
- Remove repository
- Rename Maven property key
- Set Maven project packaging
- Upgrade Maven dependency version
- Upgrade Maven parent project version
- Upgrade Maven plugin version
- Cleanup
- Search
- Security
- Spring
- Utilities
- SQL
- Static analysis and remediation
- Add missing @Override to overriding and implementing methods
- Add serialVersionUID to a Serializable class when missing
- Atomic Boolean, Integer, and Long equality checks compare their values
- Avoid boxed boolean expressions
- BigDecimal rounding constants to RoundingMode enums
- Boolean checks should not be inverted
- CaseInsensitive comparisons do not alter case
- Catch clause should do more than just rethrow
- Chain StringBuilder.append() calls
- Change StringBuilder and StringBuffer character constructor argument to String
- Changes code to use Java 17's instanceof pattern matching
- Code cleanup
- Combine semantically equal catch blocks
- Common static analysis issues
- Control flow statement indentation
- Covariant equals
- Default comes last
- Don't use final on local variables
- Enum values should be compared with "=="
- Equals avoids null
- Explicit initialization
- Externalizable classes have no-arguments constructor
- Fall through
- Finalize classes with private constructors
- Finalize local variables
- Finalize method arguments
- Finalize private fields
- Fix String#format and String#formatted expressions
- Fix missing braces
- Hidden field
- Hide utility class constructor
- Inline variable
- Java API best practices
- Jump statements should not be redundant
- Method name casing
- Modifier order
- Nested enums are not static
- No C-style array declarations
- No double brace initialization
- No multiple variable declarations
- No primitive wrappers for #toString() or #compareTo(..)
- Operator wrapping
- Prefer while over for loops
- Properly use declaration-site type variance
- Properly use declaration-site type variance for well-known types
- Redundant file creation
- Reformat local variable names to camelCase
- Reformat private field names to camelCase
- Remove JavaDoc @param, @return, and @throws with no description
- Remove Nullable and CheckForNull annotations from primitives
- Remove Object.finalize() invocations
- Remove System.out#println statements
- Remove Unneeded Assertions
- Remove author tags from JavaDocs
- Remove catch for a checked exception if the try block does not throw that exception
- Remove empty blocks
- Remove extra semicolons
- Remove finalize() method
- Remove garbage collection invocations
- Remove redundant casts
- Remove unneeded block
- Remove unused local variables
- Remove unused private fields
- Remove unused private methods
- Removes from code Java 14's instanceof pattern matching
- Rename caught exceptions in empty catch blocks to ignored
- Rename methods named hashcode, equal, or tostring
- Rename packages to lowercase
- Replace Optional#isPresent() with Optional#ifPresent()
- Replace Stream.toList() with Stream.collect(Collectors.toList())
- Replace StringBuilder.append() with String
- Replace calls to Thread.run() with Thread.start()
- Replace deprecated Runtime.Exec() methods
- Replace duplicate String literals
- Replace invocations of Collections#sort(List, Comparator) with List#sort(Comparator)
- Replace java.util.Set#removeAll(java.util.Collection) with java.util.Collection#forEach(Set::remove)
- Replace java.util.Stack with java.util.Deque
- Replace org.apache.commons.lang3.Validate#notNull with Objects#requireNonNull
- Replace org.apache.commons.lang3.Validate#notNull with Objects#requireNonNull
- Replace org.apache.commons.lang3.Validate#notNull with Objects#requireNonNull
- Replace redundant String format invocations that are wrapped with PrintStream operations
- Replace referential equality operators with Object equals method invocations when the operands both override Object.equals(Object obj)
- Replace text block with regular string
- Replaces Object.notify() with Object.notifyAll()
- Set charset encoding explicitly when calling String#getBytes
- Simplify compound statement
- Simplify consecutive assignments
- Simplify constant if branch execution
- Simplify java.time.Duration units
- Simplify lambda blocks to expressions
- Static methods not final
- Typecast parenthesis padding
- Unnecessary String#toString()
- Unnecessary String#valueOf(..)
- Unnecessary close in try-with-resources
- Unnecessary explicit type arguments
- Unnecessary throws
- Unwrap @Repeatable annotations
- Upper case literal suffixes
- Use Collection interfaces
- Use Collection#isEmpty() instead of comparing size()
- Use Collections#emptyList(), emptyMap(), and emptySet()
- Use Map#containsKey
- Use StandardCharset constants
- Use String.equals() on String literals
- Use String::replace() when fist parameter is not a real regular expression
- Use System.lineSeparator()
- Use comparison rather than equality checks in for conditions
- Use diamond operator
- Use explicit types on lambda arguments
- Use indexOf(String, int)
- Use lambda expressions instead of anonymous classes
- Use method references in lambda
- Use primitive wrapper valueOf method
- Use the builder pattern where possible
- Write octal values as decimal
- finalize() calls super
- for loop counters incremented in update
- for loop counters should use postfix operators
- indexOf should not compare greater than zero
- indexOf() replaceable by contains()
- switch statements should have at least 3 case clauses
- Terraform
- Add Terraform configuration
- Use a long enough byte length for random resources
- AWS
- Best practices for AWS
- Disable Instance Metadata Service version 1
- Enable API gateway caching
- Enable point-in-time recovery for DynamoDB
- Encrypt Aurora clusters
- Encrypt CodeBuild projects
- Encrypt DAX storage at rest
- Encrypt DocumentDB storage
- Encrypt EBS snapshots
- Encrypt EBS volume launch configurations
- Encrypt EBS volumes
- Encrypt EFS Volumes in ECS Task Definitions in transit
- Encrypt ElastiCache Redis at rest
- Encrypt ElastiCache Redis in transit
- Encrypt Neptune storage
- Encrypt RDS clusters
- Encrypt Redshift storage at rest
- Ensure AWS CMK rotation is enabled
- Ensure AWS EFS with encryption for data at rest is enabled
- Ensure AWS EKS cluster endpoint access is publicly disabled
- Ensure AWS Elasticsearch domain encryption for data at rest is enabled
- Ensure AWS Elasticsearch domains have EnforceHTTPS enabled
- Ensure AWS Elasticsearch has node-to-node encryption enabled
- Ensure AWS IAM password policy has a minimum of 14 characters
- Ensure AWS Lambda function is configured for function-level concurrent execution limit
- Ensure AWS Lambda functions have tracing enabled
- Ensure AWS RDS database instance is not publicly accessible
- Ensure AWS S3 object versioning is enabled
- Ensure Amazon EKS control plane logging enabled for all log types
- Ensure CloudTrail log file validation is enabled
- Ensure EC2 is EBS optimized
- Ensure ECR repositories are encrypted
- Ensure IAM password policy expires passwords within 90 days or less
- Ensure IAM password policy prevents password reuse
- Ensure IAM password policy requires at least one lowercase letter
- Ensure IAM password policy requires at least one number
- Ensure IAM password policy requires at least one symbol
- Ensure IAM password policy requires at least one uppercase letter
- Ensure Kinesis Stream is securely encrypted
- Ensure RDS database has IAM authentication enabled
- Ensure RDS instances have Multi-AZ enabled
- Ensure VPC subnets do not assign public IP by default
- Ensure data stored in an S3 bucket is securely encrypted at rest
- Ensure detailed monitoring for EC2 instances is enabled
- Ensure enhanced monitoring for Amazon RDS instances is enabled
- Ensure respective logs of Amazon RDS are enabled
- Ensure the S3 bucket has access logging enabled
- Make ECR tags immutable
- Scan images pushed to ECR
- Use HTTPS for Cloudfront distribution
- Azure
- Best practices for Azure
- Disable Kubernetes dashboard
- Enable Azure Storage Account Trusted Microsoft Services access
- Enable Azure Storage secure transfer required
- Enable geo-redundant backups on PostgreSQL server
- Encrypt Azure VM data disk with ADE/CMK
- Ensure AKS policies add-on
- Ensure AKV secrets have an expiration date set
- Ensure Azure App Service Web app redirects HTTP to HTTPS
- Ensure Azure Network Watcher NSG flow logs retention is greater than 90 days
- Ensure Azure PostgreSQL database server with SSL connection is enabled
- Ensure Azure SQL Server threat detection alerts are enabled for all threat types
- Ensure Azure SQL server audit log retention is greater than 90 days
- Ensure Azure SQL server send alerts to field value is set
- Ensure Azure application gateway has WAF enabled
- Ensure Azure key vault is recoverable
- Ensure FTP Deployments are disabled
- Ensure MSSQL servers have email service and co-administrators enabled
- Ensure MySQL is using the latest version of TLS encryption
- Ensure MySQL server databases have Enforce SSL connection enabled
- Ensure MySQL server disables public network access
- Ensure MySQL server enables Threat Detection policy
- Ensure MySQL server enables geo-redundant backups
- Ensure PostgreSQL server disables public network access
- Ensure PostgreSQL server enables Threat Detection policy
- Ensure PostgreSQL server enables infrastructure encryption
- Ensure Send email notification for high severity alerts is enabled
- Ensure Send email notification for high severity alerts to admins is enabled
- Ensure Web App has incoming client certificates enabled
- Ensure Web App uses the latest version of HTTP
- Ensure Web App uses the latest version of TLS encryption
- Ensure a security contact phone number is present
- Ensure activity log retention is set to 365 days or greater
- Ensure all keys have an expiration date
- Ensure app service enables HTTP logging
- Ensure app service enables detailed error messages
- Ensure app service enables failed request tracing
- Ensure app services use Azure files
- Ensure key vault allows firewall rules settings
- Ensure key vault enables purge protection
- Ensure key vault key is backed by HSM
- Ensure key vault secrets have content_type set
- Ensure log profile is configured to capture all activities
- Ensure managed identity provider is enabled for app services
- Ensure public network access enabled is set to False for mySQL servers
- Ensure standard pricing tier is selected
- Ensure storage account uses latest TLS version
- Ensure the storage container storing activity logs is not publicly accessible
- Set Azure Storage Account default network access to deny
- GCP
- Best practices for GCP
- Enable PodSecurityPolicy controller on Google Kubernetes Engine (GKE) clusters
- Enable VPC Flow Logs for subnetworks
- Enable VPC flow logs and intranode visibility
- Ensure GCP Kubernetes cluster node auto-repair configuration is enabled
- Ensure GCP Kubernetes engine clusters have legacy compute engine metadata endpoints disabled
- Ensure GCP VM instances have block project-wide SSH keys feature enabled
- Ensure GCP cloud storage bucket with uniform bucket-level access are enabled
- Ensure IP forwarding on instances is disabled
- Ensure binary authorization is used
- Ensure compute instances launch with shielded VM enabled
- Ensure private cluster is enabled when creating Kubernetes clusters
- Ensure secure boot for shielded GKE nodes is enabled
- Ensure shielded GKE nodes are enabled
- Ensure the GKE metadata server is enabled
- Search
- Core
- Config
- Text
- Gradle
- Add Gradle dependency
- Add Gradle property
- Change Gradle dependency
- Change Gradle dependency artifact
- Change Gradle dependency group
- Change a Gradle dependency classifier
- Change a Gradle dependency configuration
- Change a Gradle dependency extension
- Enable Gradle build cache
- Enable Gradle parallel execution
- Remove a Gradle dependency
- Remove repository
- Update Gradle project Java compatibility
- Update Gradle wrapper
- Upgrade Gradle dependency versions
- Use Map notation for Gradle dependency declarations
- Use String notation for Gradle dependency declarations
- Plugins
- Search
- Security
- Groovy
- Hcl
- JSON
- Properties
- XML
- YAML
- Changelog
- 8.1.3 Release (2023-06-23)
- 8.1.2 Release (2023-06-13)
- 7.40.6 Release (2023-05-08)
- 7.40.0 Release (2023-04-21)
- 7.39.1 Release (2023-04-04)
- 7.38.0 Release (2023-03-15)
- 7.37.2 Release (2023-03-02)
- 7.36.0 Release (2023-02-16)
- 7.35.0 Release (2023-01-20)
- 7.34.2 Release (2022-12-16)
- 7.34.0 Release (2022-12-09)
- 7.33.0 Release (2022-11-16)
- Reference
- Latest versions of every OpenRewrite module
- Maven plugin configuration
- Gradle plugin configuration
- Supported languages
- Snapshot versions
- JsonPath and JsonPathMatcher
- Declarative YAML format
- Method patterns
- Dependency version selectors
- Framework provided markers
- Building OpenRewrite from source
- Frequently asked questions
- Concepts & explanations