mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
180948: fix ClassCastException (follow up)
This commit is contained in:
parent
ca26fe7a9d
commit
19a895a652
3 changed files with 58 additions and 2 deletions
|
@ -47,7 +47,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* additionally check that the binding obtained has characteristics as
|
||||
* expected (type,name,etc..)
|
||||
*/
|
||||
public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBase {
|
||||
public abstract class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBase {
|
||||
|
||||
public static class SingleProject extends IndexCPPBindingResolutionTest {
|
||||
public SingleProject() {setStrategy(new SinglePDOMTestStrategy(true));}
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||
import org.eclipse.cdt.core.index.IIndex;
|
||||
|
@ -86,8 +87,10 @@ public class CPPCompositesFactory extends AbstractCompositeFactory implements IC
|
|||
namespaces = getNamespaces(rscope.getScopeBinding());
|
||||
}
|
||||
return new CompositeCPPNamespaceScope(this, namespaces);
|
||||
} else if(rscope instanceof ICPPTemplateScope) {
|
||||
return new CompositeCPPTemplateScope(this, (ICPPTemplateScope) rscope);
|
||||
} else {
|
||||
throw new CompositingNotImplementedError();
|
||||
throw new CompositingNotImplementedError(rscope.getClass().getName());
|
||||
}
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems 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:
|
||||
* Andrew Ferguson (Symbian) - Initial implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
|
||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositeScope;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPTemplateScope extends CompositeScope implements ICPPTemplateScope {
|
||||
public CompositeCPPTemplateScope(ICompositesFactory cf,
|
||||
ICPPTemplateScope rbinding) {
|
||||
super(cf, (IIndexFragmentBinding) rbinding);
|
||||
}
|
||||
|
||||
public ICPPTemplateDefinition getTemplateDefinition() throws DOMException {
|
||||
ICPPTemplateDefinition preresult= ((ICPPTemplateScope) rbinding).getTemplateDefinition();
|
||||
return (ICPPTemplateDefinition) processUncertainBinding(preresult);
|
||||
}
|
||||
|
||||
public IBinding[] find(String name, boolean prefixLookup)
|
||||
throws DOMException {
|
||||
IBinding[] preresult = ((ICPPTemplateScope)rbinding).find(name, prefixLookup);
|
||||
return processUncertainBindings(preresult);
|
||||
}
|
||||
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
IBinding[] preresult = ((ICPPTemplateScope)rbinding).find(name);
|
||||
return processUncertainBindings(preresult);
|
||||
}
|
||||
|
||||
public IBinding getBinding(IASTName name, boolean resolve) throws DOMException {
|
||||
IBinding binding = ((ICPPTemplateScope)rbinding).getBinding(name, resolve);
|
||||
return processUncertainBinding(binding);
|
||||
}
|
||||
|
||||
public IIndexBinding getScopeBinding() {
|
||||
return cf.getCompositeBinding(rbinding);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue