-
Type:
Enhancement
-
Resolution: Fixed
-
Priority:
P5
-
Affects Version/s: None
-
Component/s: security-libs
-
b06
Update code checks both non-null and instance of a class in security classes.
The checks and explicit casts could also be replaced with pattern matching for the instanceof operator.
For example:
The following code:
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof AccessDescription))) {
return false;
}
AccessDescription that = (AccessDescription)obj;
Can be simplified to:
public boolean equals(Object obj) {
if (!(obj instanceof AccessDescription that)) {
return false;
}
The checks and explicit casts could also be replaced with pattern matching for the instanceof operator.
For example:
The following code:
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof AccessDescription))) {
return false;
}
AccessDescription that = (AccessDescription)obj;
Can be simplified to:
public boolean equals(Object obj) {
if (!(obj instanceof AccessDescription that)) {
return false;
}