|
1 /* |
|
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
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 |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 package jdk.jshell.execution; |
|
26 |
|
27 import jdk.jshell.spi.ExecutionControl.ClassBytecodes; |
|
28 import jdk.jshell.spi.ExecutionControl.ClassInstallException; |
|
29 import jdk.jshell.spi.ExecutionControl.EngineTerminationException; |
|
30 import jdk.jshell.spi.ExecutionControl.InternalException; |
|
31 import jdk.jshell.spi.ExecutionControl.NotImplementedException; |
|
32 |
|
33 /** |
|
34 * This interface specifies the loading specific subset of |
|
35 * {@link jdk.jshell.spi.ExecutionControl}. For use in encapsulating the |
|
36 * {@link java.lang.ClassLoader} implementation. |
|
37 * |
|
38 * @since 9 |
|
39 */ |
|
40 public interface LoaderDelegate { |
|
41 |
|
42 /** |
|
43 * Attempts to load new classes. |
|
44 * |
|
45 * @param cbcs the class name and bytecodes to load |
|
46 * @throws ClassInstallException exception occurred loading the classes, |
|
47 * some or all were not loaded |
|
48 * @throws NotImplementedException if not implemented |
|
49 * @throws EngineTerminationException the execution engine has terminated |
|
50 */ |
|
51 void load(ClassBytecodes[] cbcs) |
|
52 throws ClassInstallException, NotImplementedException, EngineTerminationException; |
|
53 |
|
54 /** |
|
55 * Notify that classes have been redefined. |
|
56 * |
|
57 * @param cbcs the class names and bytecodes that have been redefined |
|
58 */ |
|
59 public void classesRedefined(ClassBytecodes[] cbcs); |
|
60 |
|
61 /** |
|
62 * Adds the path to the execution class path. |
|
63 * |
|
64 * @param path the path to add |
|
65 * @throws EngineTerminationException the execution engine has terminated |
|
66 * @throws InternalException an internal problem occurred |
|
67 */ |
|
68 void addToClasspath(String path) |
|
69 throws EngineTerminationException, InternalException; |
|
70 |
|
71 /** |
|
72 * Finds the class with the specified binary name. |
|
73 * |
|
74 * @param name the binary name of the class |
|
75 * @return the Class Object |
|
76 * @throws ClassNotFoundException if the class could not be found |
|
77 */ |
|
78 Class<?> findClass(String name) throws ClassNotFoundException; |
|
79 } |