Add a new optional field - 'id' to SourceChange.

R=brianwilkerson@google.com

Change-Id: Ibe85415be35982327593ffd1187ec74b1d037463
Reviewed-on: https://dart-review.googlesource.com/40102
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2018-02-08 20:13:11 +00:00 committed by commit-bot@chromium.org
parent 7c059b2ac8
commit ffd67154f7
9 changed files with 87 additions and 12 deletions

View file

@ -109,7 +109,7 @@ a:focus, a:hover {
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
1.18.5
1.18.6
</h1>
<p>
This document contains a specification of the API provided by the
@ -4275,6 +4275,12 @@ a:focus, a:hover {
The position that should be selected after the edits have been
applied.
</p>
</dd><dt class="field"><b>id: String<span style="color:#999999"> (optional)</span></b></dt><dd>
<p>
The optional identifier of the change kind. The identifier remains
stable even if the message changes, or is parameterized.
</p>
</dd></dl></dd><dt class="typeDefinition"><a name="type_SourceEdit">SourceEdit: object</a></dt><dd>
<p>
A description of a single change to a single file.

View file

@ -108,7 +108,7 @@ class AnalysisServer {
* The version of the analysis server. The value should be replaced
* automatically during the build.
*/
static final String VERSION = '1.18.5';
static final String VERSION = '1.18.6';
/**
* The options of this server instance.

View file

@ -1281,6 +1281,7 @@ final Matcher isServerService = new MatchesEnum("ServerService", ["STATUS"]);
* "edits": List<SourceFileEdit>
* "linkedEditGroups": List<LinkedEditGroup>
* "selection": optional Position
* "id": optional String
* }
*/
final Matcher isSourceChange =
@ -1289,7 +1290,8 @@ final Matcher isSourceChange =
"edits": isListOf(isSourceFileEdit),
"linkedEditGroups": isListOf(isLinkedEditGroup)
}, optionalFields: {
"selection": isPosition
"selection": isPosition,
"id": isString
}));
/**

View file

@ -55,14 +55,21 @@ public class SourceChange {
*/
private final Position selection;
/**
* The optional identifier of the change kind. The identifier remains stable even if the message
* changes, or is parameterized.
*/
private final String id;
/**
* Constructor for {@link SourceChange}.
*/
public SourceChange(String message, List<SourceFileEdit> edits, List<LinkedEditGroup> linkedEditGroups, Position selection) {
public SourceChange(String message, List<SourceFileEdit> edits, List<LinkedEditGroup> linkedEditGroups, Position selection, String id) {
this.message = message;
this.edits = edits;
this.linkedEditGroups = linkedEditGroups;
this.selection = selection;
this.id = id;
}
@Override
@ -73,7 +80,8 @@ public class SourceChange {
ObjectUtilities.equals(other.message, message) &&
ObjectUtilities.equals(other.edits, edits) &&
ObjectUtilities.equals(other.linkedEditGroups, linkedEditGroups) &&
ObjectUtilities.equals(other.selection, selection);
ObjectUtilities.equals(other.selection, selection) &&
ObjectUtilities.equals(other.id, id);
}
return false;
}
@ -83,7 +91,8 @@ public class SourceChange {
List<SourceFileEdit> edits = SourceFileEdit.fromJsonArray(jsonObject.get("edits").getAsJsonArray());
List<LinkedEditGroup> linkedEditGroups = LinkedEditGroup.fromJsonArray(jsonObject.get("linkedEditGroups").getAsJsonArray());
Position selection = jsonObject.get("selection") == null ? null : Position.fromJson(jsonObject.get("selection").getAsJsonObject());
return new SourceChange(message, edits, linkedEditGroups, selection);
String id = jsonObject.get("id") == null ? null : jsonObject.get("id").getAsString();
return new SourceChange(message, edits, linkedEditGroups, selection, id);
}
public static List<SourceChange> fromJsonArray(JsonArray jsonArray) {
@ -105,6 +114,14 @@ public class SourceChange {
return edits;
}
/**
* The optional identifier of the change kind. The identifier remains stable even if the message
* changes, or is parameterized.
*/
public String getId() {
return id;
}
/**
* A list of the linked editing groups used to customize the changes that were made.
*/
@ -133,6 +150,7 @@ public class SourceChange {
builder.append(edits);
builder.append(linkedEditGroups);
builder.append(selection);
builder.append(id);
return builder.toHashCode();
}
@ -152,6 +170,9 @@ public class SourceChange {
if (selection != null) {
jsonObject.add("selection", selection.toJson());
}
if (id != null) {
jsonObject.addProperty("id", id);
}
return jsonObject;
}
@ -166,7 +187,9 @@ public class SourceChange {
builder.append("linkedEditGroups=");
builder.append(StringUtils.join(linkedEditGroups, ", ") + ", ");
builder.append("selection=");
builder.append(selection);
builder.append(selection + ", ");
builder.append("id=");
builder.append(id);
builder.append("]");
return builder.toString();
}

View file

@ -7,7 +7,7 @@
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
<version>1.18.5</version>
<version>1.18.6</version>
</h1>
<p>
This document contains a specification of the API provided by the

View file

@ -1965,6 +1965,12 @@ a:focus, a:hover {
The position that should be selected after the edits have been
applied.
</p>
</dd><dt class="field"><b>id: String<span style="color:#999999"> (optional)</span></b></dt><dd>
<p>
The optional identifier of the change kind. The identifier remains
stable even if the message changes, or is parameterized.
</p>
</dd></dl></dd><dt class="typeDefinition"><a name="type_SourceEdit">SourceEdit: object</a></dt><dd>
<p>
A description of a single change to a single file.

View file

@ -5207,6 +5207,7 @@ class RemoveContentOverlay implements HasToJson {
* "edits": List<SourceFileEdit>
* "linkedEditGroups": List<LinkedEditGroup>
* "selection": optional Position
* "id": optional String
* }
*
* Clients may not extend, implement or mix-in this class.
@ -5220,6 +5221,8 @@ class SourceChange implements HasToJson {
Position _selection;
String _id;
/**
* A human-readable description of the change to be applied.
*/
@ -5273,10 +5276,25 @@ class SourceChange implements HasToJson {
this._selection = value;
}
/**
* The optional identifier of the change kind. The identifier remains stable
* even if the message changes, or is parameterized.
*/
String get id => _id;
/**
* The optional identifier of the change kind. The identifier remains stable
* even if the message changes, or is parameterized.
*/
void set id(String value) {
this._id = value;
}
SourceChange(String message,
{List<SourceFileEdit> edits,
List<LinkedEditGroup> linkedEditGroups,
Position selection}) {
Position selection,
String id}) {
this.message = message;
if (edits == null) {
this.edits = <SourceFileEdit>[];
@ -5289,6 +5307,7 @@ class SourceChange implements HasToJson {
this.linkedEditGroups = linkedEditGroups;
}
this.selection = selection;
this.id = id;
}
factory SourceChange.fromJson(
@ -5329,10 +5348,15 @@ class SourceChange implements HasToJson {
selection = new Position.fromJson(
jsonDecoder, jsonPath + ".selection", json["selection"]);
}
String id;
if (json.containsKey("id")) {
id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
}
return new SourceChange(message,
edits: edits,
linkedEditGroups: linkedEditGroups,
selection: selection);
selection: selection,
id: id);
} else {
throw jsonDecoder.mismatch(jsonPath, "SourceChange", json);
}
@ -5350,6 +5374,9 @@ class SourceChange implements HasToJson {
if (selection != null) {
result["selection"] = selection.toJson();
}
if (id != null) {
result["id"] = id;
}
return result;
}
@ -5389,7 +5416,8 @@ class SourceChange implements HasToJson {
(SourceFileEdit a, SourceFileEdit b) => a == b) &&
listEqual(linkedEditGroups, other.linkedEditGroups,
(LinkedEditGroup a, LinkedEditGroup b) => a == b) &&
selection == other.selection;
selection == other.selection &&
id == other.id;
}
return false;
}
@ -5401,6 +5429,7 @@ class SourceChange implements HasToJson {
hash = JenkinsSmiHash.combine(hash, edits.hashCode);
hash = JenkinsSmiHash.combine(hash, linkedEditGroups.hashCode);
hash = JenkinsSmiHash.combine(hash, selection.hashCode);
hash = JenkinsSmiHash.combine(hash, id.hashCode);
return JenkinsSmiHash.finish(hash);
}
}

View file

@ -849,6 +849,7 @@ final Matcher isRequestErrorCode = new MatchesEnum("RequestErrorCode", [
* "edits": List<SourceFileEdit>
* "linkedEditGroups": List<LinkedEditGroup>
* "selection": optional Position
* "id": optional String
* }
*/
final Matcher isSourceChange =
@ -857,7 +858,8 @@ final Matcher isSourceChange =
"edits": isListOf(isSourceFileEdit),
"linkedEditGroups": isListOf(isLinkedEditGroup)
}, optionalFields: {
"selection": isPosition
"selection": isPosition,
"id": isString
}));
/**

View file

@ -1349,6 +1349,13 @@
applied.
</p>
</field>
<field name="id" optional="true">
<ref>String</ref>
<p>
The optional identifier of the change kind. The identifier remains
stable even if the message changes, or is parameterized.
</p>
</field>
</object>
</type>
<type name="SourceEdit">