Location { public Location toAbsoluteLocation() { Location absoluteParent = getValidParentAbsoluteLocation(); if (absoluteParent == null) { return this; } Location copy = new Location(this); boolean sameLine = copy.startLine == copy.endLine; if (copy.startLine == 0) { copy.startOffset += absoluteParent.startOffset; } if (sameLine) { copy.endOffset += absoluteParent.startOffset; } copy.startLine += absoluteParent.startLine; copy.endLine += absoluteParent.startLine; return copy; } Location();  Location(Location other);  Location(Token start, Token end);  Location(ParserRuleContext context);  Location(int startLine, int startOffset, int endLine, int endOffset); @Override String toString(); void setParentLocation(Location parentLocation); @Override boolean equals(Object o); @Override int hashCode(); boolean isValid(); boolean contains(Location other); Location toAbsoluteLocation(); String toUserReadableString(); static Location fromUserReadableString(String str); LocationScopeProvider createScope(); static final int NaN; @XmlAttribute(name = "startLine")
    public int startLine; @XmlAttribute(name = "startOffset")
    public int startOffset; @XmlAttribute(name = "endLine")
    public int endLine; @XmlAttribute(name = "endOffset")
    public int endOffset; @XmlElement(name = "parentLocation")
    public Location parentLocation; }
@Test public void testAbsolute() { Location loc = new Location(1, 2, 3, 4); assertEquals(loc, loc.toAbsoluteLocation()); }