Class identity comparisons wherever possible (and further polishing)

Issue: SPR-12926
This commit is contained in:
Juergen Hoeller
2015-12-09 12:28:09 +01:00
parent 4261f34b63
commit 11806b9215
29 changed files with 127 additions and 109 deletions

View File

@@ -184,7 +184,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* @param objectName the name of the target object
*/
public DataBinder(Object target, String objectName) {
if (target != null && target.getClass().equals(javaUtilOptionalClass)) {
if (target != null && target.getClass() == javaUtilOptionalClass) {
this.target = OptionalUnwrapper.unwrap(target);
}
else {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ public class ObjectError extends DefaultMessageSourceResolvable {
if (this == other) {
return true;
}
if (!(getClass().equals(other.getClass())) || !super.equals(other)) {
if (getClass() != other.getClass() || !super.equals(other)) {
return false;
}
ObjectError otherError = (ObjectError) other;