質問

I'm currently developing an Abstracty Syntax Tree visitor for a lombok.ast tree that should print as plain text, in a given OutputStream object, the structure of my AST.

In order to speed up the debugging phase, is there any test source code that already contains most (if not all) of the Java constructs? There are so many special cases and weird, unusual (but still possible) things that it's even too easy to forget many of them.

It doesn't have to be exactly thought as a test case, any source code with a lot of complexity and variety will suffice.

Thanks in advance to anyone.

EDIT: Does anyone know if there's a way to understand when the visit of a lombok.ast ends?

役に立ちましたか?

解決

You should look at the sources of the openJDK (search for jdk7/test).

It's always hard to know when a visit ends when using the visitor pattern. You get called when the parent node is found the first time but not again after all children have been visited.

The usual solution is to collect the information while visiting nodes and then, after all nodes have been visited, to look at the collected information and do the actual processing.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top