How to get the type of the variable?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get the type of the variable?

tanchi
Hi,
    I m writing one checkstyle task & for that i need to know the type of a variable?
    How to get that?
     Thanks


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
Reply | Threaded
Open this post in threaded view
|

Re: How to get the type of the variable?

Lars Kühne-3


    I m writing one checkstyle task & for that i need to know the type of a variable?
    How to get that?
     Thanks


Sorry, but unfortunately this is not possible:

http://checkstyle.sourceforge.net/writingchecks.html#Limitations

Regards,
Lars


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
Reply | Threaded
Open this post in threaded view
|

Re: How to get the type of the variable?

Lars Kühne-3
Please make sure you at least CC the list, that way others will be able to chime in and help you while I have other things on my todo list.


Is it possible to traverse through the whole tree?For Example
     A
       B
         C

B is C's parent
A is B's parent

 I am at C.I can get B,by calling C.getParent();  // assuming C is of type DetailAst
But when i try to call getParent() for B ,i am getting NullPointerException.
What to do?I have to reach A and may be even parent of A and so on.
Please Help.
         Thanks a lot.


That should not happen, and checkstyle's own code does this everywhere. Examples are in ScopeUtils, or in DoubleCheckedLockingCheck.getLowestParent().

Can you post an example input file and tell us which nodes you are talking about?

Regards,
Lars


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Checkstyle-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user