@@ -58,15 +58,29 @@ public final class XmlReadContext
58
58
/**********************************************************************
59
59
*/
60
60
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 )
62
66
{
63
67
super ();
64
68
_type = type ;
65
69
_parent = parent ;
66
70
_lineNr = lineNr ;
67
71
_columnNr = colNr ;
68
72
_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 );
70
84
}
71
85
72
86
protected final void reset (int type , int lineNr , int colNr )
@@ -98,19 +112,19 @@ public void setCurrentValue(Object v) {
98
112
*/
99
113
100
114
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 );
102
116
}
103
117
104
118
public static XmlReadContext createRootContext () {
105
- return new XmlReadContext (null , TYPE_ROOT , 1 , 0 );
119
+ return new XmlReadContext (null , 0 , TYPE_ROOT , 1 , 0 );
106
120
}
107
121
108
122
public final XmlReadContext createChildArrayContext (int lineNr , int colNr )
109
123
{
110
124
++_index ; // not needed for Object, but does not hurt so no need to check curr type
111
125
XmlReadContext ctxt = _child ;
112
126
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 );
114
128
return ctxt ;
115
129
}
116
130
ctxt .reset (TYPE_ARRAY , lineNr , colNr );
0 commit comments