summaryrefslogtreecommitdiffstats
path: root/client-compiler
diff options
context:
space:
mode:
Diffstat (limited to 'client-compiler')
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java6
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java6
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java111
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/Property.java16
4 files changed, 111 insertions, 28 deletions
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java b/client-compiler/src/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java
index b7850e6370..2d08329e9a 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java
@@ -16,6 +16,7 @@
package com.vaadin.server.widgetsetutils;
import java.io.PrintWriter;
+import java.util.Arrays;
import java.util.Date;
import com.google.gwt.core.ext.Generator;
@@ -29,6 +30,7 @@ import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
import com.google.gwt.user.rebind.SourceWriter;
import com.vaadin.client.ui.dd.VAcceptCriterion;
import com.vaadin.client.ui.dd.VAcceptCriterionFactory;
+import com.vaadin.server.widgetsetutils.metadata.ConnectorBundle;
import com.vaadin.shared.ui.dd.AcceptCriterion;
/**
@@ -114,7 +116,9 @@ public class AcceptCriteriaFactoryGenerator extends Generator {
JClassType criteriaType = context.getTypeOracle().findType(
VAcceptCriterion.class.getName());
- for (JClassType clientClass : criteriaType.getSubtypes()) {
+ JClassType[] subtypes = criteriaType.getSubtypes();
+ Arrays.sort(subtypes, ConnectorBundle.jClassComparator);
+ for (JClassType clientClass : subtypes) {
AcceptCriterion annotation = clientClass
.getAnnotation(AcceptCriterion.class);
if (annotation != null) {
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
index 884852f7c8..2b8ccc87d0 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.TreeMap;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
@@ -1185,10 +1186,11 @@ public class ConnectorBundleLoaderFactory extends Generator {
JClassType[] types = serverConnectorType.getSubtypes();
- Map<String, JClassType> mappings = new HashMap<String, JClassType>();
+ Map<String, JClassType> mappings = new TreeMap<String, JClassType>();
// Keep track of what has happened to avoid logging intermediate state
- Map<JClassType, List<JClassType>> replaced = new HashMap<JClassType, List<JClassType>>();
+ Map<JClassType, List<JClassType>> replaced = new TreeMap<JClassType, List<JClassType>>(
+ ConnectorBundle.jClassComparator);
for (JClassType type : types) {
Connect connectAnnotation = type.getAnnotation(Connect.class);
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
index fedc86fbf6..b4531eb08e 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
@@ -19,12 +19,16 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
@@ -37,7 +41,6 @@ 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.google.gwt.core.ext.typeinfo.TypeOracle;
-import com.google.gwt.thirdparty.guava.common.collect.Sets;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ServerConnector;
@@ -54,6 +57,22 @@ import elemental.json.JsonValue;
public class ConnectorBundle {
private static final String FAIL_IF_NOT_SERIALIZABLE = "vFailIfNotSerializable";
+ public static final Comparator<JClassType> jClassComparator = new Comparator<JClassType>() {
+ @Override
+ public int compare(JClassType o1, JClassType o2) {
+ return o1.getQualifiedSourceName().compareTo(
+ o2.getQualifiedSourceName());
+ }
+ };
+
+ public static final Comparator<JMethod> jMethodComparator = new Comparator<JMethod>() {
+ @Override
+ public int compare(JMethod o1, JMethod o2) {
+ return o1.getReadableDeclaration().compareTo(
+ o2.getReadableDeclaration());
+ }
+ };
+
private final String name;
private final ConnectorBundle previousBundle;
private final Collection<TypeVisitor> visitors;
@@ -61,24 +80,42 @@ public class ConnectorBundle {
private final Set<JType> hasSerializeSupport = new HashSet<JType>();
private final Set<JType> needsSerializeSupport = new HashSet<JType>();
- private final Map<JType, GeneratedSerializer> serializers = new HashMap<JType, GeneratedSerializer>();
- private final Map<JClassType, JType> presentationTypes = new HashMap<JClassType, JType>();
- private final Set<JClassType> needsSuperClass = new HashSet<JClassType>();
- private final Set<JClassType> needsGwtConstructor = new HashSet<JClassType>();
+ private final Map<JType, GeneratedSerializer> serializers = new TreeMap<JType, GeneratedSerializer>(
+ new Comparator<JType>() {
+ @Override
+ public int compare(JType o1, JType o2) {
+ return o1.toString().compareTo(o2.toString());
+ }
+ });
+
+ private final Map<JClassType, Map<JMethod, Set<MethodAttribute>>> methodAttributes = new TreeMap<JClassType, Map<JMethod, Set<MethodAttribute>>>(
+ jClassComparator);
+ private final Set<JClassType> needsSuperClass = new TreeSet<JClassType>(
+ jClassComparator);
+ private final Set<JClassType> needsGwtConstructor = new TreeSet<JClassType>(
+ jClassComparator);
private final Set<JClassType> visitedTypes = new HashSet<JClassType>();
- private final Set<JClassType> needsProxySupport = new HashSet<JClassType>();
- private final Map<JClassType, Set<String>> identifiers = new HashMap<JClassType, Set<String>>();
- private final Map<JClassType, Set<JMethod>> needsReturnType = new HashMap<JClassType, Set<JMethod>>();
- private final Map<JClassType, Set<JMethod>> needsInvoker = new HashMap<JClassType, Set<JMethod>>();
- private final Map<JClassType, Set<JMethod>> needsParamTypes = new HashMap<JClassType, Set<JMethod>>();
- private final Map<JClassType, Set<JMethod>> needsOnStateChange = new HashMap<JClassType, Set<JMethod>>();
-
- private final Map<JClassType, Map<JMethod, Set<MethodAttribute>>> methodAttributes = new HashMap<JClassType, Map<JMethod, Set<MethodAttribute>>>();
-
- private final Set<Property> needsProperty = new HashSet<Property>();
- private final Map<JClassType, Set<Property>> needsDelegateToWidget = new HashMap<JClassType, Set<Property>>();
+ private final Set<JClassType> needsProxySupport = new TreeSet<JClassType>(
+ jClassComparator);
+
+ private final Map<JClassType, JType> presentationTypes = new TreeMap<JClassType, JType>(
+ jClassComparator);
+ private final Map<JClassType, Set<String>> identifiers = new TreeMap<JClassType, Set<String>>(
+ jClassComparator);
+ private final Map<JClassType, Set<JMethod>> needsReturnType = new TreeMap<JClassType, Set<JMethod>>(
+ jClassComparator);
+ private final Map<JClassType, Set<JMethod>> needsInvoker = new TreeMap<JClassType, Set<JMethod>>(
+ jClassComparator);
+ private final Map<JClassType, Set<JMethod>> needsParamTypes = new TreeMap<JClassType, Set<JMethod>>(
+ jClassComparator);
+ private final Map<JClassType, Set<JMethod>> needsOnStateChange = new TreeMap<JClassType, Set<JMethod>>(
+ jClassComparator);
+
+ private final Set<Property> needsProperty = new TreeSet<Property>();
+ private final Map<JClassType, Set<Property>> needsDelegateToWidget = new TreeMap<JClassType, Set<Property>>(
+ jClassComparator);
private ConnectorBundle(String name, ConnectorBundle previousBundle,
Collection<TypeVisitor> visitors,
@@ -369,7 +406,7 @@ public class ConnectorBundle {
}
public Collection<Property> getProperties(JClassType type) {
- HashSet<Property> properties = new HashSet<Property>();
+ Set<Property> properties = new TreeSet<Property>();
properties.addAll(MethodProperty.findProperties(type));
properties.addAll(FieldProperty.findProperties(type));
@@ -463,10 +500,19 @@ public class ConnectorBundle {
}
}
- private <K, V> void addMapping(Map<K, Set<V>> map, K key, V value) {
- Set<V> set = map.get(key);
+ private <K> void addMapping(Map<K, Set<String>> map, K key, String value) {
+ Set<String> set = map.get(key);
+ if (set == null) {
+ set = new TreeSet<String>();
+ map.put(key, set);
+ }
+ set.add(value);
+ }
+
+ private <K> void addMapping(Map<K, Set<JMethod>> map, K key, JMethod value) {
+ Set<JMethod> set = map.get(key);
if (set == null) {
- set = new HashSet<V>();
+ set = new TreeSet<JMethod>(jMethodComparator);
map.put(key, set);
}
set.add(value);
@@ -533,11 +579,26 @@ public class ConnectorBundle {
Map<JMethod, Set<MethodAttribute>> typeData = methodAttributes
.get(type);
if (typeData == null) {
- typeData = new HashMap<JMethod, Set<MethodAttribute>>();
+ typeData = new TreeMap<JMethod, Set<MethodAttribute>>(
+ jMethodComparator);
methodAttributes.put(type, typeData);
}
- addMapping(typeData, method, methodAttribute);
+ Map<JMethod, Set<MethodAttribute>> methods = methodAttributes
+ .get(type);
+ if (methods == null) {
+ methods = new TreeMap<JMethod, Set<MethodAttribute>>(
+ jMethodComparator);
+ methodAttributes.put(type, methods);
+ }
+
+ Set<MethodAttribute> attributes = methods.get(method);
+ if (attributes == null) {
+ attributes = new TreeSet<MethodAttribute>();
+ methods.put(method, attributes);
+ }
+
+ attributes.add(methodAttribute);
}
}
@@ -564,7 +625,7 @@ public class ConnectorBundle {
}
}
- private static Set<Class<?>> frameworkHandledTypes = new HashSet<Class<?>>();
+ private static Set<Class<?>> frameworkHandledTypes = new LinkedHashSet<Class<?>>();
{
frameworkHandledTypes.add(String.class);
frameworkHandledTypes.add(Boolean.class);
@@ -611,7 +672,9 @@ public class ConnectorBundle {
public void setNeedsDelegateToWidget(Property property, JClassType type) {
if (!isNeedsDelegateToWidget(type)) {
- needsDelegateToWidget.put(type, Sets.newHashSet(property));
+ TreeSet<Property> set = new TreeSet<Property>();
+ set.add(property);
+ needsDelegateToWidget.put(type, set);
} else if (!needsDelegateToWidget.get(type).contains(property)) {
needsDelegateToWidget.get(type).add(property);
}
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/Property.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/Property.java
index f07b1c29fd..0c849bead5 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/Property.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/Property.java
@@ -24,7 +24,7 @@ import com.google.gwt.core.ext.typeinfo.JPrimitiveType;
import com.google.gwt.core.ext.typeinfo.JType;
import com.google.gwt.user.rebind.SourceWriter;
-public abstract class Property {
+public abstract class Property implements Comparable<Property> {
private final String name;
private final JClassType beanType;
private final JType propertyType;
@@ -107,6 +107,20 @@ public abstract class Property {
+ getName().hashCode();
}
+ @Override
+ public int compareTo(Property o) {
+ int comp = getName().compareTo(o.getName());
+ if (comp == 0) {
+ comp = getBeanType().getQualifiedSourceName().compareTo(
+ o.getBeanType().getQualifiedSourceName());
+ }
+ if (comp == 0) {
+ comp = getClass().getCanonicalName().compareTo(
+ o.getClass().getCanonicalName());
+ }
+ return comp;
+ }
+
public abstract <T extends Annotation> T getAnnotation(
Class<T> annotationClass);