Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 126664

Summary: AbstractEditPart.EditPolicyIterator is deprecated, causes problems
Product: [Tools] GEF Reporter: Richard Kulp <richkulp>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Richard Kulp CLA 2006-02-06 18:30:39 EST
I'm trying to clean up my deprecated messages but I can't.

When bug #118572 changed, the EditPolicyIterator was deprectated. This causes problems because when we use getEditPoliciesIterator() we have to put up with deprecated warnings. But we need to be able to walk all of the editpolicies.

To fix this EditPolicyIterator should implement java.util.Iterator. That way I can  do:

Iterator epIter = (Iterator) getEditPoliciesIterator();

This way it will be binary compatible with older code still using EditPolicyIterator since not changing method signator nor removing/changing any existing methods on the EditPolicyIterator, but allow new usages by casting to iterator and not getting deprecated warnings.

You will need to implement remove(), but this can throw an UnsupportedOperationException.
Comment 1 Randy Hudson CLA 2006-02-06 19:13:18 EST
Rich, the type EditPolicyIterator is not deprecated, only its constructor is. The method (getEditPolicyIterator) is not deprecated either. Can you post the snippet of code you are running that is causing the deprecation warnings?

Assuming what's in my workspace is what's actually relased.
Comment 2 Richard Kulp CLA 2006-02-06 19:28:13 EST
EditPolicyIterator itr = getEditPolicyIterator();
while (itr.hasNext())
  itr.next();

I get the deprecated because I need to have a variable of type EditPolicyIterator, which is deprecated. I can't walk the iterator without having the variable.

This is what is in GEF 3.2M4:

/**
 * Iterates over a <code>List</code> of EditPolcies, skipping any <code>null</code> values
 * encountered.
 * @deprecated access to this type is unnecessary; see getEditPolicyIterator()
 */
protected static class EditPolicyIterator {
	private Object list[];

So you see here the iterator class is deprecated, not just the constructor. Maybe it was changed post-M4?
Comment 3 Randy Hudson CLA 2006-02-07 10:34:59 EST
The deprecation tag is not in HEAD, so you won't see this warning in M5.