summaryrefslogtreecommitdiffstats
path: root/client-compiler
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-08-20 08:55:20 +0300
committerLeif Åstrand <leif@vaadin.com>2012-08-20 08:55:20 +0300
commit95411dc8c260fc5dcd548f11a8de50a2b8bb9770 (patch)
tree15760f3eb06d9641a7de32cb740de64982d392f4 /client-compiler
parente81cf22601718cd7909fea1db295bb538b104c9a (diff)
downloadvaadin-framework-95411dc8c260fc5dcd548f11a8de50a2b8bb9770.tar.gz
vaadin-framework-95411dc8c260fc5dcd548f11a8de50a2b8bb9770.zip
Preserve package name for state serializers (#8683)
Diffstat (limited to 'client-compiler')
-rw-r--r--client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java b/client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java
index 2fc9645940..0235fb277d 100644
--- a/client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java
+++ b/client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/SerializerGenerator.java
@@ -32,6 +32,7 @@ import com.google.gwt.core.ext.typeinfo.JClassType;
import com.google.gwt.core.ext.typeinfo.JEnumConstant;
import com.google.gwt.core.ext.typeinfo.JEnumType;
import com.google.gwt.core.ext.typeinfo.JMethod;
+import com.google.gwt.core.ext.typeinfo.JPackage;
import com.google.gwt.core.ext.typeinfo.JPrimitiveType;
import com.google.gwt.core.ext.typeinfo.JType;
import com.google.gwt.core.ext.typeinfo.TypeOracleException;
@@ -59,8 +60,6 @@ import com.vaadin.terminal.gwt.client.communication.SerializerMap;
public class SerializerGenerator extends Generator {
private static final String SUBTYPE_SEPARATOR = "___";
- private static String serializerPackageName = SerializerMap.class
- .getPackage().getName();
@Override
public String generate(TreeLogger logger, GeneratorContext context,
@@ -75,8 +74,8 @@ public class SerializerGenerator extends Generator {
String serializerClassName = getSerializerSimpleClassName(type);
try {
// Generate class source code
- generateClass(logger, context, type, serializerPackageName,
- serializerClassName);
+ generateClass(logger, context, type,
+ getSerializerPackageName(type), serializerClassName);
} catch (Exception e) {
logger.log(TreeLogger.ERROR, "SerializerGenerator failed for "
+ type.getQualifiedSourceName(), e);
@@ -465,6 +464,18 @@ public class SerializerGenerator extends Generator {
}
public static String getFullyQualifiedSerializerClassName(JClassType type) {
- return serializerPackageName + "." + getSerializerSimpleClassName(type);
+ return getSerializerPackageName(type) + "."
+ + getSerializerSimpleClassName(type);
+ }
+
+ private static String getSerializerPackageName(JClassType type) {
+ JPackage typePackage = type.getPackage();
+ if (typePackage == null) {
+ return SerializerMap.class.getPackage().getName();
+ } else {
+ // What about e.g. java.* packages, can we create classes there or
+ // should we use e.g. com.vaadin.java.*
+ return typePackage.getName();
+ }
}
}