Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error when schema contains list with empty default value #59

Closed
joelittlejohn opened this issue Jun 23, 2013 · 1 comment
Closed
Milestone

Comments

@joelittlejohn
Copy link
Owner

Original author: [email protected] (July 08, 2012 01:30:24)

What steps will reproduce the problem?

  1. Generate code from this schema and compile:
    {
    "id": "test",
    "type": "object",
    "additionalProperties": false,
    "properties": {
    "basket": {
    "type": "array",
    "default": [],
    "items": {"type": "string"}
    }
    }
    }

What is the expected output?
Generated java code compiles successfully.

What do you see instead?
Basket_schema.java:20: cannot find symbol
symbol : constructor ArrayList(java.util.List<java.lang.Object>)
location: class java.util.ArrayList<java.lang.String>
private List<String> basket = new ArrayList<String>(Arrays.asList());

What version of the product are you using?
0.3.0

On what Java version?
java version "1.6.0_30"

Replacing this code (DefaultRule.getDefaultList(DefaultRule.java:159)):
newListImpl.arg(invokeAsList);
with this code:
if( invokeAsList.listArgs().length > 0 ){
newListImpl.arg(invokeAsList);
}
resolves the issue.

Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=59

@joelittlejohn
Copy link
Owner Author

From [email protected] on July 09, 2012 19:47:50
Fixed (r82afed4ccbda).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant