aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/events
diff options
context:
space:
mode:
authorGravatar Francois-Rene Rideau <tunes@google.com>2015-09-10 18:53:03 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-11 09:45:33 +0000
commit89312fbebfdab4c4ab977063782237cd8369a8c7 (patch)
tree7a238467e05767608d9d7a122f65a10011092e71 /src/main/java/com/google/devtools/build/lib/events
parent5831c6957d29e8fda0383bfe337533444c5155c8 (diff)
Refactor Skylark Environment-s
Make Environment-s freezable: Introduce a class Mutability as a revokable capability to mutate objects in an Environment. For now, only Environment-s carry this capability. Make sure that every Mutability is revoked in the same function that create... This reinstates a change that previously rolled-back because it broke the serializability of SkylarkLookupValue. Bad news: serializing it succeeds for the wrong reason, because a SkylarkEnvironment was stored as a result (now an Environment.Extension) that was Serializable but inherited its bindings from an Environment (now an Environment.BaseExtension) which wasn't Serializable. Apparently, Java doesn't try to serialize the bindings then (or at least doesn't error out when it fails), because these bindings map variable names to pretty arbitrary objects, and a lot of those we find in practice aren't Serializable. Thus the current code passes the same tests as the previous code, but obviously the serialization is just as ineffective as it used to be. -- MOS_MIGRATED_REVID=102776694
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/events')
-rw-r--r--src/main/java/com/google/devtools/build/lib/events/Location.java12
1 files changed, 12 insertions, 0 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 74b04a913a..1b9110d664 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
@@ -149,6 +149,18 @@ public abstract class Location implements Serializable {
}
/**
+ * Returns a line corresponding to the position denoted by getStartOffset.
+ * Returns null if this information is not available.
+ */
+ public Integer getStartLine() {
+ LineAndColumn lac = getStartLineAndColumn();
+ if (lac == null) {
+ return null;
+ }
+ return lac.getLine();
+ }
+
+ /**
* Returns a (line, column) pair corresponding to the position denoted by
* getEndOffset. Returns null if this information is not available.
*/