Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » How to get the type of the class being analyzed?
How to get the type of the class being analyzed? [message #115802] Wed, 17 October 2007 14:21 Go to next message
Eclipse UserFriend
Originally posted by: saorf.de.ibm.com

I start with this:

CodeReviewResource resource =
(CodeReviewResource)getProvider().getProperty(history.getHis toryId(),
CodeReviewProvider.RESOURCE_PROPERTY);

List typeDeclarations =
resource.getTypedNodeList(resource.getResourceCompUnit(),
ASTNode.TYPE_DECLARATION);

How can I get the type, the whole tree represents? If I say
typeDeclarations.get(0).getClass(), I get the type TypeDeclaration.

That makes sence.

But how can I get the type of the class I analyze (Is there a special
expression describing this type?)?
Re: How to get the type of the class being analyzed? [message #115909 is a reply to message #115802] Thu, 18 October 2007 09:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: s_gutz.ca.ibm.com

Once you get the type declaration you can resolve it to a binding.

TypeBinding binding = td.resolveTypeBinding();

Note that you should always check the returned value for null before
using it and fail gracefully. Do this because it is possible that the
code you are analyzing doesn't actually compile.

Steve


Sascha Orf wrote:
> I start with this:
>
> CodeReviewResource resource =
> (CodeReviewResource)getProvider().getProperty(history.getHis toryId(),
> CodeReviewProvider.RESOURCE_PROPERTY);
>
> List typeDeclarations =
> resource.getTypedNodeList(resource.getResourceCompUnit(),
> ASTNode.TYPE_DECLARATION);
>
> How can I get the type, the whole tree represents? If I say
> typeDeclarations.get(0).getClass(), I get the type TypeDeclaration.
>
> That makes sence.
>
> But how can I get the type of the class I analyze (Is there a special
> expression describing this type?)?
>
Re: How to get the type of the class being analyzed? [message #116036 is a reply to message #115909] Fri, 19 October 2007 13:45 Go to previous message
Eclipse UserFriend
Originally posted by: saorf.de.ibm.com

Thanks for that!

After some short tries I think that brings me further!

:-)
Previous Topic:Problem with ModifierRuleFilter and Interfaces
Next Topic:Problems with Integrated Agent Controller
Goto Forum:
  


Current Time: Tue Apr 23 12:04:37 GMT 2024

Powered by FUDForum. Page generated in 0.04497 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top