1
1
package tools .jackson .databind .deser ;
2
2
3
+ import java .lang .reflect .Modifier ;
3
4
import java .util .*;
4
5
5
6
import com .fasterxml .jackson .annotation .*;
@@ -935,14 +936,10 @@ protected SettableBeanProperty constructSettableProperty(DeserializationContext
935
936
// Does the Method specify the deserializer to use? If so, let's use it.
936
937
TypeDeserializer typeDeser = (TypeDeserializer ) type .getTypeHandler ();
937
938
SettableBeanProperty prop ;
938
- if (mutator instanceof AnnotatedMethod ) {
939
- prop = new MethodProperty (propDef , type , typeDeser ,
940
- beanDesc .getClassAnnotations (), (AnnotatedMethod ) mutator );
941
- } else {
942
- // 08-Sep-2016, tatu: wonder if we should verify it is `AnnotatedField` to be safe?
943
- prop = new FieldProperty (propDef , type , typeDeser ,
944
- beanDesc .getClassAnnotations (), (AnnotatedField ) mutator );
939
+ if (isFinalField (mutator )) {
940
+ return null ;
945
941
}
942
+ prop = new MethodProperty (propDef , type , typeDeser , beanDesc .getClassAnnotations (), mutator );
946
943
ValueDeserializer <?> deser = findDeserializerFromAnnotation (ctxt , mutator );
947
944
if (deser == null ) {
948
945
deser = (ValueDeserializer <?>) type .getValueHandler ();
@@ -963,6 +960,11 @@ protected SettableBeanProperty constructSettableProperty(DeserializationContext
963
960
return prop ;
964
961
}
965
962
963
+ private boolean isFinalField (AnnotatedMember am ) {
964
+ return am instanceof AnnotatedField
965
+ && Modifier .isFinal (am .getMember ().getModifiers ());
966
+ }
967
+
966
968
/**
967
969
* Method that will construct a regular bean property setter using
968
970
* the given setter method.
0 commit comments