Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-04-04 18:34:09 -0400
committerEike Stepper2012-04-04 18:34:09 -0400
commit8712c85a0469c9a53d161aa010e709fed9113966 (patch)
tree33574394b8e16d66e98db6b2a84c1c824f94de6c
parent04a3e95816bbc31bc01fca8d53ce69679e9262d6 (diff)
downloadcdo-8712c85a0469c9a53d161aa010e709fed9113966.tar.gz
cdo-8712c85a0469c9a53d161aa010e709fed9113966.tar.xz
cdo-8712c85a0469c9a53d161aa010e709fed9113966.zip
[376125] Make CDOStaleReferencePolicy.PROXY robust for eAdapters() calls
https://bugs.eclipse.org/bugs/show_bug.cgi?id=376125
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOStaleReferencePolicy.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOStaleReferencePolicy.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOStaleReferencePolicy.java
index 0643929e6e..c6df3e5428 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOStaleReferencePolicy.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOStaleReferencePolicy.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.cdo.util.ObjectNotFoundException;
import org.eclipse.emf.internal.cdo.messages.Messages;
+import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -52,30 +53,45 @@ public interface CDOStaleReferencePolicy
};
/**
- * Returns a proxy object with the appropriate EClass. The proxy object supports the {@link InternalEObject#eClass()
- * eClass()} and {@link InternalEObject#eIsProxy() eIsProxy()} methods. For all invocations to other methods the proxy
- * object throws an {@link ObjectNotFoundException}. The receiver can use {@link CDOUtil#isStaleObject(Object)} to
- * detect proxy objects.
+ * Returns a proxy object with the appropriate EClass. The proxy object supports the following methods:
+ * <ul>
+ * <li>
+ * {@link InternalEObject#eClass()}
+ * <li>
+ * {@link InternalEObject#eIsProxy()}
+ * <li>
+ * {@link Notifier#eAdapters()}
+ * </ul>
+ * For all invocations to other methods the proxy object throws an {@link ObjectNotFoundException}. The receiver can
+ * use {@link CDOUtil#isStaleObject(Object)} or <code>instanceof {@link CDOStaleObject}</code> to detect proxy
+ * objects.
*/
public static final CDOStaleReferencePolicy PROXY = new CDOStaleReferencePolicy()
{
- public Object processStaleReference(EObject source, final EStructuralFeature feature, int index, final CDOID target)
+ public Object processStaleReference(final EObject source, final EStructuralFeature feature, int index,
+ final CDOID target)
{
final EClassifier type = feature.getEType();
InvocationHandler handler = new InvocationHandler()
{
- public Object invoke(Object arg0, Method arg1, Object[] arg2) throws Throwable
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
- if (arg1.getName().equals("eIsProxy")) //$NON-NLS-1$
+ String name = method.getName();
+ if (name.equals("eIsProxy")) //$NON-NLS-1$
{
return false;
}
- if (arg1.getName().equals("eClass")) //$NON-NLS-1$
+ if (name.equals("eClass")) //$NON-NLS-1$
{
return type;
}
+ if (name.equals("eAdapters")) //$NON-NLS-1$
+ {
+ return source.eAdapters();
+ }
+
throw new ObjectNotFoundException(target);
}
};

Back to the top