diff options
author | elmot <elmot@vaadin.com> | 2016-04-13 15:01:50 +0300 |
---|---|---|
committer | elmot <elmot@vaadin.com> | 2016-04-13 15:32:47 +0300 |
commit | 980f879176696906c25e985e4f7c8e3bdc04258d (patch) | |
tree | d781a70e24eef0994ba5d371280e1cf837f94825 /client-compiler | |
parent | f7f5ba596dbba0c2374a6d8ac10e89362cbbaeb5 (diff) | |
parent | 9b46608f6c645c4289b854e2949bae3b1a2f5147 (diff) | |
download | vaadin-framework-980f879176696906c25e985e4f7c8e3bdc04258d.tar.gz vaadin-framework-980f879176696906c25e985e4f7c8e3bdc04258d.zip |
Merge branch 'master' into feature/mavenize
Change-Id: Id7db526d07a14ac259cbb50415bbafd2a7c2ab94
Diffstat (limited to 'client-compiler')
-rw-r--r-- | client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java index 2e54d00aab..8b645aa492 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java @@ -22,8 +22,11 @@ import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.JMethod; import com.google.gwt.core.ext.typeinfo.JParameterizedType; import com.google.gwt.core.ext.typeinfo.JType; +import com.google.gwt.core.ext.typeinfo.NotFoundException; import com.vaadin.client.connectors.AbstractRendererConnector; +import elemental.json.JsonValue; + /** * Generates type data for renderer connectors. * <ul> @@ -86,12 +89,33 @@ public class RendererVisitor extends TypeVisitor { JType presentationType = getPresentationType(type, logger); bundle.setPresentationType(type, presentationType); - bundle.setNeedsSerialize(presentationType); + if (!hasCustomDecodeMethod(type, logger)) { + bundle.setNeedsSerialize(presentationType); + } logger.log(Type.DEBUG, "Presentation type of " + type + " is " + presentationType); } + private static boolean hasCustomDecodeMethod(JClassType type, + TreeLogger logger) throws UnableToCompleteException { + try { + JMethod decodeMethod = ConnectorBundle.findInheritedMethod(type, + "decode", + type.getOracle().getType(JsonValue.class.getName())); + if (decodeMethod == null) { + throw new NotFoundException(); + } + + return !decodeMethod.getEnclosingType().getQualifiedSourceName() + .equals(AbstractRendererConnector.class.getName()); + } catch (NotFoundException e) { + logger.log(Type.ERROR, "Can't find decode method for renderer " + + type, e); + throw new UnableToCompleteException(); + } + } + private static JType getPresentationType(JClassType type, TreeLogger logger) throws UnableToCompleteException { JClassType originalType = type; |