Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Unified Diff: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java

Issue 482573004: Change analysis server protocol to omit empty lists when optional. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java
index 10712f2a1ca5d5e99abe0c8ffc6400b2e7521494..350eee4a567b9917798df9a6fe54391accaf6538 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java
@@ -92,7 +92,7 @@ public class SearchResult {
Location location = Location.fromJson(jsonObject.get("location").getAsJsonObject());
String kind = jsonObject.get("kind").getAsString();
Boolean isPotential = jsonObject.get("isPotential").getAsBoolean();
- List<Element> path = Element.fromJsonArray(jsonObject.get("path").getAsJsonArray());
+ List<Element> path = jsonObject.get("path") == null ? null : Element.fromJsonArray(jsonObject.get("path").getAsJsonArray());
return new SearchResult(location, kind, isPotential, path);
}
@@ -144,11 +144,13 @@ public class SearchResult {
jsonObject.add("location", location.toJson());
jsonObject.addProperty("kind", kind);
jsonObject.addProperty("isPotential", isPotential);
- JsonArray jsonArrayPath = new JsonArray();
- for(Element elt : path) {
- jsonArrayPath.add(elt.toJson());
+ if (path != null) {
+ JsonArray jsonArrayPath = new JsonArray();
+ for(Element elt : path) {
+ jsonArrayPath.add(elt.toJson());
+ }
+ jsonObject.add("path", jsonArrayPath);
}
- jsonObject.add("path", jsonArrayPath);
return jsonObject;
}

Powered by Google App Engine
This is Rietveld 408576698