Skip to content

Commit

Permalink
Add java.lang.Class to known immutables (#1695)
Browse files Browse the repository at this point in the history
* Add java.lang.Class to known immutables

Storing a reference to a Class object triggers EI_EXPOSE_REP2, which is
not really fair, as java.lang.Class is really immutable.

Signed-off-by: Robert Varga <robert.varga@pantheon.tech>

* docs: update CHANGELOG

Co-authored-by: Kengo TODA <skypencil+github@gmail.com>
  • Loading branch information
rovarga and KengoTODA committed Sep 12, 2021
1 parent decf8b2 commit 7cc368f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ This is the changelog for SpotBugs. This follows [Keep a Changelog v1.0.0](http:
Currently the versioning policy of this project follows [Semantic Versioning v2.0.0](http://semver.org/spec/v2.0.0.html).

## Unreleased - 2021-??-??
### Fixed
- Fixed immutable java.lang.Class as being flagged as EI ([#1695](https://github.com/spotbugs/spotbugs/pull/1695))

## 4.4.1 - 2021-09-07
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MutableClasses {
private static final Set<String> KNOWN_IMMUTABLE_CLASSES = new HashSet<>(Arrays.asList(
"java.lang.String", "java.lang.Integer", "java.lang.Byte", "java.lang.Character",
"java.lang.Short", "java.lang.Boolean", "java.lang.Long", "java.lang.Double",
"java.lang.Float", "java.lang.StackTraceElement", "java.math.BigInteger",
"java.lang.Float", "java.lang.StackTraceElement", "java.lang.Class", "java.math.BigInteger",
"java.math.Decimal", "java.io.File", "java.awt.Font", "java.awt.BasicStroke",
"java.awt.Color", "java.awt.GradientPaint", "java.awt.LinearGradientPaint",
"java.awt.RadialGradientPaint", "java.Cursor.", "java.util.UUID", "java.net.URL",
Expand Down

0 comments on commit 7cc368f

Please sign in to comment.