diff options
4 files changed, 44 insertions, 20 deletions
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java index 6c242dfd74..a31dafe05c 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java @@ -45,25 +45,17 @@ public class FieldProperty extends Property { @Override public void writeSetterBody(TreeLogger logger, SourceWriter w, String beanVariable, String valueVariable) { - // Don't try to unbox Longs in javascript, as it's not supported. - // (#13692) - boolean shouldUnbox = !"long".equals(field.getType() - .getSimpleSourceName()); w.println("%s.@%s::%s = %s;", beanVariable, getBeanType() - .getQualifiedSourceName(), getName(), - shouldUnbox ? unboxValue(valueVariable) : valueVariable); + .getQualifiedSourceName(), getName(), unboxValue(valueVariable)); } @Override public void writeGetterBody(TreeLogger logger, SourceWriter w, String beanVariable) { - // Longs are not unboxed, as it's not supported. (#13692) - boolean shouldBox = !"long".equals(field.getType() - .getSimpleSourceName()); String value = String.format("%s.@%s::%s", beanVariable, getBeanType() .getQualifiedSourceName(), getName()); w.print("return "); - w.print(shouldBox ? boxValue(value) : value); + w.print(boxValue(value)); w.println(";"); } diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java index 1c18fb1912..333964e9bf 100644 --- a/uitest/src/com/vaadin/tests/serialization/SerializerTest.java +++ b/uitest/src/com/vaadin/tests/serialization/SerializerTest.java @@ -93,13 +93,13 @@ public class SerializerTest extends AbstractTestUI { rpc.sendInt(Integer.MAX_VALUE, Integer.valueOf(0), new int[] { 5, 7 }); state.intValue = Integer.MAX_VALUE; - state.intObjectValue = Integer.valueOf(0); + state.intObjectValue = Integer.valueOf(42); state.intArray = new int[] { 5, 7 }; rpc.sendLong(577431841358l, Long.valueOf(0), new long[] { -57841235865l, 57 }); - state.longValue = 577431841358l; - state.longObjectValue = Long.valueOf(0); + state.longValue = 577431841359l; + state.longObjectValue = Long.valueOf(577431841360l); state.longArray = new long[] { -57841235865l, 57 }; rpc.sendFloat(3.14159f, Float.valueOf(Math.nextUp(1)), new float[] { @@ -111,7 +111,7 @@ public class SerializerTest extends AbstractTestUI { rpc.sendDouble(Math.PI, Double.valueOf(-Math.E), new double[] { Double.MAX_VALUE, Double.MIN_VALUE }); state.doubleValue = Math.PI; - state.doubleValue = Double.valueOf(-Math.E); + state.doubleObjectValue = Double.valueOf(-Math.E); state.doubleArray = new double[] { Double.MAX_VALUE, Double.MIN_VALUE }; rpc.sendString("This is a tesing string ‡"); diff --git a/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java index 5ca1e9ce6a..47bb212347 100644 --- a/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java +++ b/uitest/src/com/vaadin/tests/serialization/SerializerTestTest.java @@ -77,5 +77,36 @@ public class SerializerTestTest extends MultiBrowserTest { "sendBoolean: false, false, [false, false, true, false, true, true]", getLogRow(logRow++)); Assert.assertEquals("sendBeanSubclass: 43", getLogRow(logRow++)); + Assert.assertEquals( + "state.doubleArray: [1.7976931348623157e+308, 5e-324]", + getLogRow(logRow++)); + Assert.assertEquals("state.doubleObjectValue: -2.718281828459045", + getLogRow(logRow++)); + Assert.assertEquals("state.doubleValue: 3.141592653589793", + getLogRow(logRow++)); + Assert.assertEquals("state.floatArray: [57, 0, -12]", + getLogRow(logRow++)); + Assert.assertEquals("state.floatObjectValue: 1.0000001", + getLogRow(logRow++)); + Assert.assertEquals("state.floatValue: 3.14159", getLogRow(logRow++)); + Assert.assertEquals("state.longArray: [-57841235865, 57]", + getLogRow(logRow++)); + Assert.assertEquals("state.longObjectValue: 577431841360", + getLogRow(logRow++)); + Assert.assertEquals("state.longValue: 577431841359", + getLogRow(logRow++)); + Assert.assertEquals("state.intArray: [5, 7]", getLogRow(logRow++)); + Assert.assertEquals("state.intObjectValue: 42", getLogRow(logRow++)); + Assert.assertEquals("state.intValue: 2147483647", getLogRow(logRow++)); + Assert.assertEquals("state.charArray: aBcD", getLogRow(logRow++)); + Assert.assertEquals("state.charObjectValue: å", getLogRow(logRow++)); + Assert.assertEquals("state.charValue: ∫", getLogRow(logRow++)); + Assert.assertEquals("state.byteArray: [3, 1, 2]", getLogRow(logRow++)); + Assert.assertEquals("state.byteObjectValue: -12", getLogRow(logRow++)); + Assert.assertEquals("state.byteValue: 5", getLogRow(logRow++)); + Assert.assertEquals( + "state.booleanArray: [true, true, false, true, false, false]", + getLogRow(logRow++)); + } } diff --git a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java index 0ef4b664ac..7758cdc2ac 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java @@ -284,11 +284,12 @@ public class SerializerTestConnector extends AbstractExtensionConnector { public void onStateChanged(StateChangeEvent stateChangeEvent) { rpc.log("state.booleanValue: " + getState().booleanValue); rpc.log("state.booleanObjectValue: " + getState().booleanObjectValue); - rpc.log("state.booleanArray: " + getState().booleanArray); + rpc.log("state.booleanArray: " + + Arrays.toString(getState().booleanArray)); rpc.log("state.byteValue: " + getState().byteValue); rpc.log("state.byteObjectValue: " + getState().byteObjectValue); - rpc.log("state.byteArray: " + getState().byteArray); + rpc.log("state.byteArray: " + Arrays.toString(getState().byteArray)); rpc.log("state.charValue: " + getState().charValue); rpc.log("state.charObjectValue: " + getState().charObjectValue); @@ -296,19 +297,19 @@ public class SerializerTestConnector extends AbstractExtensionConnector { rpc.log("state.intValue: " + getState().intValue); rpc.log("state.intObjectValue: " + getState().intObjectValue); - rpc.log("state.intArray: " + getState().intArray); + rpc.log("state.intArray: " + Arrays.toString(getState().intArray)); rpc.log("state.longValue: " + getState().longValue); rpc.log("state.longObjectValue: " + getState().longObjectValue); - rpc.log("state.longArray: " + getState().longArray); + rpc.log("state.longArray: " + Arrays.toString(getState().longArray)); rpc.log("state.floatValue: " + getState().floatValue); rpc.log("state.floatObjectValue: " + getState().floatObjectValue); - rpc.log("state.floatArray: " + getState().floatArray); + rpc.log("state.floatArray: " + Arrays.toString(getState().floatArray)); rpc.log("state.doubleValue: " + getState().doubleValue); rpc.log("state.doubleObjectValue: " + getState().doubleObjectValue); - rpc.log("state.doubleArray: " + getState().doubleArray); + rpc.log("state.doubleArray: " + Arrays.toString(getState().doubleArray)); /* * TODO public double doubleValue; public Double DoubleValue; public |