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