source: java2python/core/src/test/java/testcode/Comment.java

Last change on this file was 1387, checked in by wouter, 7 months ago

handle comments on VariableDeclarations

File size: 1.8 KB
Line 
1package testcode;
2
3import org.eclipse.jdt.annotation.NonNull;
4
5/**
6 * Test for overriding annotations.
7 */
8//#PY # this should replace the first annotation
9@Deprecated
10//#PY # this should replace the 2nd annotation
11@SuppressWarnings({ "yahoo" })
12//This comment should stay here
13//#PY # overrides the non-translatable annotation
14@StopHere
15/*#PY
16 * class Comment2:
17 * '''
18 * Full override of the class
19 * '''
20 * def __init__(self):
21 * print("ok2")
22*/
23class Comment2 {
24 public Comment2() {
25 System.out.println("ko2");
26 }
27}
28
29/*#PY
30 * class Comment3:
31 * '''
32 * Full override of the class
33 * '''
34 * def __init__(self):
35 * print("ok3")
36*/
37class Comment3 {
38 public Comment3() {
39 System.out.println("ko3");
40 }
41
42}
43
44public class Comment {
45
46 //1 line comment on a field
47 int comment1;
48
49 /*
50 * 2 line comment on field
51 * this is line 2
52 */
53 int comment2;
54
55 /**
56 * This comment should end up inside the constructor definition in python.
57 * This is a multiline comment to ensure it is translated using a triple-'
58 * block
59 */
60 Comment() {
61 test1();
62 new Comment2();
63 new Comment3();
64 System.out.println(test4());
65 //#PY print("ok5")
66 System.out.println("ko5");
67 System.out.println(test6());
68 }
69
70 //#PY # this should replace the first annotation
71 @Deprecated
72 //#PY # this should replace the 2nd annotation
73 @SuppressWarnings({ "yahoo" })
74 //This comment should stay here
75 /*#PY
76 * def test1(self):
77 * print("ok1")
78 */
79 public void test1() {
80 System.out.println("ko1");
81 }
82
83 /**
84 * This is the method 4 comment.
85 *
86 * @return test4 result string
87 */
88 public @NonNull String test4() {
89 //#PY return "ok4"
90 return "ko4";
91 }
92
93 public String test6() {
94 //#PY v="ok6"
95 String v = "ko6";
96 return v;
97 }
98
99 static public void main(String[] args) {
100 new Comment();
101 }
102
103}
Note: See TracBrowser for help on using the repository browser.