| Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/JsonProcessor.java
|
| diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/JsonProcessor.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/JsonProcessor.java
|
| index c80c279e0b2f935b9c5f5a01743e98b3ac2a5be9..e53c986f6366f850bf50c4a8f309bfaf6c7e6948 100644
|
| --- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/JsonProcessor.java
|
| +++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/JsonProcessor.java
|
| @@ -16,16 +16,8 @@ package com.google.dart.server.internal.remote.processor;
|
| import com.google.common.collect.Lists;
|
| import com.google.dart.server.RefactoringProblem;
|
| import com.google.dart.server.RefactoringProblemSeverity;
|
| -import com.google.dart.server.SourceChange;
|
| -import com.google.dart.server.SourceEdit;
|
| -import com.google.dart.server.SourceFileEdit;
|
| -import com.google.dart.server.generated.types.AnalysisError;
|
| -import com.google.dart.server.generated.types.Element;
|
| import com.google.dart.server.generated.types.Location;
|
| import com.google.dart.server.internal.RefactoringProblemImpl;
|
| -import com.google.dart.server.internal.SourceChangeImpl;
|
| -import com.google.dart.server.internal.SourceEditImpl;
|
| -import com.google.dart.server.internal.SourceFileEditImpl;
|
| import com.google.dart.server.utilities.general.StringUtilities;
|
| import com.google.gson.JsonArray;
|
| import com.google.gson.JsonElement;
|
| @@ -43,39 +35,6 @@ import java.util.List;
|
| */
|
| public abstract class JsonProcessor {
|
|
|
| - protected AnalysisError constructAnalysisError(JsonObject errorObject) {
|
| - String errorSeverity = errorObject.get("severity").getAsString();
|
| - String errorType = errorObject.get("type").getAsString();
|
| - Location location = constructLocation(errorObject.get("location").getAsJsonObject());
|
| - String message = errorObject.get("message").getAsString();
|
| - String correction = safelyGetAsString(errorObject, "correction");
|
| - return new AnalysisError(errorSeverity, errorType, location, message, correction);
|
| - }
|
| -
|
| - protected Element constructElement(JsonObject elementObject) {
|
| - String kind = elementObject.get("kind").getAsString();
|
| - String name = elementObject.get("name").getAsString();
|
| - Location location = constructLocation(elementObject.get("location").getAsJsonObject());
|
| - int flags = elementObject.get("flags").getAsInt();
|
| - String parameters = safelyGetAsString(elementObject, "parameters");
|
| - String returnType = safelyGetAsString(elementObject, "returnType");
|
| - return new Element(kind, name, location, flags, parameters, returnType);
|
| - }
|
| -
|
| - protected Element[] constructElementArray(JsonArray jsonArray) {
|
| - if (jsonArray == null) {
|
| - return new Element[] {};
|
| - }
|
| - int i = 0;
|
| - Element[] elements = new Element[jsonArray.size()];
|
| - Iterator<JsonElement> iterator = jsonArray.iterator();
|
| - while (iterator.hasNext()) {
|
| - elements[i] = constructElement(iterator.next().getAsJsonObject());
|
| - ++i;
|
| - }
|
| - return elements;
|
| - }
|
| -
|
| /**
|
| * Given some {@link JsonArray} and of {@code int} primitives, return the {@code int[]}.
|
| *
|
| @@ -96,15 +55,6 @@ public abstract class JsonProcessor {
|
| return ints;
|
| }
|
|
|
| - protected Location constructLocation(JsonObject locationObject) {
|
| - String file = locationObject.get("file").getAsString();
|
| - int offset = locationObject.get("offset").getAsInt();
|
| - int length = locationObject.get("length").getAsInt();
|
| - int startLine = locationObject.get("startLine").getAsInt();
|
| - int startColumn = locationObject.get("startColumn").getAsInt();
|
| - return new Location(file, offset, length, startLine, startColumn);
|
| - }
|
| -
|
| protected RefactoringProblem[] constructRefactoringProblemArray(JsonArray problemsArray) {
|
| ArrayList<RefactoringProblem> problems = new ArrayList<RefactoringProblem>();
|
| Iterator<JsonElement> iter = problemsArray.iterator();
|
| @@ -115,41 +65,12 @@ public abstract class JsonProcessor {
|
| problems.add(new RefactoringProblemImpl(
|
| RefactoringProblemSeverity.valueOf(problemObject.get("severity").getAsString()),
|
| problemObject.get("message").getAsString(),
|
| - constructLocation(problemObject.get("location").getAsJsonObject())));
|
| + Location.fromJson(problemObject.get("location").getAsJsonObject())));
|
| }
|
| }
|
| return problems.toArray(new RefactoringProblem[problems.size()]);
|
| }
|
|
|
| - protected SourceChange constructSourceChange(JsonObject sourceChangeObject) {
|
| - String message = sourceChangeObject.get("message").getAsString();
|
| - ArrayList<SourceFileEdit> sourceFileEdits = new ArrayList<SourceFileEdit>();
|
| - Iterator<JsonElement> iter = sourceChangeObject.get("edits").getAsJsonArray().iterator();
|
| - while (iter.hasNext()) {
|
| - JsonElement sourceFileEditElement = iter.next();
|
| - if (sourceFileEditElement instanceof JsonObject) {
|
| - sourceFileEdits.add(constructSourceFileEdit((JsonObject) sourceFileEditElement));
|
| - }
|
| - }
|
| - return new SourceChangeImpl(
|
| - message,
|
| - sourceFileEdits.toArray(new SourceFileEdit[sourceFileEdits.size()]));
|
| - }
|
| -
|
| - protected SourceChange[] constructSourceChangeArray(JsonArray jsonArray) {
|
| - if (jsonArray == null) {
|
| - return SourceChange.EMPTY_ARRAY;
|
| - }
|
| - int i = 0;
|
| - SourceChange[] sourceChanges = new SourceChange[jsonArray.size()];
|
| - Iterator<JsonElement> iterator = jsonArray.iterator();
|
| - while (iterator.hasNext()) {
|
| - sourceChanges[i] = constructSourceChange(iterator.next().getAsJsonObject());
|
| - ++i;
|
| - }
|
| - return sourceChanges;
|
| - }
|
| -
|
| /**
|
| * Given some {@link JsonArray} and of string primitives, return the {@link String} array.
|
| *
|
| @@ -248,22 +169,4 @@ public abstract class JsonProcessor {
|
| return jsonElement.getAsString();
|
| }
|
| }
|
| -
|
| - private SourceEdit constructSourceEdit(JsonObject sourceEditObject) {
|
| - return new SourceEditImpl(sourceEditObject.get("offset").getAsInt(), sourceEditObject.get(
|
| - "length").getAsInt(), sourceEditObject.get("replacement").getAsString());
|
| - }
|
| -
|
| - private SourceFileEdit constructSourceFileEdit(JsonObject sourceFileEditObject) {
|
| - String file = sourceFileEditObject.get("file").getAsString();
|
| - ArrayList<SourceEdit> sourceEdits = new ArrayList<SourceEdit>();
|
| - Iterator<JsonElement> iter = sourceFileEditObject.get("edits").getAsJsonArray().iterator();
|
| - while (iter.hasNext()) {
|
| - JsonElement sourceEditElement = iter.next();
|
| - if (sourceEditElement instanceof JsonObject) {
|
| - sourceEdits.add(constructSourceEdit((JsonObject) sourceEditElement));
|
| - }
|
| - }
|
| - return new SourceFileEditImpl(file, sourceEdits.toArray(new SourceEdit[sourceEdits.size()]));
|
| - }
|
| }
|
|
|