Files
sdk/pkg/vm_service/tool/java/version.properties
T
Helin Shiah 43d124c212 Fix Java code generation for lookup URI methods
The java generation for type `(string|Null)[]` was creating `@return one of <code>List<String></code> or <code>ElementList<Null></code>`

see example:
```
@SuppressWarnings({"WeakerAccess", "unused"})
public class UriList extends Response {

  public UriList(JsonObject json) {
    super(json);
  }

  /**
   * A list of URIs.
   *
   * @return one of <code>List<String></code> or <code>ElementList<Null></code>
   */
  public Object getUris() {
    final JsonObject elem = (JsonObject)json.get("uris");
    if (elem == null) return null;

    if (elem.get("type").getAsString().equals("String")) return new String(elem);
    if (elem.get("type").getAsString().equals("Null")) return new Null(elem);
    return null;
  }
```

My change is the simplest thing I could think of, just making the return type `List<String>` instead and allowing some of the elements to be null. But I'm happy to implement something else if someone has a suggestion for a better type (along with how to get the generate code to produce it)

Closes https://github.com/dart-lang/sdk/pull/48309
https://github.com/dart-lang/sdk/pull/48309

TEST=N/A

GitOrigin-RevId: fa9dddad68219e697998c4a011a82d6860f44bfb
Change-Id: I79cf2aedf0672354a2fd28c8962740f6fcea4f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231740
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-02-04 21:43:59 +00:00

2 lines
13 B
Properties