In two projects that I've contributed I've had this Error:
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: java.util.Objects
That because I've implemented hashCode and equals methods using Objects class.
@Override
public int hashCode() {
int hash = 7;
hash = 97 * hash + Objects.hashCode(this.image);
hash = 97 * hash + Objects.hashCode(this.car);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final SummaryContent other = (SummaryContent) obj;
if (!Objects.equals(this.image, other.image)) {
return false;
}
return Objects.equals(this.car, other.car);
}
When I compile I don't get error or warnings. Why might it be happening?