Thu, 23 Oct 2008 17:59:43 +0100
6711619: javac doesn't allow access to protected members in intersection types
Summary: Accordingly to new accessibility rules all members of intersection types (but private ones) should be accessible
Reviewed-by: jjg
1 /**
2 * @test /nodynamiccopyright/
3 * @bug 4759494 4986256
4 * @compile/ref=DivZero.noLint.out -XDstdout -XDrawDiagnostics DivZero.java
5 * @compile/ref=DivZero.lint.out -XDstdout -Xlint:divzero -XDrawDiagnostics DivZero.java
6 * @compile/ref=DivZero.lint.out -XDstdout -Xlint:all,-path -XDrawDiagnostics DivZero.java
7 */
9 class DivZero
10 {
11 public static final int ONE = 1;
13 public int i1 = 1 / 0;
14 public static final int i2 = 1 / 0;
16 public int i3 = 1 % 0;
17 public static final int i4 = 1 % 0;
19 public static final int i5 = 1 / (1 - 1);
20 public static final int i6 = 1 / (ONE - 1);
21 public static final int i7 = 1 / (ONE - ONE);
23 public static final int i8 = 1 % (1 - 1);
24 public static final int i9 = 1 % (ONE - 1);
25 public static final int i10 = 1 % (ONE - ONE);
27 public static final long ONEL = 1L;
29 public long l1 = 1L / 0L;
30 public static final long l2 = 1L / 0L;
32 public long l3 = 1L % 0L;
33 public static final long l4 = 1L % 0L;
35 public static final long l5 = 1L / (1L - 1L);
36 public static final long l6 = 1L / (ONEL - 1L);
37 public static final long l7 = 1L / (ONEL - ONEL);
39 public static final long l8 = 1L % (1L - 1L);
40 public static final long l9 = 1L % (ONEL - 1L);
41 public static final long l10 = 1L % (ONEL - ONEL);
44 static void m() {
45 int mi1 = 1 / 0;
46 int mi2 = 1 % 0;
48 mi1 /= 0;
49 mi1 %= 0;
51 long ml1 = 1L / 0L;
52 long ml2 = 1L % 0L;
54 ml1 /= 0L;
55 ml1 %= 0L;
56 }
57 }
59 @SuppressWarnings("divzero")
60 class DivZero2
61 {
62 public static final int ONE = 1;
64 public int i1 = 1 / 0;
65 public static final int i2 = 1 / 0;
67 public int i3 = 1 % 0;
68 public static final int i4 = 1 % 0;
70 public static final int i5 = 1 / (1 - 1);
71 public static final int i6 = 1 / (ONE - 1);
72 public static final int i7 = 1 / (ONE - ONE);
74 public static final int i8 = 1 % (1 - 1);
75 public static final int i9 = 1 % (ONE - 1);
76 public static final int i10 = 1 % (ONE - ONE);
78 public static final long ONEL = 1L;
80 public long l1 = 1L / 0L;
81 public static final long l2 = 1L / 0L;
83 public long l3 = 1L % 0L;
84 public static final long l4 = 1L % 0L;
86 public static final long l5 = 1L / (1L - 1L);
87 public static final long l6 = 1L / (ONEL - 1L);
88 public static final long l7 = 1L / (ONEL - ONEL);
90 public static final long l8 = 1L % (1L - 1L);
91 public static final long l9 = 1L % (ONEL - 1L);
92 public static final long l10 = 1L % (ONEL - ONEL);
95 static void m() {
96 int mi1 = 1 / 0;
97 int mi2 = 1 % 0;
99 mi1 /= 0;
100 mi1 %= 0;
102 long ml1 = 1L / 0L;
103 long ml2 = 1L % 0L;
105 ml1 /= 0L;
106 ml1 %= 0L;
107 }
108 }
110 class DivZero3
111 {
112 @SuppressWarnings("divzero")
113 public int i1 = 1 / 0;
114 @SuppressWarnings("divzero")
115 public static final int i2 = 1 / 0;
117 @SuppressWarnings("divzero")
118 public int i3 = 1 % 0;
119 @SuppressWarnings("divzero")
120 public static final int i4 = 1 % 0;
122 @SuppressWarnings("divzero")
123 public long l1 = 1L / 0L;
124 @SuppressWarnings("divzero")
125 public static final long l2 = 1L / 0L;
127 @SuppressWarnings("divzero")
128 public long l3 = 1L % 0L;
129 @SuppressWarnings("divzero")
130 public static final long l4 = 1L % 0L;
133 @SuppressWarnings("divzero")
134 static void m() {
135 int mi1 = 1 / 0;
136 int mi2 = 1 % 0;
138 mi1 /= 0;
139 mi1 %= 0;
141 long ml1 = 1L / 0L;
142 long ml2 = 1L % 0L;
144 ml1 /= 0L;
145 ml1 %= 0L;
146 }
147 }