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

Last change on this file was 475, checked in by wouter, 18 months ago

doc

File size: 1.6 KB
Line 
1package testcode;
2
3/**
4 * This class has annotations that override the standard translation process
5 * After translation, all functions should print "ok"
6 *
7 */
8public class TranslationHints {
9 /**
10 * We have both javadoc and python code here.
11 *
12 * @return string
13 */
14 /*#PY
15 * def fulloverride(): return ("1ok")
16 */
17 public static String fulloverride() {
18 return "1ko";
19 }
20
21 /**
22 * @return String with ok if this is translated properly. This prints 2ko in
23 * java, 2ok in python.
24 */
25 public static String fulloverride2() {
26 //#PY return("2ok")
27 return "2ko";
28 }
29
30 /**
31 * some multi-line javadoc <br>
32 * second comment line.
33 *
34 * @return some ok string
35 */
36 public static String overrideif() {
37 // extra comment to see where it goes
38 //#PY return("3ok")
39 if (true)
40 return ("3ko");
41 return "3ko";
42 }
43
44 public static String overrideif2() {
45 /*#PY
46 * if True: return("4ok")
47 */
48 if (true)
49 return "4ko";
50 return ("4ko");
51 }
52
53 public static String overridenothing() {
54 // comment should remain here.
55 return "5ok";
56 }
57
58 public static String overrideWithEmpty() {
59 //#PY
60 if (true)
61 return "6ko";
62 return "6ok";
63 }
64
65 public static String overrideWithEmpty2() {
66 /*#PY */
67 if (true)
68 return "7ko";
69 return "7ok";
70 }
71
72 static public void main(String[] args) {
73 System.out.println(fulloverride());
74 System.out.println(fulloverride2());
75 System.out.println(overrideif());
76 System.out.println(overrideif2());
77 System.out.println(overridenothing());
78 System.out.println(overrideWithEmpty());
79 System.out.println(overrideWithEmpty2());
80 }
81}
Note: See TracBrowser for help on using the repository browser.