| Index: pkg/analysis_server/tool/spec/codegen_java_types.dart
|
| diff --git a/pkg/analysis_server/tool/spec/codegen_java_types.dart b/pkg/analysis_server/tool/spec/codegen_java_types.dart
|
| index 6cbe5104b91eb394e915d32986d0d960b7cce110..5c90cea4110ede0a2e11114dd54b6311625de7a4 100644
|
| --- a/pkg/analysis_server/tool/spec/codegen_java_types.dart
|
| +++ b/pkg/analysis_server/tool/spec/codegen_java_types.dart
|
| @@ -259,34 +259,39 @@ class CodegenJavaType extends CodegenJavaVisitor {
|
| } else {
|
| publicMethod('fromJson', () {
|
| writeln(
|
| - '''private Outline fromJson(Outline parent, JsonObject outlineObject) {
|
| - JsonObject elementObject = outlineObject.get("element").getAsJsonObject();
|
| - Element element = Element.fromJson(elementObject);
|
| - int offset = outlineObject.get("offset").getAsInt();
|
| - int length = outlineObject.get("length").getAsInt();
|
| -
|
| - // create outline object
|
| - Outline outline = new Outline(parent, element, offset, length);
|
| -
|
| - // compute children recursively
|
| - List<Outline> childrenList = Lists.newArrayList();
|
| - JsonElement childrenJsonArray = outlineObject.get("children");
|
| - if (childrenJsonArray instanceof JsonArray) {
|
| - Iterator<JsonElement> childrenElementIterator = ((JsonArray) childrenJsonArray).iterator();
|
| - while (childrenElementIterator.hasNext()) {
|
| - JsonObject childObject = childrenElementIterator.next().getAsJsonObject();
|
| - childrenList.add(fromJson(outline, childObject));
|
| - }
|
| + '''public static Outline fromJson(Outline parent, JsonObject outlineObject) {
|
| + JsonObject elementObject = outlineObject.get("element").getAsJsonObject();
|
| + Element element = Element.fromJson(elementObject);
|
| + int offset = outlineObject.get("offset").getAsInt();
|
| + int length = outlineObject.get("length").getAsInt();
|
| +
|
| + // create outline object
|
| + Outline outline = new Outline(parent, element, offset, length);
|
| +
|
| + // compute children recursively
|
| + List<Outline> childrenList = Lists.newArrayList();
|
| + JsonElement childrenJsonArray = outlineObject.get("children");
|
| + if (childrenJsonArray instanceof JsonArray) {
|
| + Iterator<JsonElement> childrenElementIterator = ((JsonArray) childrenJsonArray).iterator();
|
| + while (childrenElementIterator.hasNext()) {
|
| + JsonObject childObject = childrenElementIterator.next().getAsJsonObject();
|
| + childrenList.add(fromJson(outline, childObject));
|
| }
|
| - outline.setChildren(childrenList);
|
| - return outline;
|
| - }''');
|
| + }
|
| + outline.setChildren(childrenList);
|
| + return outline;
|
| +}''');
|
| });
|
| publicMethod('setChildren', () {
|
| writeln('''public void setChildren(List<Outline> children) {
|
| - this.children = children;
|
| - }''');
|
| + this.children = children;
|
| +}''');
|
| });
|
| + publicMethod('getParent', () {
|
| + writeln('''public Outline getParent() {
|
| + return parent;
|
| +}''');
|
| + });
|
| }
|
|
|
| //
|
|
|