problem with visitNewExpression ?

hi,

I have a problem with the visitNewExpression method from the PsiRecursiveElementVisitor class.
The following snippet of code does not invoke a call to the visitNewExpression

form.add(new RequiredTextField("username").add(StringValidator.maximumLength(32)));

I would have like to get a call for the new RequiredTextField.

Is this case calling some of the other "visit" methods ?

regards

Anders

4 comments

Make sure you are calling "super.visitXXX" somewhere in every visitXXX method you implement. If you don't, traversal will not occur into the children of the visited object. Per the example, I'm betting you implemented either visitReferenceExpression or visitMethodCall and didn't call super in them. It's easy to overlook, and results in just this sort of problem.

--Dave Griffith

0

Thanks. That fixed the problem. Could have been nice if that was added to javadoc.

regards

Anders

0

Could have been nice if that was added to javadoc.

After you write your first five hundred or so PsiVisitors, it's all pretty easy to remember.

--Dave Griffith

0

After you write your first five hundred or so
PsiVisitors, it's all pretty easy to remember.


Oh well - I only need about 499 then... :)

BTW: Cool plugins you have created - you must have spent more than a few hours I guess ;)

0

Please sign in to leave a comment.