1.1 --- a/json/src/main/java/org/netbeans/html/json/impl/ModelProcessor.java Thu Feb 11 06:03:40 2016 +0100
1.2 +++ b/json/src/main/java/org/netbeans/html/json/impl/ModelProcessor.java Mon Feb 22 06:09:33 2016 +0100
1.3 @@ -263,11 +263,15 @@
1.4 String[] gs = toGetSet(p.name(), tn, p.array());
1.5 w.write(" this.prop_" + p.name() + " = proto.createList(\""
1.6 + p.name() + "\"");
1.7 - if (functionDeps.containsKey(p.name())) {
1.8 - int index = Arrays.asList(functionDeps.keySet().toArray()).indexOf(p.name());
1.9 - w.write(", " + index);
1.10 + if (p.mutable()) {
1.11 + if (functionDeps.containsKey(p.name())) {
1.12 + int index = Arrays.asList(functionDeps.keySet().toArray()).indexOf(p.name());
1.13 + w.write(", " + index);
1.14 + } else {
1.15 + w.write(", -1");
1.16 + }
1.17 } else {
1.18 - w.write(", -1");
1.19 + w.write(", java.lang.Integer.MIN_VALUE");
1.20 }
1.21 Collection<String[]> dependants = propsDeps.get(p.name());
1.22 if (dependants != null) {
1.23 @@ -672,6 +676,9 @@
1.24 w.write(" return (" + tn + ")prop_" + p.name() + ";\n");
1.25 w.write(" }\n");
1.26 w.write(" public void " + gs[1] + "(" + tn + " v) {\n");
1.27 + if (!p.mutable()) {
1.28 + w.write(" proto.initTo(null, null);\n");
1.29 + }
1.30 w.write(" proto.verifyUnlocked();\n");
1.31 w.write(" Object o = prop_" + p.name() + ";\n");
1.32 if (isModel[0]) {
1.33 @@ -2001,6 +2008,10 @@
1.34 return p.array();
1.35 }
1.36
1.37 + boolean mutable() {
1.38 + return p.mutable();
1.39 + }
1.40 +
1.41 String typeName(ProcessingEnvironment env) {
1.42 RuntimeException ex;
1.43 try {