Tue, 10 Apr 2012 08:15:25 -0700
7074397: Build infrastructure changes (makefile re-write)
Summary: New makefiles transition, old and new living side by side for now.
Reviewed-by: ohair, jjg, dholmes, ohrstrom, erikj, ihse, tgranat, ykantser
Contributed-by: ohrstrom <fredrik.ohrstrom@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 4880220
4 * @summary Add a warning when accessing a static method via an reference
5 *
6 * @compile/ref=T4880220.empty.out T4880220.java
7 * @compile/ref=T4880220.warn.out -XDrawDiagnostics -Xlint:static T4880220.java
8 * @compile/ref=T4880220.warn.out -XDrawDiagnostics -Xlint:all T4880220.java
9 * @compile/ref=T4880220.empty.out -XDrawDiagnostics -Xlint:all,-static T4880220.java
10 * @compile/ref=T4880220.error.out/fail -XDrawDiagnostics -Werror -Xlint:all T4880220.java
11 */
13 public class T4880220 {
14 void m1() {
15 int good_1 = C.m();
16 int good_2 = C.f;
17 int good_3 = C.x;
19 C c = new C();
20 int bad_inst_1 = c.m();
21 int bad_inst_2 = c.f;
22 int bad_inst_3 = c.x;
24 int bad_expr_1 = c().m();
25 int bad_expr_2 = c().f;
26 int bad_expr_3 = c().x;
27 }
29 void m2() {
30 Class<?> good_1 = C.class;
31 Class<?> good_2 = C[].class;
32 }
34 C c() {
35 return new C();
36 }
38 static class C {
39 static int m() { return 0; }
40 static int f;
41 static final int x = 3;
42 }
43 }