1.1 --- a/json/src/main/java/org/apidesign/html/json/impl/ModelProcessor.java Thu Sep 05 18:36:44 2013 +0200
1.2 +++ b/json/src/main/java/org/apidesign/html/json/impl/ModelProcessor.java Sat Sep 07 07:36:43 2013 +0200
1.3 @@ -214,40 +214,42 @@
1.4 }
1.5 }
1.6 w.append(" };\n");
1.7 - w.append(" public ").append(className).append("(");
1.8 - Prprt firstArray = null;
1.9 - String sep = "";
1.10 - for (Prprt p : props) {
1.11 - if (p.array()) {
1.12 - if (firstArray == null) {
1.13 - firstArray = p;
1.14 + if (props.length > 0) {
1.15 + w.append(" public ").append(className).append("(");
1.16 + Prprt firstArray = null;
1.17 + String sep = "";
1.18 + for (Prprt p : props) {
1.19 + if (p.array()) {
1.20 + if (firstArray == null) {
1.21 + firstArray = p;
1.22 + }
1.23 + continue;
1.24 }
1.25 - continue;
1.26 + String tn = typeName(e, p);
1.27 + w.write(sep);
1.28 + w.write(tn);
1.29 + w.write(" " + p.name());
1.30 + sep = ", ";
1.31 }
1.32 - String tn = typeName(e, p);
1.33 - w.write(sep);
1.34 - w.write(tn);
1.35 - w.write(" " + p.name());
1.36 - sep = ", ";
1.37 + if (firstArray != null) {
1.38 + String tn = typeName(e, firstArray);
1.39 + w.write(sep);
1.40 + w.write(tn);
1.41 + w.write("... " + firstArray.name());
1.42 + }
1.43 + w.append(") {\n");
1.44 + w.append(" this(net.java.html.BrwsrCtx.findDefault(").append(className).append(".class));\n");
1.45 + for (Prprt p : props) {
1.46 + if (p.array()) {
1.47 + continue;
1.48 + }
1.49 + w.write(" this.prop_" + p.name() + " = " + p.name() + ";\n");
1.50 + }
1.51 + if (firstArray != null) {
1.52 + w.write(" this.prop_" + firstArray.name() + ".init(" + firstArray.name() + ");\n");
1.53 + }
1.54 + w.append(" };\n");
1.55 }
1.56 - if (firstArray != null) {
1.57 - String tn = typeName(e, firstArray);
1.58 - w.write(sep);
1.59 - w.write(tn);
1.60 - w.write("... " + firstArray.name());
1.61 - }
1.62 - w.append(") {\n");
1.63 - w.append(" this(net.java.html.BrwsrCtx.findDefault(").append(className).append(".class));\n");
1.64 - for (Prprt p : props) {
1.65 - if (p.array()) {
1.66 - continue;
1.67 - }
1.68 - w.write(" this.prop_" + p.name() + " = " + p.name() + ";\n");
1.69 - }
1.70 - if (firstArray != null) {
1.71 - w.write(" this.prop_" + firstArray.name() + ".init(" + firstArray.name() + ");\n");
1.72 - }
1.73 - w.append(" };\n");
1.74 w.append(" private org.apidesign.html.json.impl.Bindings intKnckt() {\n");
1.75 w.append(" if (ko[0] != null) return ko[0];\n");
1.76 w.append(" ko[0] = org.apidesign.html.json.impl.Bindings.apply(context, this);\n");
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/json/src/test/java/org/apidesign/html/json/impl/NoPropertiesTest.java Sat Sep 07 07:36:43 2013 +0200
2.3 @@ -0,0 +1,33 @@
2.4 +/**
2.5 + * HTML via Java(tm) Language Bindings
2.6 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.7 + *
2.8 + * This program is free software: you can redistribute it and/or modify
2.9 + * it under the terms of the GNU General Public License as published by
2.10 + * the Free Software Foundation, version 2 of the License.
2.11 + *
2.12 + * This program is distributed in the hope that it will be useful,
2.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.15 + * GNU General Public License for more details. apidesign.org
2.16 + * designates this particular file as subject to the
2.17 + * "Classpath" exception as provided by apidesign.org
2.18 + * in the License file that accompanied this code.
2.19 + *
2.20 + * You should have received a copy of the GNU General Public License
2.21 + * along with this program. Look for COPYING file in the top folder.
2.22 + * If not, see http://wiki.apidesign.org/wiki/GPLwithClassPathException
2.23 + */
2.24 +package org.apidesign.html.json.impl;
2.25 +
2.26 +import net.java.html.json.Model;
2.27 +
2.28 +/** Originally could not compile.
2.29 + *
2.30 + * @author Jaroslav Tulach <jtulach@netbeans.org>
2.31 + */
2.32 +@Model(className="NoProperties", properties = {
2.33 +})
2.34 +public class NoPropertiesTest {
2.35 +
2.36 +}