author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 45714 | jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java@1820d351198d |
child 48662 | d74e9dd04df6 |
permissions | -rw-r--r-- |
24125
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
1 |
/* |
45714 | 2 |
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
24125
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
4 |
* |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
10 |
* |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
15 |
* accompanied this code). |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
16 |
* |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
20 |
* |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
23 |
* questions. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
24 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
25 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
26 |
package com.sun.tools.jdi; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
27 |
|
45714 | 28 |
import java.util.ArrayList; |
29 |
import java.util.Iterator; |
|
30 |
import java.util.List; |
|
31 |
import java.util.Map; |
|
32 |
import java.util.Set; |
|
33 |
||
24125
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
34 |
import com.sun.jdi.ClassNotLoadedException; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
35 |
import com.sun.jdi.ClassType; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
36 |
import com.sun.jdi.IncompatibleThreadStateException; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
37 |
import com.sun.jdi.InterfaceType; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
38 |
import com.sun.jdi.InvalidTypeException; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
39 |
import com.sun.jdi.InvocationException; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
40 |
import com.sun.jdi.Method; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
41 |
import com.sun.jdi.ReferenceType; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
42 |
import com.sun.jdi.ThreadReference; |
45714 | 43 |
import com.sun.jdi.VMCannotBeModifiedException; |
24125
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
44 |
import com.sun.jdi.Value; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
45 |
import com.sun.jdi.VirtualMachine; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
46 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
47 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
48 |
* A supertype for ReferenceTypes allowing method invocations |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
49 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
50 |
abstract class InvokableTypeImpl extends ReferenceTypeImpl { |
45714 | 51 |
|
24125
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
52 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
53 |
* The invocation result wrapper |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
54 |
* It is necessary because both ClassType and InterfaceType |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
55 |
* use their own type to represent the invocation result |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
56 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
57 |
static interface InvocationResult { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
58 |
ObjectReferenceImpl getException(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
59 |
ValueImpl getResult(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
60 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
61 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
62 |
InvokableTypeImpl(VirtualMachine aVm, long aRef) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
63 |
super(aVm, aRef); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
64 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
65 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
66 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
67 |
* Method invocation support. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
68 |
* Shared by ClassType and InterfaceType |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
69 |
* @param threadIntf the thread in which to invoke. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
70 |
* @param methodIntf method the {@link Method} to invoke. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
71 |
* @param origArguments the list of {@link Value} arguments bound to the |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
72 |
* invoked method. Values from the list are assigned to arguments |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
73 |
* in the order they appear in the method signature. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
74 |
* @param options the integer bit flag options. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
75 |
* @return a {@link Value} mirror of the invoked method's return value. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
76 |
* @throws java.lang.IllegalArgumentException if the method is not |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
77 |
* a member of this type, if the size of the argument list |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
78 |
* does not match the number of declared arguments for the method, or |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
79 |
* if the method is not static or is a static initializer. |
45714 | 80 |
* @throws InvalidTypeException if any argument in the |
24125
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
81 |
* argument list is not assignable to the corresponding method argument |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
82 |
* type. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
83 |
* @throws ClassNotLoadedException if any argument type has not yet been loaded |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
84 |
* through the appropriate class loader. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
85 |
* @throws IncompatibleThreadStateException if the specified thread has not |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
86 |
* been suspended by an event. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
87 |
* @throws InvocationException if the method invocation resulted in |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
88 |
* an exception in the target VM. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
89 |
* @throws InvalidTypeException If the arguments do not meet this requirement -- |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
90 |
* Object arguments must be assignment compatible with the argument |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
91 |
* type. This implies that the argument type must be |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
92 |
* loaded through the enclosing class's class loader. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
93 |
* Primitive arguments must be either assignment compatible with the |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
94 |
* argument type or must be convertible to the argument type without loss |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
95 |
* of information. See JLS section 5.2 for more information on assignment |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
96 |
* compatibility. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
97 |
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
98 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
99 |
final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
100 |
List<? extends Value> origArguments, int options) |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
101 |
throws InvalidTypeException, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
102 |
ClassNotLoadedException, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
103 |
IncompatibleThreadStateException, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
104 |
InvocationException { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
105 |
validateMirror(threadIntf); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
106 |
validateMirror(methodIntf); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
107 |
validateMirrorsOrNulls(origArguments); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
108 |
MethodImpl method = (MethodImpl) methodIntf; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
109 |
ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
110 |
validateMethodInvocation(method); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
111 |
List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
112 |
ValueImpl[] args = arguments.toArray(new ValueImpl[0]); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
113 |
InvocationResult ret; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
114 |
try { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
115 |
PacketStream stream = sendInvokeCommand(thread, method, args, options); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
116 |
ret = waitForReply(stream); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
117 |
} catch (JDWPException exc) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
118 |
if (exc.errorCode() == JDWP.Error.INVALID_THREAD) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
119 |
throw new IncompatibleThreadStateException(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
120 |
} else { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
121 |
throw exc.toJDIException(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
122 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
123 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
124 |
/* |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
125 |
* There is an implict VM-wide suspend at the conclusion |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
126 |
* of a normal (non-single-threaded) method invoke |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
127 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
128 |
if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
129 |
vm.notifySuspend(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
130 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
131 |
if (ret.getException() != null) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
132 |
throw new InvocationException(ret.getException()); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
133 |
} else { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
134 |
return ret.getResult(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
135 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
136 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
137 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
138 |
@Override |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
139 |
boolean isAssignableTo(ReferenceType type) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
140 |
ClassTypeImpl superclazz = (ClassTypeImpl) superclass(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
141 |
if (this.equals(type)) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
142 |
return true; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
143 |
} else if ((superclazz != null) && superclazz.isAssignableTo(type)) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
144 |
return true; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
145 |
} else { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
146 |
List<InterfaceType> interfaces = interfaces(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
147 |
Iterator<InterfaceType> iter = interfaces.iterator(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
148 |
while (iter.hasNext()) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
149 |
InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
150 |
if (interfaze.isAssignableTo(type)) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
151 |
return true; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
152 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
153 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
154 |
return false; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
155 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
156 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
157 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
158 |
@Override |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
159 |
final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
160 |
/* |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
161 |
* Add methods from |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
162 |
* parent types first, so that the methods in this class will |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
163 |
* overwrite them in the hash table |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
164 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
165 |
Iterator<InterfaceType> iter = interfaces().iterator(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
166 |
while (iter.hasNext()) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
167 |
InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
168 |
if (!seenInterfaces.contains(interfaze)) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
169 |
interfaze.addVisibleMethods(methodMap, seenInterfaces); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
170 |
seenInterfaces.add(interfaze); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
171 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
172 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
173 |
ClassTypeImpl clazz = (ClassTypeImpl) superclass(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
174 |
if (clazz != null) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
175 |
clazz.addVisibleMethods(methodMap, seenInterfaces); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
176 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
177 |
addToMethodMap(methodMap, methods()); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
178 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
179 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
180 |
final void addInterfaces(List<InterfaceType> list) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
181 |
List<InterfaceType> immediate = interfaces(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
182 |
list.addAll(interfaces()); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
183 |
Iterator<InterfaceType> iter = immediate.iterator(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
184 |
while (iter.hasNext()) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
185 |
InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
186 |
interfaze.addInterfaces(list); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
187 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
188 |
ClassTypeImpl superclass = (ClassTypeImpl) superclass(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
189 |
if (superclass != null) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
190 |
superclass.addInterfaces(list); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
191 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
192 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
193 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
194 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
195 |
* Returns all the implemented interfaces recursively |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
196 |
* @return A list of all the implemented interfaces (recursively) |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
197 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
198 |
final List<InterfaceType> getAllInterfaces() { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
199 |
List<InterfaceType> all = new ArrayList<>(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
200 |
addInterfaces(all); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
201 |
return all; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
202 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
203 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
204 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
205 |
* Shared implementation of {@linkplain ClassType#allMethods()} and |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
206 |
* {@linkplain InterfaceType#allMethods()} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
207 |
* @return A list of all methods (recursively) |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
208 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
209 |
public final List<Method> allMethods() { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
210 |
ArrayList<Method> list = new ArrayList<>(methods()); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
211 |
ClassType clazz = superclass(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
212 |
while (clazz != null) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
213 |
list.addAll(clazz.methods()); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
214 |
clazz = clazz.superclass(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
215 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
216 |
/* |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
217 |
* Avoid duplicate checking on each method by iterating through |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
218 |
* duplicate-free allInterfaces() rather than recursing |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
219 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
220 |
for (InterfaceType interfaze : getAllInterfaces()) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
221 |
list.addAll(interfaze.methods()); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
222 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
223 |
return list; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
224 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
225 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
226 |
@Override |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
227 |
final List<ReferenceType> inheritedTypes() { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
228 |
List<ReferenceType> inherited = new ArrayList<>(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
229 |
if (superclass() != null) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
230 |
inherited.add(0, superclass()); /* insert at front */ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
231 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
232 |
for (ReferenceType rt : interfaces()) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
233 |
inherited.add(rt); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
234 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
235 |
return inherited; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
236 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
237 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
238 |
private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
239 |
final MethodImpl method, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
240 |
final ValueImpl[] args, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
241 |
final int options) { |
33834
fc9527f5a30f
8129348: Debugger hangs in trace mode with TRACE_SENDS
kevinw
parents:
25859
diff
changeset
|
242 |
/* |
fc9527f5a30f
8129348: Debugger hangs in trace mode with TRACE_SENDS
kevinw
parents:
25859
diff
changeset
|
243 |
* Cache the values of args when TRACE_SENDS is enabled, for later printing. |
fc9527f5a30f
8129348: Debugger hangs in trace mode with TRACE_SENDS
kevinw
parents:
25859
diff
changeset
|
244 |
* If not cached, printing causes a remote call while synchronized, and deadlock. |
fc9527f5a30f
8129348: Debugger hangs in trace mode with TRACE_SENDS
kevinw
parents:
25859
diff
changeset
|
245 |
*/ |
45714 | 246 |
if ((vm.traceFlags & VirtualMachine.TRACE_SENDS) != 0) { |
33834
fc9527f5a30f
8129348: Debugger hangs in trace mode with TRACE_SENDS
kevinw
parents:
25859
diff
changeset
|
247 |
for (ValueImpl arg: args) { |
fc9527f5a30f
8129348: Debugger hangs in trace mode with TRACE_SENDS
kevinw
parents:
25859
diff
changeset
|
248 |
arg.toString(); |
fc9527f5a30f
8129348: Debugger hangs in trace mode with TRACE_SENDS
kevinw
parents:
25859
diff
changeset
|
249 |
} |
fc9527f5a30f
8129348: Debugger hangs in trace mode with TRACE_SENDS
kevinw
parents:
25859
diff
changeset
|
250 |
} |
24125
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
251 |
CommandSender sender = getInvokeMethodSender(thread, method, args, options); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
252 |
PacketStream stream; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
253 |
if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
254 |
stream = thread.sendResumingCommand(sender); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
255 |
} else { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
256 |
stream = vm.sendResumingCommand(sender); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
257 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
258 |
return stream; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
259 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
260 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
261 |
private void validateMethodInvocation(Method method) |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
262 |
throws InvalidTypeException, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
263 |
InvocationException { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
264 |
if (!canInvoke(method)) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
265 |
throw new IllegalArgumentException("Invalid method"); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
266 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
267 |
/* |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
268 |
* Method must be a static and not a static initializer |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
269 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
270 |
if (!method.isStatic()) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
271 |
throw new IllegalArgumentException("Cannot invoke instance method on a class/interface type"); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
272 |
} else if (method.isStaticInitializer()) { |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
273 |
throw new IllegalArgumentException("Cannot invoke static initializer"); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
274 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
275 |
} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
276 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
277 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
278 |
* A subclass will provide specific {@linkplain CommandSender} |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
279 |
* @param thread the current invocation thread |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
280 |
* @param method the method to invoke |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
281 |
* @param args the arguments to pass to the method |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
282 |
* @param options the integer bit flag options |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
283 |
* @return the specific {@literal CommandSender} instance |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
284 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
285 |
abstract CommandSender getInvokeMethodSender(ThreadReferenceImpl thread, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
286 |
MethodImpl method, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
287 |
ValueImpl[] args, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
288 |
int options); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
289 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
290 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
291 |
* Waits for the reply to the last sent command |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
292 |
* @param stream the stream to listen for the reply on |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
293 |
* @return the {@linkplain InvocationResult} instance |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
294 |
* @throws JDWPException when something goes wrong in JDWP |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
295 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
296 |
abstract InvocationResult waitForReply(PacketStream stream) throws JDWPException; |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
297 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
298 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
299 |
* Get the {@linkplain ReferenceType} superclass |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
300 |
* @return the superclass or null |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
301 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
302 |
abstract ClassType superclass(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
303 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
304 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
305 |
* Get the implemented/extended interfaces |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
306 |
* @return the list of implemented/extended interfaces |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
307 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
308 |
abstract List<InterfaceType> interfaces(); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
309 |
|
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
310 |
/** |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
311 |
* Checks the provided method whether it can be invoked |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
312 |
* @param method the method to check |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
313 |
* @return {@code TRUE} if the implementation knows how to invoke the method, |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
314 |
* {@code FALSE} otherwise |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
315 |
*/ |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
316 |
abstract boolean canInvoke(Method method); |
b85eeaae56c7
8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents:
diff
changeset
|
317 |
} |