aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/syntax
diff options
context:
space:
mode:
authorGravatar nharmata <nharmata@google.com>2017-04-04 19:09:15 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-04-05 15:18:52 +0200
commitd705c98773afd3d08f7c04f71263b23f3dbc98f7 (patch)
treeee9c1a3b0d45b407769ca3a5b9d6a1a98d3138b4 /src/test/java/com/google/devtools/build/lib/syntax
parente5538add58a952c1ef660e417f3f38dabf73b768 (diff)
Rephrase AbstractAttributeMapper#visitLabels such that we can avoid creating a temporary Type.LabelVisitor instance per Attribute being visited. Instead, we can now create one temporary object per visitation. Getting rid of this dimension of scaling reduces the amount of garbage created.
RELNOTES: None PiperOrigin-RevId: 152161836
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax')
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/TypeTest.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/TypeTest.java b/src/test/java/com/google/devtools/build/lib/syntax/TypeTest.java
index 4efe9d0c9c..43cb4d47df 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/TypeTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/TypeTest.java
@@ -450,13 +450,16 @@ public class TypeTest {
private static ImmutableList<Label> collectLabels(Type<?> type, Object value)
throws InterruptedException {
final ImmutableList.Builder<Label> result = ImmutableList.builder();
- type.visitLabels(new Type.LabelVisitor() {
- @SuppressWarnings("unchecked")
- @Override
- public void visit(Label label) throws InterruptedException {
- result.add(label);
- }
- }, value);
+ type.visitLabels(
+ new Type.LabelVisitor<Object>() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void visit(Label label, Object dummy) throws InterruptedException {
+ result.add(label);
+ }
+ },
+ value,
+ /*context=*/ null);
return result.build();
}
}