author | robm |
Tue, 13 Sep 2016 14:47:29 +0100 | |
changeset 40938 | 5b0977acc842 |
parent 39810 | d290bef927c4 |
permissions | -rw-r--r-- |
39810
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
1 |
/* |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
3 |
* @bug 8161985 |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
4 |
* @summary Spurious override of Object.getClass leads to NPE |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
5 |
* @compile/fail/ref=T8161985a.out -XDrawDiagnostics T8161985a.java |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
6 |
*/ |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
7 |
|
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
8 |
class T8161985 { |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
9 |
public static void main(String [] arg) { |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
10 |
T8161985 t = new T8161985(); |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
11 |
t.getClass(); |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
12 |
|
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
13 |
} |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
14 |
public void getClass() { |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
15 |
Fred1 f = new Fred1(); |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
16 |
System.out.println( "fred classname: " + f.getClassName()); |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
17 |
} |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
18 |
|
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
19 |
|
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
20 |
abstract class Fred { |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
21 |
public String getClassName() { |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
22 |
return this.getClass().getSimpleName(); |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
23 |
} |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
24 |
} |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
25 |
|
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
26 |
class Fred1 extends Fred { |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
27 |
} |
d290bef927c4
8161985: Spurious override of Object.getClass leads to NPE
mcimadamore
parents:
diff
changeset
|
28 |
} |