author | jdv |
Tue, 09 Aug 2016 13:45:17 +0530 | |
changeset 40432 | 6a878eae7459 |
parent 24334 | 36096f7271f4 |
permissions | -rw-r--r-- |
24334
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
1 |
/* |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
4 |
* |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
8 |
* |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
13 |
* accompanied this code). |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
14 |
* |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
18 |
* |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
21 |
* questions. |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
22 |
*/ |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
23 |
|
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
24 |
/* |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
25 |
* @test TestClassResolutionFail |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
26 |
* @bug 8023697 |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
27 |
* @summary This tests that failed class resolution doesn't report different class name in detail message for the first and subsequent times |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
28 |
*/ |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
29 |
|
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
30 |
import java.io.File; |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
31 |
|
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
32 |
public class TestClassResolutionFail { |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
33 |
static String message; |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
34 |
public static void test1() throws RuntimeException { |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
35 |
try { |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
36 |
Property p = new Property(); |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
37 |
} catch (LinkageError e) { |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
38 |
message = e.getMessage(); |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
39 |
} |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
40 |
try { |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
41 |
Property p = new Property(); |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
42 |
} catch (LinkageError e) { |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
43 |
System.out.println(e.getMessage()); |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
44 |
if (!e.getMessage().equals(message)) { |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
45 |
throw new RuntimeException("Wrong message: " + message + " != " + e.getMessage()); |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
46 |
} |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
47 |
} |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
48 |
} |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
49 |
public static void main(java.lang.String[] unused) throws Exception { |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
50 |
// Remove PropertySuper class |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
51 |
String testClasses = System.getProperty("test.classes", "."); |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
52 |
File f = new File(testClasses + File.separator + "PropertySuper.class"); |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
53 |
f.delete(); |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
54 |
test1(); |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
55 |
} |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
56 |
} |
36096f7271f4
8023697: failed class resolution reports different class name in detail message for the first and subsequent times
coleenp
parents:
diff
changeset
|
57 |