Query module MissingInstanceofInEquals

name
Equals method does not inspect argument type
description
An implementation of ‘equals’ that does not check the type of its argument may lead to failing casts.
kind
problem
problem.severity
error
precision
high
id
java/unchecked-cast-in-equals
tags
reliability correctness

Imports

JDK

Provides classes and predicates for working with standard classes and methods from the JDK.

Member

Provides classes and predicates for working with members of Java classes and interfaces, that is, methods, constructors, fields and nested types.

Classes

CheckedCast

A cast inside a try-catch block that catches ClassCastException.

ReferenceEquals

An equals method with a body of either return o == this; or return o == field;