Skip to content

Commit

Permalink
Minor 2.18-only clean up for #657
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 21, 2024
1 parent 9da8029 commit bbda4ea
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,29 @@ public final class XmlReadContext
/**********************************************************************
*/

public XmlReadContext(XmlReadContext parent, int type, int lineNr, int colNr)
/**
* @since 2.18
*/
public XmlReadContext(XmlReadContext parent, int nestingDepth,
int type, int lineNr, int colNr)
{
super();
_type = type;
_parent = parent;
_lineNr = lineNr;
_columnNr = colNr;
_index = -1;
_nestingDepth = parent == null ? 0 : parent._nestingDepth + 1;
_nestingDepth = nestingDepth;
}

/**
* @deprecated Since 2.18
*/
@Deprecated // since 2.18
public XmlReadContext(XmlReadContext parent, int type, int lineNr, int colNr)
{
this(parent, (parent == null) ? 0 : parent._nestingDepth + 1,
type, lineNr, colNr);
}

protected final void reset(int type, int lineNr, int colNr)
Expand Down Expand Up @@ -98,19 +112,19 @@ public void setCurrentValue(Object v) {
*/

public static XmlReadContext createRootContext(int lineNr, int colNr) {
return new XmlReadContext(null, TYPE_ROOT, lineNr, colNr);
return new XmlReadContext(null, 0, TYPE_ROOT, lineNr, colNr);
}

public static XmlReadContext createRootContext() {
return new XmlReadContext(null, TYPE_ROOT, 1, 0);
return new XmlReadContext(null, 0, TYPE_ROOT, 1, 0);
}

public final XmlReadContext createChildArrayContext(int lineNr, int colNr)
{
++_index; // not needed for Object, but does not hurt so no need to check curr type
XmlReadContext ctxt = _child;
if (ctxt == null) {
_child = ctxt = new XmlReadContext(this, TYPE_ARRAY, lineNr, colNr);
_child = ctxt = new XmlReadContext(this, _nestingDepth+1, TYPE_ARRAY, lineNr, colNr);
return ctxt;
}
ctxt.reset(TYPE_ARRAY, lineNr, colNr);
Expand Down

0 comments on commit bbda4ea

Please sign in to comment.