Path: blob/master/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotLoadedException.java
41159 views
/*1* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.jdi;2627/**28* Thrown to indicate that the requested class has29* not yet been loaded through the appropriate class loader.30* <p>31* Due to the lazy class linking performed by many VMs, it is32* possible for a field or variable to be visible in a program33* before the associated class is loaded. Until the class is loaded34* all that is available is a signature string. If an attempt is made to35* set the value of such a field or variable from JDI, the appropriate36* type checking cannot be done because the destination class has not been37* loaded. The same is true for the element class of array elements.38* <p>39* It is not advisable to solve this problem by attempting a class load on40* the fly in this case. There are two problems in having the debugger load41* a class instead of waiting for it to load over the normal course42* of events.43* <ul>44* <li>There can be no guarantee that running the appropriate class45* loader won't cause a deadlock in loading the46* class. Class loaders can consist of arbitrary47* Java programming language code and the48* class loading methods are usually synchronized. Most of the work49* done by a debugger happens when threads are suspended. If another50* application thread is suspended within the same class loader,51* a deadlock is very possible.52* <li>Changing the order in which classes are normally loaded may either mask53* or reveal bugs in the application. An unintrusive debugger should strive54* to leave unchanged the behavior of the application being debugged.55* </ul>56* To avoid these potential problems, this exception is thrown.57* <p>58* Note that this exception will be thrown until the class in question59* is visible to the class loader of enclosing class. (That is, the60* class loader of the enclosing class must be an <i>initiating</i> class61* loader for the class in question.)62* See63* <cite>The Java Virtual Machine Specification</cite>64* for more details.65*66* @author Gordon Hirsch67* @since 1.368*/69public class ClassNotLoadedException extends Exception {7071private static final long serialVersionUID = -6242978768444298722L;7273private String className;7475public ClassNotLoadedException(String className) {76super();77this.className = className;78}7980public ClassNotLoadedException(String className, String message) {81super(message);82this.className = className;83}8485public String className() {86return className;87}88}899091