diff options
author | Leif Åstrand <leif@vaadin.com> | 2014-07-08 18:19:28 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-07-09 08:28:11 +0000 |
commit | c5df7f5bf60cea004e146cf559f4f36de6e9c48b (patch) | |
tree | 6b8267f30a22ea68cae7f06d322ba23d3774f783 /client-compiler/src | |
parent | 72ccdd9b1366f06fadd5b80994d152f7a20397ce (diff) | |
download | vaadin-framework-c5df7f5bf60cea004e146cf559f4f36de6e9c48b.tar.gz vaadin-framework-c5df7f5bf60cea004e146cf559f4f36de6e9c48b.zip |
Box and unbox long values in state fields (#14176)
We actually want to pass around the primitive long values emulated by
GWT even though JavaScript code can't do anything with the values.
Skipping the unboxing caused long fields to always be 0 since that's how
JavaScript converts an object into a number.
This patch also makes the test assert that the expected state values are
received and updates those values to actually make sense in some
situations.
Change-Id: Id9c3696d699593bd9e59e249c5daf077873b85fc
Diffstat (limited to 'client-compiler/src')
-rw-r--r-- | client-compiler/src/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java | 12 |
1 files changed, 2 insertions, 10 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(";"); } |