Hi Dave, yes this is tracked in https://issues.apache.org/jira/browse/JOHNZON-142 and 77
long story short setting final fields was not intended and lead to inconsistencies so this behavior has been dropped. if you need the previous behavior and are sure it is intended you can get it back using: WithFinalMap o = new MapperBuilder() .setAccessMode(new FieldAccessMode(true, true) { @Override protected Map<String, Field> fields(Class<?> clazz, boolean includeFinalFields) { return super.fields(clazz, true); } }) .build().readObject("{\"m\":{\"A\":\"a\"}}", WithFinalMap.class); That said i wouldnt recommand you to do it and maybe use the constructor rather than this old hack Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> Le lun. 29 oct. 2018 à 00:10, dave <d.ea...@alchemy.co.nz> a écrit : > Hi, > > I am attempting to upgrade from TomEE 7.0.4 (Johnzon 1.0.0) to TomEE 7.1.0 > (Johnzon 1.0.1) and have encountered a change in behaviour with JSON > deserialization. The below test passes with Johnzon 1.0.0 but fails with > 1.0.1. > > Tracing this through with the different Johnzon versions it appears the > cause is FieldAccessMode.field() method excluding final fields in 1.0.1. > Johnzon no longer regards the map field "m" as writeable so silently skips > attempting to put its contents. Removing the final modifier from the map > avoids the issue. > > Is this behaviour considered erroneous? > > Thanks, > Dave > > public class JohnzonMapperTest > { > @Test > public void testFinalMap() > throws Exception > { > WithFinalMap o = new > MapperBuilder().build().readObject("{\"m\":{\"A\":\"a\"}}", WithMap.class); > assertEquals("a", o.m.get("A")); > } > > > public static class WithFinalMap > { > public final Map<String, Object> m = new HashMap<>(); > } > } > > > > > -- > Sent from: > http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html >