Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/jcl/src/java.base/share/classes/java/lang/ClassCastException.java
12513 views
1
/*[INCLUDE-IF Sidecar16]*/
2
3
package java.lang;
4
5
/*******************************************************************************
6
* Copyright (c) 1998, 2017 IBM Corp. and others
7
*
8
* This program and the accompanying materials are made available under
9
* the terms of the Eclipse Public License 2.0 which accompanies this
10
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
11
* or the Apache License, Version 2.0 which accompanies this distribution and
12
* is available at https://www.apache.org/licenses/LICENSE-2.0.
13
*
14
* This Source Code may also be made available under the following
15
* Secondary Licenses when the conditions for such availability set
16
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
17
* General Public License, version 2 with the GNU Classpath
18
* Exception [1] and GNU General Public License, version 2 with the
19
* OpenJDK Assembly Exception [2].
20
*
21
* [1] https://www.gnu.org/software/classpath/license.html
22
* [2] http://openjdk.java.net/legal/assembly-exception.html
23
*
24
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
25
*******************************************************************************/
26
27
/**
28
* This runtime exception is thrown when a program attempts to cast an object
29
* to a type with which it is not compatible.
30
*
31
* @version initial
32
*/
33
public class ClassCastException extends RuntimeException {
34
private static final long serialVersionUID = -9223365651070458532L;
35
36
/**
37
* Constructs a new instance of this class with its walkback filled in.
38
*
39
* @version initial
40
*/
41
public ClassCastException() {
42
super();
43
}
44
45
/**
46
* Constructs a new instance of this class with its walkback and message
47
* filled in.
48
*
49
* @version initial
50
*
51
* @param detailMessage
52
* String The detail message for the exception.
53
*/
54
public ClassCastException(String detailMessage) {
55
super(detailMessage);
56
}
57
58
/**
59
* Constructs a new instance of this class with its walkback and message
60
* filled in.
61
*
62
* @version initial
63
*
64
* @param instanceClass
65
* Class The class being cast from.
66
*
67
* @param castClass
68
* Class The class being cast to.
69
*/
70
ClassCastException(Class instanceClass, Class castClass) {
71
/*[MSG "K0340", "{0} incompatible with {1}"]*/
72
super(com.ibm.oti.util.Msg.getString("K0340", instanceClass.getName(), castClass.getName())); //$NON-NLS-1$
73
}
74
75
}
76
77