1 /* |
1 /* |
2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
39 static void throwMe(RuntimeException ex) throws RuntimeException { |
40 static void throwMe(RuntimeException ex) throws RuntimeException { |
40 throw ex; |
41 throw ex; |
41 } |
42 } |
42 } |
43 } |
43 |
44 |
|
45 @SuppressWarnings("serial") /* Incorrect declarations are being tested. */ |
44 class B implements Serializable { |
46 class B implements Serializable { |
45 } |
47 } |
46 |
48 |
|
49 @SuppressWarnings("serial") /* Incorrect declarations are being tested. */ |
47 class C implements Serializable { |
50 class C implements Serializable { |
48 static { System.out.println("C.<clinit>"); } |
51 static { System.out.println("C.<clinit>"); } |
49 } |
52 } |
50 |
53 |
|
54 @SuppressWarnings("serial") /* Incorrect declarations are being tested. */ |
51 class B1 extends B { |
55 class B1 extends B { |
52 } |
56 } |
53 |
57 |
|
58 @SuppressWarnings("serial") /* Incorrect declarations are being tested. */ |
54 class B2 extends B { |
59 class B2 extends B { |
55 static { System.out.println("B2.<clinit>"); } |
60 static { System.out.println("B2.<clinit>"); } |
56 } |
61 } |
57 |
62 |
|
63 @SuppressWarnings("serial") /* Incorrect declarations are being tested. */ |
58 class C1 extends C { |
64 class C1 extends C { |
59 } |
65 } |
60 |
66 |
|
67 @SuppressWarnings("serial") /* Incorrect declarations are being tested. */ |
61 class C2 extends C { |
68 class C2 extends C { |
62 static { System.out.println("C2.<clinit>"); } |
69 static { System.out.println("C2.<clinit>"); } |
63 } |
70 } |
64 |
71 |
65 public class GetSuidClinitError { |
72 public class GetSuidClinitError { |
66 public static void main(String[] args) throws Exception { |
73 public static void main(String[] args) throws Exception { |
67 Class cl = Class.forName( |
74 Class<?> cl = Class.forName( |
68 "A", false, GetSuidClinitError.class.getClassLoader()); |
75 "A", false, GetSuidClinitError.class.getClassLoader()); |
69 for (int i = 0; i < 2; i++) { |
76 for (int i = 0; i < 2; i++) { |
70 try { |
77 try { |
71 ObjectStreamClass.lookup(cl).getSerialVersionUID(); |
78 ObjectStreamClass.lookup(cl).getSerialVersionUID(); |
72 throw new Error(); |
79 throw new Error(); |
81 System.out.println("warning: caught " + er + |
88 System.out.println("warning: caught " + er + |
82 " instead of ExceptionInInitializerError"); |
89 " instead of ExceptionInInitializerError"); |
83 } |
90 } |
84 } |
91 } |
85 |
92 |
86 Class[] cls = new Class[] { |
93 Class<?>[] cls = { |
87 B.class, B1.class, B2.class, |
94 B.class, B1.class, B2.class, |
88 C.class, C1.class, C2.class |
95 C.class, C1.class, C2.class |
89 }; |
96 }; |
90 long[] suids = new long[] { // 1.3.1 default serialVersionUIDs |
97 long[] suids = new long[] { // 1.3.1 default serialVersionUIDs |
91 369445310364440919L, 7585771686008346939L, -8952923334200087495L, |
98 369445310364440919L, 7585771686008346939L, -8952923334200087495L, |