equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2007, 2015, 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. |
24 |
24 |
25 /** |
25 /** |
26 * @test |
26 * @test |
27 |
27 |
28 * @bug 6490436 |
28 * @bug 6490436 |
29 * @summary Verify that protected constructor calls are not allowed for classfile version >= 50 (but that they are allowed for lesser versions). |
29 * @summary Verify that protected constructor calls are not allowed for any classfile versions in either verifier. |
30 * @author Keith McGuigan |
30 * @author Keith McGuigan |
31 */ |
31 */ |
32 |
32 |
33 public class VerifyProtectedConstructor extends ClassLoader { |
33 public class VerifyProtectedConstructor extends ClassLoader { |
34 public static void main(String argv[]) throws Exception { |
34 public static void main(String argv[]) throws Exception { |
36 |
36 |
37 t.loadSuperClass(); |
37 t.loadSuperClass(); |
38 |
38 |
39 try { |
39 try { |
40 t.checkClassVersion(49); // should not throw VerifyError |
40 t.checkClassVersion(49); // should not throw VerifyError |
|
41 throw new Exception("FAIL: should be a VerifyError for CF version 49"); |
41 } |
42 } |
42 catch(VerifyError e) { |
43 catch(VerifyError e) { |
43 throw new Exception("FAIL: should be no VerifyError for CF version 49"); |
44 System.out.println("PASS for CF version 49"); |
44 } |
45 } |
45 |
46 |
46 try { |
47 try { |
47 t.checkClassVersion(50); // should throw VerifyError |
48 t.checkClassVersion(50); // should throw VerifyError |
48 throw new Exception("FAIL: should be a VerifyError for CF version 50"); |
49 throw new Exception("FAIL: should be a VerifyError for CF version 50"); |