> + */ > +package org.jclouds.openstack.neutron.v2.domain; > + > +import com.google.common.base.Objects; > +import com.google.gson.annotations.SerializedName; > + > +/** > + */ > +public class AddressPair { > + > + @SerializedName("mac_address") > + protected final String macAddress; > + @SerializedName("ip_address") > + protected final String ipAddress; > + > + protected AddressPair(String macAddress, String ipAddress) {
The JSON deserialization policy is configured [here](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/json/config/GsonModule.java#L121-L125) in the `GsonModule`. If you have a look at [how the registered type adapter factory](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/json/internal/DeserializationConstructorAndReflectiveTypeAdapterFactory.java#L123-L128) works, you'll see that if the `@ConstructorProperties` annotation is not present, it returns `null` and lets Gson choose the right type adapter. Otherwise the jclouds custom one is used. The latter will take into account the annotation values to pass the right values to each constructor argument, but given the results of your tests I don't really know what the former will do :) We're learning new stuff today. Could you modify the JSON in your test to have the `ip_address` first and then the `mac_address` in the `allowed_address_pairs`list? I would be surprised if the test still succeeds, as that would mean that Gson is smart enough to know which value it has to pass to each constructor argument, without any hint. The way I understand it, if you change the JSON this way, the test will fail, and if you add the `@ConstructorProperties` annotation it will succeed regardless of the order in which the JSON parameters come. Could you change the just the order of the fields in the JSON and share the results of the test? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-openstack/pull/111/files#r14206804