A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/5244 below:

[java] UselessOperationOnImmutable should detect java.time types · Issue #5244 · pmd/pmd · GitHub

Is your feature request related to a problem? Please describe.
There are now more immutable types in Java, not just String/BigDecimal/BigInteger.
E.g. the types around java.time.* are all immutable: LocalDate, LocalDateTime, LocalTime, OffsetDate, OffsetDateTime, ZonedDateTime, Instant, Duration, Period... They provide some methods like "plusDays(x)", but won't change the original instance and rather create a new instance.

Maybe there are more immutable types commonly used in Java.

Describe the solution you'd like
The rule UselessOperationOnImmutable should be enhanced to detect further cases. The name of the rule is general enough and can stay the same.

Describe alternatives you've considered
none


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4