Merge pull request #6680 from github/igfoo/java_location

Java: Use the standard URL format for Location.toString()
This commit is contained in:
Ian Lynagh
2021-09-13 13:43:32 +01:00
committed by GitHub
2 changed files with 6 additions and 11 deletions

View File

@@ -168,18 +168,10 @@ class Location extends @location {
/** Gets a string representation containing the file and range for this location. */
string toString() {
exists(File f, int startLine, int startCol, int endLine, int endCol |
locations_default(this, f, startLine, startCol, endLine, endCol)
exists(string filepath, int startLine, int startCol, int endLine, int endCol |
this.hasLocationInfo(filepath, startLine, startCol, endLine, endCol)
|
if endLine = startLine
then
result =
f.toString() + ":" + startLine.toString() + "[" + startCol.toString() + "-" +
endCol.toString() + "]"
else
result =
f.toString() + ":" + startLine.toString() + "[" + startCol.toString() + "]-" +
endLine.toString() + "[" + endCol.toString() + "]"
toUrl(filepath, startLine, startCol, endLine, endCol, result)
)
}