diff options
author | Juuso Valli <juuso@vaadin.com> | 2014-09-13 15:19:55 +0300 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-09-15 14:24:11 +0300 |
commit | 22f09cfeafcae80a8660ac2dcbb3918597321187 (patch) | |
tree | d93d75bf9e25ad532e37791426a679998cb94d28 /server/src | |
parent | 4a60f1a712787cfdadeddef399d177b25806017e (diff) | |
download | vaadin-framework-22f09cfeafcae80a8660ac2dcbb3918597321187.tar.gz vaadin-framework-22f09cfeafcae80a8660ac2dcbb3918597321187.zip |
Improve proxy comparison support (#14639)
Change-Id: I114ea5bf9d55c78826c1163206caf585b96143ef
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/com/vaadin/server/AbstractClientConnector.java | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index d8d0d5cbd9..1f13010638 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -1001,11 +1001,6 @@ public abstract class AbstractClientConnector implements ClientConnector, this.errorHandler = errorHandler; } - private AbstractClientConnector getInstance() { - // returns the underlying instance regardless of proxies - return this; - } - /* * (non-Javadoc) * @@ -1013,12 +1008,36 @@ public abstract class AbstractClientConnector implements ClientConnector, */ @Override public boolean equals(Object obj) { + if (this == obj) { + return true; + } + /* + * This equals method must return true when we're comparing an object to + * its proxy. This happens a lot with CDI (and possibly Spring) when + * we're injecting Components. See #14639 + */ if (obj instanceof AbstractClientConnector) { - return super.equals(((AbstractClientConnector) obj).getInstance()); + AbstractClientConnector connector = (AbstractClientConnector) obj; + return connector.isThis(this); } return false; } + /** + * For internal use only, may be changed or removed in future versions. + * <p> + * This method must be protected, because otherwise it will not be redefined + * by the proxy to actually be called on the underlying instance. + * <p> + * See #14639 + * + * @deprecated only defined for framework hacks, do not use. + */ + @Deprecated + protected boolean isThis(Object that) { + return this == that; + } + /* * (non-Javadoc) * |