GitHub
Join us on Slack
Join us on Discord
Ask on Stack Overflow
Search
⌃K
Links
Introduction to OpenRewrite
Running Recipes
Authoring Recipes
Recipe catalog
Kotlin
Python
CircleCI
Cloud suitability analyzer
Concourse
GitHub Actions
Java
Add ASLv2 license header
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
Demonstrate rendering of recipe exceptions
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
Uses @RewriteSkip annotation
Common static analysis issues cleanup
Add imports for fully qualified references to types
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
Fields in a Serializable class should either be transient or serializable
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
Method parameter padding
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(..)
No whitespace after
No whitespace before
Operator wrapping
Pad empty for loop components
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 @params, @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 unnecessary parentheses
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 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
Replace text block with regular string
Replaces Object.notify() with Object.notifyAll()
Set charset encoding explicitly when calling String#getBytes
Simplify boolean expression
Simplify boolean return
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 lambdas expression to replace anonymous class where possible
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
Controlflow
Dependencies
Format
JHipster
Logging
Micronaut
Modernize
OpenRewrite best practices
Search
Security
Spring
Testing
Kubernetes
Quarkus
Maven
Terraform
Core
Config
Text
Gradle
Groovy
Hcl
JSON
Properties
XML
YAML
Changelog
Reference
Concepts & explanations
Powered By
GitBook
Unnecessary explicit type arguments
org.openrewrite.java.cleanup.UnnecessaryExplicitTypeArguments
When explicit type arguments are inferrable by the compiler, they may be removed.
Source
Github
,
Issue Tracker
,
Maven Central
groupId: org.openrewrite
artifactId: rewrite-java
version: 7.40.6
Contributors
Jonathan Schneider
Sam Snyder