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

Last change on this file was 1300, checked in by wouter, 2 weeks ago

committing before trying to fix issue with static field access

File size: 1.5 KB
Line 
1package testcode;
2
3import java.math.BigDecimal;
4
5import org.eclipse.jdt.annotation.NonNull;
6
7class HiddenClass {
8 protected static final Integer EIGHT = 8;
9 public static final Integer NINE = 9;
10}
11
12class SomeClass {
13 private int x;
14
15 SomeClass(int x) {
16 this.x = x;
17 }
18}
19
20/** for testing #407 parent field access */
21class Parent {
22 protected String x = "ok20";
23
24 public static String s = "ok21";
25}
26
27class Child extends Parent {
28 public String get() {
29 return x;
30 }
31
32 public String getS() {
33 return s;
34 }
35}
36
37public class FieldAccess extends SomeClass {
38
39 private @NonNull Integer ONE = 1;
40 public final @NonNull Integer TWO = 2;
41 static @NonNull Integer THREE = 3;
42 private @NonNull static Integer FOUR = 4;
43 private @NonNull final static Integer FIVE = 5;
44 @NonNull
45 private final Integer TEN;
46
47 public FieldAccess() {
48 super(1);
49 TEN = 10;
50 System.out.println("ok" + BigDecimal.ZERO.toString());
51 System.out.println("ok" + ONE.toString());
52 System.out.println("ok" + TWO.toString());
53 System.out.println("ok" + THREE.toString());
54 System.out.println("ok" + FOUR.toString());
55 System.out.println("ok" + FIVE.toString());
56
57 System.out.println("ok" + HiddenClass.EIGHT.toString());
58 System.out.println("ok" + HiddenClass.NINE.toString());
59 System.out.println("ok" + TEN.toString());
60 System.out.println(new Child().get());
61 System.out.println(new Child().s); // static field of parent
62 System.out.println(new Child().getS());
63
64 }
65
66 static public void main(String[] args) {
67 new FieldAccess();
68 }
69}
Note: See TracBrowser for help on using the repository browser.