quicktype icon indicating copy to clipboard operation
quicktype copied to clipboard

fix: "List" should be one of Java keywords

Open qiaoruntao opened this issue 3 years ago • 0 comments

if List is not one of the Java keywords, following json will create conflict when using List<T> as array.

[
    {
        "list": {
            "a": [
                1
            ]
        }
    }
]

the incorrect result will be like

// List.java

package io.quicktype;

import com.fasterxml.jackson.annotation.*;
import java.util.List;

public class List {
    private List<Long> a;

    @JsonProperty("a")
    public List<Long> getA() { return a; }
    @JsonProperty("a")
    public void setA(List<Long> value) { this.a = value; }
}

Or maybe List should be a keyword only when array is generated byList<T> ?

qiaoruntao avatar Jul 15 '22 15:07 qiaoruntao