blob: c980d833543e5cf33641e2dbdfd38b72cb663cda [file] [log] [blame]
Federico Tomassetti3cf311c2015-02-19 12:15:06 +00001import com.github.javaparser.JavaParser;
2import com.github.javaparser.ParseException;
3import com.github.javaparser.ast.CompilationUnit;
4import com.github.javaparser.ast.Node;
5
6import java.io.ByteArrayInputStream;
7import java.io.InputStream;
8import java.nio.charset.StandardCharsets;
9
10/**
11 * Created by federico on 03/09/15.
12 */
13public class Issue192 {
14
15 public static void main(String[] args) throws ParseException {
16 String code = "public class StepImplementation {\n" +
17 " public void contextStep() {\n" +
18 " for (int i = 0; i < 5; i++) {\n" +
19 " // foo bar\n" +
20 " System.out.println();\n" +
21 " // another foo bar\n" +
22 " }\n" +
23 " }\n" +
24 "}";
25 InputStream stream = new ByteArrayInputStream(code.getBytes(StandardCharsets.UTF_8));
26 CompilationUnit cu = JavaParser.parse(stream);
27 lookInto(cu);
28 }
29
30 private static void lookInto(Node node) {
31 if (node.getOrphanComments() != null && node.getOrphanComments().size() > 0) {
32 System.out.println("GOTCHA in " + node.getClass().getCanonicalName());
33 }
34 for (Node child : node.getChildrenNodes()) {
35 lookInto(child);
36 }
37 }
38
39}