From b829146be06147fb03e644f88a18b29488f745af Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Wed, 17 May 2017 10:36:02 +0300 Subject: [PATCH] Remove deprecation from setTag and throw on subsequent calls --- .../src/main/java/com/vaadin/client/ServerConnector.java | 9 +++++---- .../java/com/vaadin/client/ui/AbstractConnector.java | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/src/main/java/com/vaadin/client/ServerConnector.java b/client/src/main/java/com/vaadin/client/ServerConnector.java index 71d65732bb..ba1b81205c 100644 --- a/client/src/main/java/com/vaadin/client/ServerConnector.java +++ b/client/src/main/java/com/vaadin/client/ServerConnector.java @@ -221,19 +221,20 @@ public interface ServerConnector extends Connector { * Sets the connector type tag for this connector. This should only be * called from * {@link WidgetSet#createConnector(int, ApplicationConfiguration)} + *

+ * Note: This method is intended for internal use only. * * @see #getTag() * * @param tag * the connector type tag * - * @deprecated This is an internal method and should not be called by an - * application developer. + * @throws IllegalStateException + * if {@code tag} has already been set * * @since 8.1 */ - @Deprecated - public void setTag(int tag); + public void setTag(int tag) throws IllegalStateException; /** * Gets the connector type tag for this connector. This type tag is an diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java index f7bdf80ee0..7269a03df6 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java @@ -61,7 +61,7 @@ public abstract class AbstractConnector private ApplicationConnection connection; private String id; - private int tag; + private int tag = -1; private HandlerManager handlerManager; private FastStringMap statePropertyHandlerManagers; @@ -532,6 +532,10 @@ public abstract class AbstractConnector @Override public void setTag(int tag) { + if (this.tag >= 0) { + throw new IllegalStateException( + "Tag already set for this " + getClass().getSimpleName()); + } this.tag = tag; } } -- 2.39.5