summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-10-10 17:48:06 +0300
committerLeif Åstrand <leif@vaadin.com>2012-10-10 17:48:06 +0300
commitdec9f91a708d5b7b4ec1d6a2faaddf2b64827d3e (patch)
treef74c4f80733effe907ffa482b04d8d8bfefed683
parent1a96ed6807982ee18811954695ca8a83a4b7d318 (diff)
downloadvaadin-framework-dec9f91a708d5b7b4ec1d6a2faaddf2b64827d3e.tar.gz
vaadin-framework-dec9f91a708d5b7b4ec1d6a2faaddf2b64827d3e.zip
Abort widgetset compile for conflicting @Connect mappings (#9343)
Change-Id: I07f760501f956a720bdb840d64c293984b9cf948
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java
index 3e863516a5..7500d65443 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java
@@ -4,22 +4,41 @@
package com.vaadin.server.widgetsetutils.metadata;
+import java.util.Map;
+
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.dev.util.collect.HashMap;
import com.vaadin.shared.ui.Connect;
public class ConnectorInitVisitor extends TypeVisitor {
+ private Map<String, JClassType> processedConnections = new HashMap<String, JClassType>();
+
@Override
public void visitConnector(TreeLogger logger, JClassType type,
- ConnectorBundle bundle) {
+ ConnectorBundle bundle) throws UnableToCompleteException {
Connect connectAnnotation = type.getAnnotation(Connect.class);
if (connectAnnotation != null) {
logger.log(Type.INFO, type.getName() + " will be in the "
+ bundle.getName().replaceAll("^_*", "") + " bundle");
- bundle.setIdentifier(type, connectAnnotation.value()
- .getCanonicalName());
+ String identifier = connectAnnotation.value().getCanonicalName();
+
+ JClassType previousMapping = processedConnections.put(identifier,
+ type);
+ if (previousMapping != null) {
+ logger.log(
+ Type.ERROR,
+ "Multiple @Connect mappings detected for " + identifier
+ + ": " + type.getQualifiedSourceName()
+ + " and "
+ + previousMapping.getQualifiedSourceName());
+ throw new UnableToCompleteException();
+ }
+
+ bundle.setIdentifier(type, identifier);
bundle.setNeedsGwtConstructor(type);
}
}