@@ -78,9 +78,10 @@ trait DirtyCheckable {
7878 void markDirty(String propertyName, newValue) {
7979 if ( $changedProperties != null && ! $changedProperties. containsKey(propertyName)) {
8080 def oldValue = ((GroovyObject ) this ). getProperty(propertyName)
81- if ((newValue == null && oldValue != null ) ||
82- (newValue != null && oldValue == null ) ||
83- (newValue != null && ! newValue. equals(oldValue))) {
81+ boolean isNull = newValue == null
82+ if ((isNull && oldValue != null ) ||
83+ (! isNull && oldValue == null ) ||
84+ (! isNull && ! newValue. equals(oldValue))) {
8485 $changedProperties. put propertyName, oldValue
8586 }
8687 }
@@ -93,9 +94,10 @@ trait DirtyCheckable {
9394 */
9495 void markDirty(String propertyName, newValue, oldValue) {
9596 if ( $changedProperties != null && ! $changedProperties. containsKey(propertyName)) {
96- if ((newValue == null && oldValue != null ) ||
97- (newValue != null && oldValue == null ) ||
98- (newValue != null && ! newValue. equals(oldValue))) {
97+ boolean isNull = newValue == null
98+ if ((isNull && oldValue != null ) ||
99+ (! isNull && oldValue == null ) ||
100+ (! isNull && ! newValue. equals(oldValue))) {
99101 $changedProperties. put propertyName, oldValue
100102 }
101103 }
0 commit comments