@@ -823,51 +823,58 @@ public void trimByVisibility()
823823 _ctorParameters = _trimByVisibility (_ctorParameters );
824824 }
825825
826- @ SuppressWarnings ("unchecked" )
827826 public void mergeAnnotations (boolean forSerialization )
828827 {
829828 if (forSerialization ) {
830829 if (_getters != null ) {
831- AnnotationMap ann = _mergeAnnotations (0 , _getters , _fields , _ctorParameters , _setters );
830+ AnnotationMap ann = _mergeAnnotations (_getters ,
831+ _mergeAnnotations (_fields ,
832+ _mergeAnnotations (_ctorParameters , _setters )));
832833 _getters = _applyAnnotations (_getters , ann );
833834 } else if (_fields != null ) {
834- AnnotationMap ann = _mergeAnnotations (0 , _fields , _ctorParameters , _setters );
835+ AnnotationMap ann = _mergeAnnotations (_fields ,
836+ _mergeAnnotations (_ctorParameters , _setters ));
835837 _fields = _applyAnnotations (_fields , ann );
836838 }
837839 } else { // for deserialization
838840 if (_ctorParameters != null ) {
839- AnnotationMap ann = _mergeAnnotations (0 , _ctorParameters , _setters , _fields , _getters );
841+ AnnotationMap ann = _mergeAnnotations (_ctorParameters ,
842+ _mergeAnnotations (_setters ,
843+ _mergeAnnotations (_fields , _getters )));
840844 _ctorParameters = _applyAnnotations (_ctorParameters , ann );
841845 } else if (_setters != null ) {
842- AnnotationMap ann = _mergeAnnotations (0 , _setters , _fields , _getters );
846+ AnnotationMap ann = _mergeAnnotations (_setters ,
847+ _mergeAnnotations (_fields , _getters ));
843848 _setters = _applyAnnotations (_setters , ann );
844849 } else if (_fields != null ) {
845- AnnotationMap ann = _mergeAnnotations (0 , _fields , _getters );
850+ AnnotationMap ann = _mergeAnnotations (_fields , _getters );
846851 _fields = _applyAnnotations (_fields , ann );
847852 }
848853 }
849854 }
850855
851- private AnnotationMap _mergeAnnotations (int index ,
852- Linked <? extends AnnotatedMember >... nodes )
856+ private AnnotationMap _mergeAnnotations (Linked <? extends AnnotatedMember > node1 ,
857+ Linked <? extends AnnotatedMember > node2 )
853858 {
854- AnnotationMap ann = _getAllAnnotations (nodes [index ]);
855- while (++index < nodes .length ) {
856- if (nodes [index ] != null ) {
857- return AnnotationMap .merge (ann , _mergeAnnotations (index , nodes ));
858- }
859- }
860- return ann ;
859+ return AnnotationMap .merge (_getAllAnnotations (node1 ),
860+ _getAllAnnotations (node2 ));
861+ }
862+
863+ private AnnotationMap _mergeAnnotations (Linked <? extends AnnotatedMember > node1 ,
864+ AnnotationMap secondary )
865+ {
866+ return AnnotationMap .merge (_getAllAnnotations (node1 ), secondary );
861867 }
862868
863869 /**
864870 * Replacement, as per [databind#868], of simple access to annotations, which
865- * does "deep merge" if an as necessary.
866- *<pre>
867- * nodes[index].value.getAllAnnotations()
868- *</pre>
871+ * does "deep merge" if an as necessary, across alternate accessors of same type:
872+ * most importantly, "is-getter vs regular getter"
869873 */
870- private <T extends AnnotatedMember > AnnotationMap _getAllAnnotations (Linked <T > node ) {
874+ private AnnotationMap _getAllAnnotations (Linked <? extends AnnotatedMember > node ) {
875+ if (node == null ) {
876+ return null ;
877+ }
871878 AnnotationMap ann = node .value .getAllAnnotations ();
872879 if (node .next != null ) {
873880 ann = AnnotationMap .merge (ann , _getAllAnnotations (node .next ));
@@ -881,8 +888,6 @@ private <T extends AnnotatedMember> AnnotationMap _getAllAnnotations(Linked<T> n
881888 * and secondary accessors are pruned later on.
882889 *<p>
883890 * See [databind#868] for more information.
884- *
885- * @since 2.6
886891 */
887892 private <T extends AnnotatedMember > Linked <T > _applyAnnotations (Linked <T > node , AnnotationMap ann ) {
888893 @ SuppressWarnings ("unchecked" )
0 commit comments