Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] CPPMethodTemplate.getClassOwner() results in java.lang.ClassCastException

Hi all,

While browsing the C++ Class, there was a method template defined inside
it.

I could get function Declarator for ti.

Using that function Declaration I extracted binding for it which was
CPPMethodTemplate

Now I had to get the class of which this method is a member.

So I tried  ((CPPMethod)binding).getClassOwner().

But it returned me  java.lang.ClassCastException:
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateScope incompatible
with org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope.

When I tried to look at CPPMethodTemplate.java file.

Then the code in it for this method is as follows :

public ICPPClassType getClassOwner() throws DOMException{
      ICPPClassScope scope = (ICPPClassScope)getScope();
      return scope.getClassType();
}

Can someone please help me explaining what is wrong here and how to resolve
this exception.

Thanks & Regards,
Nayna Jain



Back to the top