diff options
author | michajlo <michajlo@google.com> | 2018-02-27 11:46:20 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-27 11:48:24 -0800 |
commit | 7af15ba9b09f82c57cd36c742c92b2761133c6a6 (patch) | |
tree | e03cb9ae89183793012f39ce4c3a6d272e23132b /src/main/java | |
parent | 8281f30abc6fb9a2eb453eb1178ef8fd2207156a (diff) |
Make Location#printLocation private
This is only used by the static method of the same name, which is only used by RuleFactory.
This method is showing up in profiles as creating more garbage than I'm happy with, but not
enough to make me drop everything and fix it now. Instead make it private so folks are less
inclined to use it later...
PiperOrigin-RevId: 187208467
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/events/Location.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/events/Location.java b/src/main/java/com/google/devtools/build/lib/events/Location.java index e6cc8de13b..162678dbf1 100644 --- a/src/main/java/com/google/devtools/build/lib/events/Location.java +++ b/src/main/java/com/google/devtools/build/lib/events/Location.java @@ -340,20 +340,17 @@ public abstract class Location implements Serializable { * <p>If such a location is not defined, this method returns an empty string. */ public static String printLocation(Location location) { - return (location == null) ? "" : location.printLocation(); - } - - /** - * Returns this location in the format "filename:line". - */ - public String printLocation() { + if (location == null) { + return ""; + } + StringBuilder builder = new StringBuilder(); - PathFragment path = getPath(); + PathFragment path = location.getPath(); if (path != null) { builder.append(path.getPathString()); } - LineAndColumn position = getStartLineAndColumn(); + LineAndColumn position = location.getStartLineAndColumn(); if (position != null) { builder.append(":").append(position.getLine()); } |