aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/build.xml2
-rw-r--r--src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java20
2 files changed, 17 insertions, 5 deletions
diff --git a/build/build.xml b/build/build.xml
index 0e6f1b40dd..e01d33db3e 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -593,6 +593,8 @@
<arg value="${widgetset-localWorkers}" />
<arg line="${widgetset-extraParams}" />
<arg value="${widgetset}" />
+
+ <sysproperty key="vFailIfNotSerializable" value="true" />
<jvmarg value="-Xss8M"/>
<jvmarg value="-XX:MaxPermSize=256M"/>
diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java
index 2da2c85d8b..ab216693d7 100644
--- a/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java
+++ b/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerMapGenerator.java
@@ -43,6 +43,7 @@ import com.vaadin.terminal.gwt.client.communication.SharedState;
*/
public class SerializerMapGenerator extends Generator {
+ private static final String FAIL_IF_NOT_SERIALIZABLE = "vFailIfNotSerializable";
private String packageName;
private String className;
@@ -54,7 +55,7 @@ public class SerializerMapGenerator extends Generator {
TypeOracle typeOracle = context.getTypeOracle();
Set<JClassType> typesNeedingSerializers = findTypesNeedingSerializers(
typeOracle, logger);
- warnIfNotJavaSerializable(typesNeedingSerializers, typeOracle,
+ checkForUnserializableTypes(typesNeedingSerializers, typeOracle,
logger);
Set<JClassType> typesWithExistingSerializers = findTypesWithExistingSerializers(
typeOracle, logger);
@@ -90,10 +91,11 @@ public class SerializerMapGenerator extends Generator {
* @param typesNeedingSerializers
* @param typeOracle
* @param logger
+ * @throws UnableToCompleteException
*/
- private void warnIfNotJavaSerializable(
+ private void checkForUnserializableTypes(
Set<JClassType> typesNeedingSerializers, TypeOracle typeOracle,
- TreeLogger logger) {
+ TreeLogger logger) throws UnableToCompleteException {
JClassType javaSerializable = typeOracle.findType(Serializable.class
.getName());
for (JClassType type : typesNeedingSerializers) {
@@ -103,12 +105,20 @@ public class SerializerMapGenerator extends Generator {
}
boolean serializable = type.isAssignableTo(javaSerializable);
if (!serializable) {
+ boolean abortCompile = "true".equals(System
+ .getProperty(FAIL_IF_NOT_SERIALIZABLE));
logger.log(
- Type.ERROR,
+ abortCompile ? Type.ERROR : Type.WARN,
type
+ " is used in RPC or shared state but does not implement "
+ Serializable.class.getName()
- + ". Communication will work but the Application on server side cannot be serialized if it refers to objects of this type.");
+ + ". Communication will work but the Application on server side cannot be serialized if it refers to objects of this type. "
+ + "If the system property "
+ + FAIL_IF_NOT_SERIALIZABLE
+ + " is set to \"true\", this causes the compilation to fail instead of just emitting a warning.");
+ if (abortCompile) {
+ throw new UnableToCompleteException();
+ }
}
}
}