@@ -58,15 +58,29 @@ public final class XmlReadContext
5858 /**********************************************************************
5959 */
6060
61- public XmlReadContext (XmlReadContext parent , int type , int lineNr , int colNr )
61+ /**
62+ * @since 2.18
63+ */
64+ public XmlReadContext (XmlReadContext parent , int nestingDepth ,
65+ int type , int lineNr , int colNr )
6266 {
6367 super ();
6468 _type = type ;
6569 _parent = parent ;
6670 _lineNr = lineNr ;
6771 _columnNr = colNr ;
6872 _index = -1 ;
69- _nestingDepth = parent == null ? 0 : parent ._nestingDepth + 1 ;
73+ _nestingDepth = nestingDepth ;
74+ }
75+
76+ /**
77+ * @deprecated Since 2.18
78+ */
79+ @ Deprecated // since 2.18
80+ public XmlReadContext (XmlReadContext parent , int type , int lineNr , int colNr )
81+ {
82+ this (parent , (parent == null ) ? 0 : parent ._nestingDepth + 1 ,
83+ type , lineNr , colNr );
7084 }
7185
7286 protected final void reset (int type , int lineNr , int colNr )
@@ -98,19 +112,19 @@ public void setCurrentValue(Object v) {
98112 */
99113
100114 public static XmlReadContext createRootContext (int lineNr , int colNr ) {
101- return new XmlReadContext (null , TYPE_ROOT , lineNr , colNr );
115+ return new XmlReadContext (null , 0 , TYPE_ROOT , lineNr , colNr );
102116 }
103117
104118 public static XmlReadContext createRootContext () {
105- return new XmlReadContext (null , TYPE_ROOT , 1 , 0 );
119+ return new XmlReadContext (null , 0 , TYPE_ROOT , 1 , 0 );
106120 }
107121
108122 public final XmlReadContext createChildArrayContext (int lineNr , int colNr )
109123 {
110124 ++_index ; // not needed for Object, but does not hurt so no need to check curr type
111125 XmlReadContext ctxt = _child ;
112126 if (ctxt == null ) {
113- _child = ctxt = new XmlReadContext (this , TYPE_ARRAY , lineNr , colNr );
127+ _child = ctxt = new XmlReadContext (this , _nestingDepth + 1 , TYPE_ARRAY , lineNr , colNr );
114128 return ctxt ;
115129 }
116130 ctxt .reset (TYPE_ARRAY , lineNr , colNr );
0 commit comments