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

Bug 334386

Summary: Bug in FilteringScope???
Product: [Modeling] TMF Reporter: Victor Noël <victor.noel>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: sven.efftinge, victor.noel
Version: 1.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Victor Noël CLA 2011-01-14 10:12:43 EST
Build Identifier: 

Hello,

I was trying to use org.eclipse.xtext.scoping.impl.FilteringScope and I noticed the following code:
	public FilteringScope(IScope delegate, final EClass ...allowedTypes) {
		this.delegate = delegate;
		this.filter = new Predicate<IEObjectDescription>(){

			public boolean apply(IEObjectDescription input) {
				for (EClass eClass : allowedTypes) {
					if (eClass.isSuperTypeOf(eClass))
						return true;
				}
				return false;
			}};
	}

Shouldn't it be something like:
	public FilteringScope(IScope delegate, final EClass ...allowedTypes) {
		this.delegate = delegate;
		this.filter = new Predicate<IEObjectDescription>(){

			public boolean apply(IEObjectDescription input) {
				for (EClass eClass : allowedTypes) {
					if (eClass.isSuperTypeOf(input.getEClass()))
						return true;
				}
				return false;
			}};
	}

Thanks

Reproducible: Always
Comment 1 Sven Efftinge CLA 2011-01-17 02:28:28 EST

*** This bug has been marked as a duplicate of bug 330404 ***