Skip to content

Commit 61fff87

Browse files
basilevsiloveeclipse
authored andcommitted
Document occasional failure to invoke removeState() #925
Use of weak references in org.eclipse.e4.core.commands.internal.HandlerServiceHandler may result in occasional failure to call removeState() on an underlying handler after use. We document this in IObjectWithState, until a better solution is found.
1 parent 483d87d commit 61fff87

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/IObjectWithState.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@ public interface IObjectWithState {
3131
/**
3232
* Adds state to this object.
3333
*
34-
* @param id
35-
* The identifier indicating the type of state being added; must
36-
* not be <code>null</code>.
37-
* @param state
38-
* The new state to add to this object; must not be
39-
* <code>null</code>.
34+
* Usually, consumers will call <code>removeState()</code> with a matching id in
35+
* the same lifecycle of IObjectWithState. However, this behavior is not
36+
* guaranteed. Implementors should not rely on <code>removeState()</code> for
37+
* resource disposal. The recommended practice is to free resources associated
38+
* with non-removed states in some kind of dispose() method.
39+
*
40+
* @see AbstractHandlerWithState
41+
*
42+
* @param id The identifier indicating the type of state being added; must
43+
* not be <code>null</code>.
44+
* @param state The new state to add to this object; must not be
45+
* <code>null</code>.
4046
*/
4147
public void addState(String id, State state);
4248

0 commit comments

Comments
 (0)