Two different instances of the same enum value for previous and current input property when using the gradle daemon

The up-to-date check fails on a task because one of the input properties is an enum with different instances for the same enum value when the previous and current properties are compared in org.gradle.util.DiffUtil.diff(Map, Map, ChangeListener). The equals method for enums is implemented as == and therefore the up-to-date check fails although the values are logically identical. The problem seems to only occur when using the gradle daemon.

The problem came up while using the gwt-gradle-plugin. See https://github.com/steffenschaefer/gwt-gradle-plugin/issues/18 for the background.

During debugging of gradle I found this situation during the call to org.apache.commons.lang.ObjectUtils.equals(Object, Object). As you can see these are two distinct instances of the same enum value Style.OBF.

‘’’ object1 Style (id=7033)

‘object1’ referenced from:

[0] HashMap$Entry<K,V> (id=7036)

[1] Style[3] (id=7037)

‘[1]’ referenced from:

[0] Class (de.richsource.gradle.plugins.gwt.Style) (id=7034)

[0] Style (id=7033)

[1] Style (id=7059)

[2] Style (id=7060)

[2] Class (de.richsource.gradle.plugins.gwt.Style) (id=7034)

[3] HashMap$Entry<K,V> (id=7032)

[4] GwtCompileOptionsImpl (id=7038)

name “OBF” (id=217)

ordinal 0 [0x0] [^@ (NUL)]

object2 Style (id=6977)

‘object2’ referenced from:

[0] Style[3] (id=7039)

‘[0]’ referenced from:

[0] Class (de.richsource.gradle.plugins.gwt.Style) (id=6978)

[0] Style (id=6977)

[1] Style (id=7056)

[2] Style (id=7057)

[1] Class (de.richsource.gradle.plugins.gwt.Style) (id=6978)

[2] GwtCompileOptionsImpl (id=7040)

[3] HashMap$Entry<K,V> (id=6914)

name “OBF” (id=217)

ordinal 0 [0x0] [^@ (NUL)]

‘’’

Raised as GRADLE-3018.