Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
org.dartlang.analysis.server.protocol.AnalysisError Class Reference

Public Member Functions

 AnalysisError (String severity, String type, Location location, String message, String correction, String code, String url, List< DiagnosticMessage > contextMessages, Boolean hasFix)
 
boolean equals (Object obj)
 
String getCode ()
 
List< DiagnosticMessagegetContextMessages ()
 
String getCorrection ()
 
Boolean getHasFix ()
 
Location getLocation ()
 
String getMessage ()
 
String getSeverity ()
 
String getType ()
 
String getUrl ()
 
int hashCode ()
 
JsonObject toJson ()
 
String toString ()
 

Static Public Member Functions

static AnalysisError fromJson (JsonObject jsonObject)
 
static List< AnalysisErrorfromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final AnalysisError[] EMPTY_ARRAY = new AnalysisError[0]
 
static final List< AnalysisErrorEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

An indication of an error, warning, or hint that was produced by the analysis.

@coverage dart.server.generated.types

Definition at line 32 of file AnalysisError.java.

Constructor & Destructor Documentation

◆ AnalysisError()

org.dartlang.analysis.server.protocol.AnalysisError.AnalysisError ( String  severity,
String  type,
Location  location,
String  message,
String  correction,
String  code,
String  url,
List< DiagnosticMessage contextMessages,
Boolean  hasFix 
)
inline

Constructor for AnalysisError.

Definition at line 96 of file AnalysisError.java.

96 {
97 this.severity = severity;
98 this.type = type;
99 this.location = location;
100 this.message = message;
101 this.correction = correction;
102 this.code = code;
103 this.url = url;
104 this.contextMessages = contextMessages;
105 this.hasFix = hasFix;
106 }

Member Function Documentation

◆ equals()

boolean org.dartlang.analysis.server.protocol.AnalysisError.equals ( Object  obj)
inline

Definition at line 109 of file AnalysisError.java.

109 {
110 if (obj instanceof AnalysisError) {
111 AnalysisError other = (AnalysisError) obj;
112 return
113 ObjectUtilities.equals(other.severity, severity) &&
114 ObjectUtilities.equals(other.type, type) &&
115 ObjectUtilities.equals(other.location, location) &&
116 ObjectUtilities.equals(other.message, message) &&
117 ObjectUtilities.equals(other.correction, correction) &&
118 ObjectUtilities.equals(other.code, code) &&
119 ObjectUtilities.equals(other.url, url) &&
120 ObjectUtilities.equals(other.contextMessages, contextMessages) &&
121 ObjectUtilities.equals(other.hasFix, hasFix);
122 }
123 return false;
124 }

◆ fromJson()

static AnalysisError org.dartlang.analysis.server.protocol.AnalysisError.fromJson ( JsonObject  jsonObject)
inlinestatic

Definition at line 126 of file AnalysisError.java.

126 {
127 String severity = jsonObject.get("severity").getAsString();
128 String type = jsonObject.get("type").getAsString();
129 Location location = Location.fromJson(jsonObject.get("location").getAsJsonObject());
130 String message = jsonObject.get("message").getAsString();
131 String correction = jsonObject.get("correction") == null ? null : jsonObject.get("correction").getAsString();
132 String code = jsonObject.get("code").getAsString();
133 String url = jsonObject.get("url") == null ? null : jsonObject.get("url").getAsString();
134 List<DiagnosticMessage> contextMessages = jsonObject.get("contextMessages") == null ? null : DiagnosticMessage.fromJsonArray(jsonObject.get("contextMessages").getAsJsonArray());
135 Boolean hasFix = jsonObject.get("hasFix") == null ? null : jsonObject.get("hasFix").getAsBoolean();
136 return new AnalysisError(severity, type, location, message, correction, code, url, contextMessages, hasFix);
137 }
AnalysisError(String severity, String type, Location location, String message, String correction, String code, String url, List< DiagnosticMessage > contextMessages, Boolean hasFix)

◆ fromJsonArray()

static List< AnalysisError > org.dartlang.analysis.server.protocol.AnalysisError.fromJsonArray ( JsonArray  jsonArray)
inlinestatic

Definition at line 139 of file AnalysisError.java.

139 {
140 if (jsonArray == null) {
141 return EMPTY_LIST;
142 }
143 ArrayList<AnalysisError> list = new ArrayList<AnalysisError>(jsonArray.size());
144 Iterator<JsonElement> iterator = jsonArray.iterator();
145 while (iterator.hasNext()) {
146 list.add(fromJson(iterator.next().getAsJsonObject()));
147 }
148 return list;
149 }
static AnalysisError fromJson(JsonObject jsonObject)
static final List< AnalysisError > EMPTY_LIST

◆ getCode()

String org.dartlang.analysis.server.protocol.AnalysisError.getCode ( )
inline

The name, as a string, of the error code associated with this error.

Definition at line 154 of file AnalysisError.java.

154 {
155 return code;
156 }

◆ getContextMessages()

List< DiagnosticMessage > org.dartlang.analysis.server.protocol.AnalysisError.getContextMessages ( )
inline

Additional messages associated with this diagnostic that provide context to help the user understand the diagnostic.

Definition at line 162 of file AnalysisError.java.

162 {
163 return contextMessages;
164 }

