diff options
3 files changed, 27 insertions, 4 deletions
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java index 3b78519a0d..83aa85b482 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java @@ -19,6 +19,8 @@ package com.vaadin.server.widgetsetutils.metadata; import java.util.Set; import com.google.gwt.core.ext.TreeLogger; +import com.google.gwt.core.ext.TreeLogger.Type; +import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.JMethod; import com.google.gwt.core.ext.typeinfo.JType; @@ -26,12 +28,14 @@ import com.google.gwt.core.ext.typeinfo.JType; public class ClientRpcVisitor extends TypeVisitor { @Override public void visitClientRpc(TreeLogger logger, JClassType type, - ConnectorBundle bundle) { + ConnectorBundle bundle) throws UnableToCompleteException { Set<? extends JClassType> hierarchy = type .getFlattenedSupertypeHierarchy(); for (JClassType subType : hierarchy) { JMethod[] methods = subType.getMethods(); for (JMethod method : methods) { + checkReturnType(logger, method); + bundle.setNeedsInvoker(type, method); bundle.setNeedsParamTypes(type, method); @@ -42,4 +46,21 @@ public class ClientRpcVisitor extends TypeVisitor { } } } + + public static void checkReturnType(TreeLogger logger, JMethod method) + throws UnableToCompleteException { + if (!method.getReturnType().getQualifiedSourceName().equals("void")) { + logger.log( + Type.ERROR, + "The method " + + method.getEnclosingType() + .getQualifiedSourceName() + + "." + + method.getName() + + " returns " + + method.getReturnType().getQualifiedSourceName() + + " but only void is supported for methods in RPC interfaces."); + throw new UnableToCompleteException(); + } + } } diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java index cbcfc3075b..fa0a8390a4 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java @@ -19,6 +19,7 @@ package com.vaadin.server.widgetsetutils.metadata; import java.util.Set; import com.google.gwt.core.ext.TreeLogger; +import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.JMethod; import com.google.gwt.core.ext.typeinfo.JType; @@ -26,7 +27,7 @@ import com.google.gwt.core.ext.typeinfo.JType; public class ServerRpcVisitor extends TypeVisitor { @Override public void visitServerRpc(TreeLogger logger, JClassType type, - ConnectorBundle bundle) { + ConnectorBundle bundle) throws UnableToCompleteException { bundle.setNeedsProxySupport(type); Set<? extends JClassType> superTypes = type @@ -35,6 +36,7 @@ public class ServerRpcVisitor extends TypeVisitor { if (subType.isInterface() != null) { JMethod[] methods = subType.getMethods(); for (JMethod method : methods) { + ClientRpcVisitor.checkReturnType(logger, method); bundle.setNeedsDelayedInfo(type, method); JType[] parameterTypes = method.getParameterTypes(); diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/TypeVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/TypeVisitor.java index 7191093755..93eed7843c 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/TypeVisitor.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/TypeVisitor.java @@ -23,12 +23,12 @@ public abstract class TypeVisitor { } public void visitClientRpc(TreeLogger logger, JClassType type, - ConnectorBundle bundle) { + ConnectorBundle bundle) throws UnableToCompleteException { // Default does nothing } public void visitServerRpc(TreeLogger logger, JClassType type, - ConnectorBundle bundle) { + ConnectorBundle bundle) throws UnableToCompleteException { // Default does nothing } |