diff options
author | 2017-03-30 20:01:17 +0000 | |
---|---|---|
committer | 2017-03-31 17:10:55 +0200 | |
commit | 63111882e794f786ab857c92b01383a457e843a4 (patch) | |
tree | 5cc7ca888d8539f202de10ca621b9a54a2c9f1ab | |
parent | 584dc717e64df4e50d7f657eb2878f53295eab12 (diff) |
Delete STRING_DICT_UNARY
This isn't used anymore, it's the same as STRING_DICT, deleting so no one tries
to use it.
PiperOrigin-RevId: 151738915
6 files changed, 1 insertions, 84 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java b/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java index 4a1c283a3a..f14ca5db7d 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java +++ b/src/main/java/com/google/devtools/build/lib/packages/AttributeFormatter.java @@ -30,7 +30,6 @@ import static com.google.devtools.build.lib.syntax.Type.INTEGER; import static com.google.devtools.build.lib.syntax.Type.INTEGER_LIST; import static com.google.devtools.build.lib.syntax.Type.STRING; import static com.google.devtools.build.lib.syntax.Type.STRING_DICT; -import static com.google.devtools.build.lib.syntax.Type.STRING_DICT_UNARY; import static com.google.devtools.build.lib.syntax.Type.STRING_LIST; import static com.google.devtools.build.lib.syntax.Type.STRING_LIST_DICT; @@ -49,7 +48,6 @@ import com.google.devtools.build.lib.query2.proto.proto2api.Build.LabelDictUnary import com.google.devtools.build.lib.query2.proto.proto2api.Build.LabelKeyedStringDictEntry; import com.google.devtools.build.lib.query2.proto.proto2api.Build.LabelListDictEntry; import com.google.devtools.build.lib.query2.proto.proto2api.Build.StringDictEntry; -import com.google.devtools.build.lib.query2.proto.proto2api.Build.StringDictUnaryEntry; import com.google.devtools.build.lib.query2.proto.proto2api.Build.StringListDictEntry; import com.google.devtools.build.lib.syntax.Type; import java.util.Collection; @@ -212,15 +210,6 @@ public class AttributeFormatter { .setValue(keyValueList.getValue()); builder.addStringDictValue(entry); } - } else if (type == STRING_DICT_UNARY) { - Map<String, String> dict = (Map<String, String>) value; - for (Map.Entry<String, String> dictEntry : dict.entrySet()) { - StringDictUnaryEntry.Builder entry = - StringDictUnaryEntry.newBuilder() - .setKey(dictEntry.getKey()) - .setValue(dictEntry.getValue()); - builder.addStringDictUnaryValue(entry); - } } else if (type == STRING_LIST_DICT) { Map<String, List<String>> dict = (Map<String, List<String>>) value; for (Map.Entry<String, List<String>> dictEntry : dict.entrySet()) { @@ -327,8 +316,6 @@ public class AttributeFormatter { void addIntListValue(int i); - void addStringDictUnaryValue(StringDictUnaryEntry.Builder builder); - void addStringDictValue(StringDictEntry.Builder builder); void addStringListDictValue(StringListDictEntry.Builder builder); @@ -398,11 +385,6 @@ public class AttributeFormatter { } @Override - public void addStringDictUnaryValue(StringDictUnaryEntry.Builder builder) { - attributeBuilder.addStringDictUnaryValue(builder); - } - - @Override public void addStringDictValue(StringDictEntry.Builder builder) { attributeBuilder.addStringDictValue(builder); } @@ -529,11 +511,6 @@ public class AttributeFormatter { } @Override - public void addStringDictUnaryValue(StringDictUnaryEntry.Builder builder) { - selectorEntryBuilder.addStringDictUnaryValue(builder); - } - - @Override public void addStringDictValue(StringDictEntry.Builder builder) { selectorEntryBuilder.addStringDictValue(builder); } diff --git a/src/main/java/com/google/devtools/build/lib/packages/ProtoUtils.java b/src/main/java/com/google/devtools/build/lib/packages/ProtoUtils.java index 7c0335d406..29d56c6983 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/ProtoUtils.java +++ b/src/main/java/com/google/devtools/build/lib/packages/ProtoUtils.java @@ -31,7 +31,6 @@ import static com.google.devtools.build.lib.syntax.Type.INTEGER; import static com.google.devtools.build.lib.syntax.Type.INTEGER_LIST; import static com.google.devtools.build.lib.syntax.Type.STRING; import static com.google.devtools.build.lib.syntax.Type.STRING_DICT; -import static com.google.devtools.build.lib.syntax.Type.STRING_DICT_UNARY; import static com.google.devtools.build.lib.syntax.Type.STRING_LIST; import static com.google.devtools.build.lib.syntax.Type.STRING_LIST_DICT; @@ -68,7 +67,6 @@ public class ProtoUtils { .put(BOOLEAN, Discriminator.BOOLEAN) .put(TRISTATE, Discriminator.TRISTATE) .put(INTEGER_LIST, Discriminator.INTEGER_LIST) - .put(STRING_DICT_UNARY, Discriminator.STRING_DICT_UNARY) .put(LABEL_KEYED_STRING_DICT, Discriminator.LABEL_KEYED_STRING_DICT) .build(); diff --git a/src/main/java/com/google/devtools/build/lib/query2/output/ProtoOutputFormatter.java b/src/main/java/com/google/devtools/build/lib/query2/output/ProtoOutputFormatter.java index f966afb88d..66fd324743 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/output/ProtoOutputFormatter.java +++ b/src/main/java/com/google/devtools/build/lib/query2/output/ProtoOutputFormatter.java @@ -432,7 +432,6 @@ public class ProtoOutputFormatter extends AbstractUnorderedFormatter { // Same for maps as for collections. if (attrType == Type.STRING_DICT - || attrType == Type.STRING_DICT_UNARY || attrType == Type.STRING_LIST_DICT || attrType == BuildType.LABEL_DICT_UNARY || attrType == BuildType.LABEL_KEYED_STRING_DICT) { diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Type.java b/src/main/java/com/google/devtools/build/lib/syntax/Type.java index fc89927c42..6a0a76b4bf 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/Type.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/Type.java @@ -229,12 +229,6 @@ public abstract class Type<T> { DictType.create(STRING, STRING_LIST); /** - * The type of a dictionary of {@linkplain #STRING strings}, where each entry - * maps to a single string value. - */ - public static final DictType<String, String> STRING_DICT_UNARY = DictType.create(STRING, STRING); - - /** * For ListType objects, returns the type of the elements of the list; for * all other types, returns null. (This non-obvious implementation strategy * is necessitated by the wildcard capture rules of the Java type system, diff --git a/src/main/protobuf/build.proto b/src/main/protobuf/build.proto index fe4534abb8..029e0cfaf2 100644 --- a/src/main/protobuf/build.proto +++ b/src/main/protobuf/build.proto @@ -133,7 +133,7 @@ message Attribute { BOOLEAN = 14; // int, bool and string value TRISTATE = 15; // tristate, int and string value INTEGER_LIST = 16; // int_list_value - STRING_DICT_UNARY = 17; // string_dict_unary_value + STRING_DICT_UNARY = 17; // string_dict_unary_value (DEPRECATED) UNKNOWN = 18; // unknown type, use only for build extensions LABEL_DICT_UNARY = 19; // label_dict_unary_value SELECTOR_LIST = 20; // selector_list 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 26d9a3955b..4efe9d0c9c 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 @@ -437,57 +437,6 @@ public class TypeTest { } @Test - public void testStringDictUnary() throws Exception { - Object input = ImmutableMap.of("foo", "bar", - "wiz", "bang"); - Map<?, ?> converted = - Type.STRING_DICT_UNARY.convert(input, null, currentRule); - Map<?, ?> expected = ImmutableMap.<String, String>of( - "foo", "bar", - "wiz", "bang"); - assertEquals(expected, converted); - assertNotSame(expected, converted); - assertThat(collectLabels(Type.STRING_DICT_UNARY, converted)).isEmpty(); - } - - @Test - public void testStringDictUnaryBadFirstElement() throws Exception { - Object input = ImmutableMap.of(2, Arrays.asList("foo", "bar"), - "wiz", Arrays.asList("bang")); - try { - Type.STRING_DICT_UNARY.convert(input, null, currentRule); - fail(); - } catch (Type.ConversionException e) { - assertThat(e).hasMessage("expected value of type 'string' for dict key element, but got " - + "2 (int)"); - } - } - - @Test - public void testStringDictUnaryBadSecondElement() throws Exception { - Object input = ImmutableMap.of("foo", "bar", "wiz", MutableList.of(null, "bang")); - try { - Type.STRING_DICT_UNARY.convert(input, null, currentRule); - fail(); - } catch (Type.ConversionException e) { - assertThat(e).hasMessage("expected value of type 'string' for dict value element, but got " - + "[\"bang\"] (list)"); - } - } - - @Test - public void testStringDictUnaryBadElements1() throws Exception { - Object input = ImmutableMap.of("foo", "bar", Tuple.of("foo", "bar"), Tuple.of("wiz", "bang")); - try { - Type.STRING_DICT_UNARY.convert(input, null); - fail(); - } catch (Type.ConversionException e) { - assertThat(e).hasMessage("expected value of type 'string' for dict key element, but got " - + "(\"foo\", \"bar\") (tuple)"); - } - } - - @Test public void testStringDictThrowsConversionException() throws Exception { try { Type.STRING_DICT.convert("some string", null); |