◆ getCorrection()

String org.dartlang.analysis.server.protocol.AnalysisError.getCorrection ( )
inline

The correction message to be displayed for this error. The correction message should indicate how the user can fix the error. The field is omitted if there is no correction message associated with the error code.

Definition at line 171 of file AnalysisError.java.

171 {
172 return correction;
173 }

◆ getHasFix()

Boolean org.dartlang.analysis.server.protocol.AnalysisError.getHasFix ( )
inline

A hint to indicate to interested clients that this error has an associated fix (or fixes). The absence of this field implies there are not known to be fixes. Note that since the operation to calculate whether fixes apply needs to be performant it is possible that complicated tests will be skipped and a false negative returned. For this reason, this attribute should be treated as a "hint". Despite the possibility of false negatives, no false positives should be returned. If a client sees this flag set they can proceed with the confidence that there are in fact associated fixes.

Definition at line 184 of file AnalysisError.java.

184 {
185 return hasFix;
186 }

◆ getLocation()

Location org.dartlang.analysis.server.protocol.AnalysisError.getLocation ( )
inline

The location associated with the error.

Definition at line 191 of file AnalysisError.java.

191 {
192 return location;
193 }

◆ getMessage()

String org.dartlang.analysis.server.protocol.AnalysisError.getMessage ( )
inline

The message to be displayed for this error. The message should indicate what is wrong with the code and why it is wrong.

Definition at line 199 of file AnalysisError.java.

199 {
200 return message;
201 }

◆ getSeverity()

String org.dartlang.analysis.server.protocol.AnalysisError.getSeverity ( )
inline

The severity of the error.

Definition at line 206 of file AnalysisError.java.

206 {
207 return severity;
208 }

◆ getType()

String org.dartlang.analysis.server.protocol.AnalysisError.getType ( )
inline

The type of the error.

Definition at line 213 of file AnalysisError.java.

213 {
214 return type;
215 }

◆ getUrl()

String org.dartlang.analysis.server.protocol.AnalysisError.getUrl ( )
inline

The URL of a page containing documentation associated with this error.

Definition at line 220 of file AnalysisError.java.

220 {
221 return url;
222 }

◆ hashCode()

int org.dartlang.analysis.server.protocol.AnalysisError.hashCode ( )
inline

Definition at line 225 of file AnalysisError.java.

225 {
226 HashCodeBuilder builder = new HashCodeBuilder();
227 builder.append(severity);
228 builder.append(type);
229 builder.append(location);
230 builder.append(message);
231 builder.append(correction);
232 builder.append(code);
233 builder.append(url);
234 builder.append(contextMessages);
235 builder.append(hasFix);
236 return builder.toHashCode();
237 }

◆ toJson()

JsonObject org.dartlang.analysis.server.protocol.AnalysisError.toJson ( )
inline

Definition at line 239 of file AnalysisError.java.

239 {
240 JsonObject jsonObject = new JsonObject();
241 jsonObject.addProperty("severity", severity);
242 jsonObject.addProperty("type", type);
243 jsonObject.add("location", location.toJson());
244 jsonObject.addProperty("message", message);
245 if (correction != null) {
246 jsonObject.addProperty("correction", correction);
247 }
248 jsonObject.addProperty("code", code);
249 if (url != null) {
250 jsonObject.addProperty("url", url);
251 }
252 if (contextMessages != null) {
253 JsonArray jsonArrayContextMessages = new JsonArray();
254 for (DiagnosticMessage elt : contextMessages) {
255 jsonArrayContextMessages.add(elt.toJson());
256 }
257 jsonObject.add("contextMessages", jsonArrayContextMessages);
258 }
259 if (hasFix != null) {
260 jsonObject.addProperty("hasFix", hasFix);
261 }
262 return jsonObject;
263 }

◆ toString()

String org.dartlang.analysis.server.protocol.AnalysisError.toString ( )
inline

Definition at line 266 of file AnalysisError.java.

266 {
267 StringBuilder builder = new StringBuilder();
268 builder.append("[");
269 builder.append("severity=");
270 builder.append(severity + ", ");
271 builder.append("type=");
272 builder.append(type + ", ");
273 builder.append("location=");
274 builder.append(location + ", ");
275 builder.append("message=");
276 builder.append(message + ", ");
277 builder.append("correction=");
278 builder.append(correction + ", ");
279 builder.append("code=");
280 builder.append(code + ", ");
281 builder.append("url=");
282 builder.append(url + ", ");
283 builder.append("contextMessages=");
284 builder.append(StringUtils.join(contextMessages, ", ") + ", ");
285 builder.append("hasFix=");
286 builder.append(hasFix);
287 builder.append("]");
288 return builder.toString();
289 }

Member Data Documentation

◆ EMPTY_ARRAY

final AnalysisError [] org.dartlang.analysis.server.protocol.AnalysisError.EMPTY_ARRAY = new AnalysisError[0]
static

Definition at line 34 of file AnalysisError.java.

◆ EMPTY_LIST

final List<AnalysisError> org.dartlang.analysis.server.protocol.AnalysisError.EMPTY_LIST = Lists.newArrayList()
static

Definition at line 36 of file AnalysisError.java.


The documentation for this class was generated from the following file: