Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 161176 Details for
Bug 304859
Uninjection order is incorrect when a new value is set after the object has been constructed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch
patch listener order.txt (text/plain), 7.52 KB, created by
Oleg Besedin
on 2010-03-05 14:50:47 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Oleg Besedin
Created:
2010-03-05 14:50:47 EST
Size:
7.52 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.e4.core.services >Index: src/org/eclipse/e4/core/services/internal/context/Computation.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/internal/context/Computation.java,v >retrieving revision 1.16 >diff -u -r1.16 Computation.java >--- src/org/eclipse/e4/core/services/internal/context/Computation.java 3 Mar 2010 21:26:02 -0000 1.16 >+++ src/org/eclipse/e4/core/services/internal/context/Computation.java 5 Mar 2010 19:49:05 -0000 >@@ -97,14 +97,16 @@ > /** > * Remove this computation from all contexts that are tracking it > */ >- protected void removeAll() { >+ protected void removeAll(EclipseContext originatingContext) { > for (Iterator it = dependencies.keySet().iterator(); it.hasNext();) { > ((EclipseContext) it.next()).listeners.remove(this); > } > dependencies.clear(); >+ // Bug 304859 >+ originatingContext.listeners.remove(this); > } > >- void startListening() { >+ void startListening(EclipseContext originatingContext) { > if (EclipseContext.DEBUG) > System.out.println(toString() + " now listening to: " //$NON-NLS-1$ > + mapToString(dependencies)); >@@ -131,6 +133,9 @@ > } else > c.listeners.add(this); > } >+ // Bug 304859 >+ if (!dependencies.containsKey(originatingContext)) >+ originatingContext.listeners.remove(this); > } > > protected void stopListening(IEclipseContext context, String name) { >@@ -145,7 +150,8 @@ > if (properties != null) { > if (EclipseContext.DEBUG) > System.out.println(toString() + " no longer listening to " + context + "," + name); //$NON-NLS-1$ >- ((EclipseContext) context).listeners.remove(this); // XXX >+ // Bug 304859 - causes reordering of listeners >+ // ((EclipseContext) context).listeners.remove(this); // XXX > // IEclipseContext > properties.remove(name); > // if we no longer track any values in the context, remove dependency >Index: src/org/eclipse/e4/core/services/internal/context/EclipseContext.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/internal/context/EclipseContext.java,v >retrieving revision 1.39 >diff -u -r1.39 EclipseContext.java >--- src/org/eclipse/e4/core/services/internal/context/EclipseContext.java 3 Mar 2010 21:26:02 -0000 1.39 >+++ src/org/eclipse/e4/core/services/internal/context/EclipseContext.java 5 Mar 2010 19:49:05 -0000 >@@ -154,10 +154,11 @@ > } finally { > currentComputation.set(oldComputation); > } >+ EclipseContext eventsContext = (EclipseContext) ((ObjectProviderContext) event.getContext()).getContext(); > if (result) >- startListening(); >+ startListening(eventsContext); > else >- removeAll(); >+ removeAll(eventsContext); > return result; > } > >Index: src/org/eclipse/e4/core/services/internal/context/ValueComputation.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/internal/context/ValueComputation.java,v >retrieving revision 1.16 >diff -u -r1.16 ValueComputation.java >--- src/org/eclipse/e4/core/services/internal/context/ValueComputation.java 3 Mar 2010 21:26:02 -0000 1.16 >+++ src/org/eclipse/e4/core/services/internal/context/ValueComputation.java 5 Mar 2010 19:49:05 -0000 >@@ -115,7 +115,7 @@ > IObjectProvider provider = event.getContext(); > IEclipseContext eventsContext = ((ObjectProviderContext) provider).getContext(); > if (originatingContext.equals(eventsContext)) { >- removeAll(); >+ removeAll(originatingContext); > return; > } > } >@@ -145,7 +145,7 @@ > EclipseContext.currentComputation.set(oldComputation); // XXX > // IEclipseContext > } >- startListening(); >+ startListening(originatingContext); > return cachedValue; > } > >#P org.eclipse.e4.core.tests.services.annotations >Index: src/org/eclipse/e4/core/tests/services/internal/annotations/InjectionOrderTest.java >=================================================================== >RCS file: src/org/eclipse/e4/core/tests/services/internal/annotations/InjectionOrderTest.java >diff -N src/org/eclipse/e4/core/tests/services/internal/annotations/InjectionOrderTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/e4/core/tests/services/internal/annotations/InjectionOrderTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,69 @@ >+/******************************************************************************* >+ * Copyright (c) 2009, 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.e4.core.tests.services.internal.annotations; >+ >+import javax.inject.Inject; >+import javax.inject.Named; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.e4.core.services.IDisposable; >+import org.eclipse.e4.core.services.annotations.PreDestroy; >+import org.eclipse.e4.core.services.context.EclipseContextFactory; >+import org.eclipse.e4.core.services.context.IEclipseContext; >+import org.eclipse.e4.core.services.context.spi.ContextInjectionFactory; >+ >+public class InjectionOrderTest extends TestCase { >+ >+ public static class InjectTargetMethod { >+ Object o; >+ >+ @Inject >+ void set(@Named("inject") Object o) { >+ this.o = o; >+ } >+ >+ @PreDestroy >+ void pd() { >+ assertNotNull(o); >+ } >+ } >+ >+ public static class InjectTargetField { >+ @Inject @Named("inject") >+ Object o; >+ >+ @PreDestroy >+ void pd() { >+ assertNotNull(o); >+ } >+ } >+ >+ public void testDisposeMethod() throws Exception { >+ IEclipseContext appContext = EclipseContextFactory.create(); >+ appContext.set("inject", "a"); >+ >+ ContextInjectionFactory.make(InjectTargetMethod.class, appContext); >+ appContext.set("inject", "b"); >+ >+ ((IDisposable) appContext).dispose(); >+ } >+ >+ public void testDisposeField() throws Exception { >+ IEclipseContext appContext = EclipseContextFactory.create(); >+ appContext.set("inject", "a"); >+ >+ ContextInjectionFactory.make(InjectTargetField.class, appContext); >+ appContext.set("inject", "b"); >+ >+ ((IDisposable) appContext).dispose(); >+ } >+} >Index: src/org/eclipse/e4/core/tests/services/internal/annotations/ServicesTestSuiteAnnotations.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/tests/org.eclipse.e4.core.tests.services.annotations/src/org/eclipse/e4/core/tests/services/internal/annotations/ServicesTestSuiteAnnotations.java,v >retrieving revision 1.4 >diff -u -r1.4 ServicesTestSuiteAnnotations.java >--- src/org/eclipse/e4/core/tests/services/internal/annotations/ServicesTestSuiteAnnotations.java 18 Feb 2010 17:00:11 -0000 1.4 >+++ src/org/eclipse/e4/core/tests/services/internal/annotations/ServicesTestSuiteAnnotations.java 5 Mar 2010 19:49:06 -0000 >@@ -26,5 +26,6 @@ > addTestSuite(ProviderInjectionTest.class); > addTestSuite(InjectionUpdateTest.class); > addTestSuite(DisposingReferencedContextTest.class); >+ addTestSuite(InjectionOrderTest.class); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 304859
: 161176