1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  * Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 only, as
8  * published by the Free Software Foundation.  Oracle designates this
9  * particular file as subject to the "Classpath" exception as provided
10  * by Oracle in the LICENSE file that accompanied this code.
11  *
12  * This code is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15  * version 2 for more details (a copy is included in the LICENSE file that
16  * accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License version
19  * 2 along with this work; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21  *
22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23  * or visit www.oracle.com if you need additional information or have any
24  * questions.
25  */
26 
27 package java.lang;
28 
29 /**
30  * Thrown if the Java Virtual Machine or a {@code ClassLoader} instance
31  * tries to load in the definition of a class (as part of a normal method call
32  * or as part of creating a new instance using the {@code new} expression)
33  * and no definition of the class could be found.
34  * <p>
35  * The searched-for class definition existed when the currently
36  * executing class was compiled, but the definition can no longer be
37  * found.
38  *
39  * @since   1.0
40  */
41 public class NoClassDefFoundError extends LinkageError {
42     @java.io.Serial
43     private static final long serialVersionUID = 9095859863287012458L;
44 
45     /**
46      * Constructs a {@code NoClassDefFoundError} with no detail message.
47      */
NoClassDefFoundError()48     public NoClassDefFoundError() {
49         super();
50     }
51 
52     /**
53      * Constructs a {@code NoClassDefFoundError} with the specified
54      * detail message.
55      *
56      * @param   s   the detail message.
57      */
NoClassDefFoundError(String s)58     public NoClassDefFoundError(String s) {
59         super(s);
60     }
61 
62     // Android-added: A new constructor for use by the Android runtime.
63     /**
64      * Constructs a new {@code NoClassDefFoundError} with the current stack
65      * trace, the specified detail message and the specified cause. Used
66      * internally by the Android runtime.
67      *
68      * @param detailMessage
69      *            the detail message for this error.
70      * @param throwable
71      *            the cause of this error.
72      */
NoClassDefFoundError(String detailMessage, Throwable throwable)73     private NoClassDefFoundError(String detailMessage, Throwable throwable) {
74         super(detailMessage, throwable);
75     }
76 }
77