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
26 package jdk.internal.access;
27
28 import jdk.internal.foreign.abi.NativeEntryPoint;
29
30 import java.lang.foreign.MemoryLayout;
31 import java.lang.invoke.MethodHandle;
32 import java.lang.invoke.MethodType;
33 import java.lang.invoke.VarHandle;
34 import java.lang.reflect.Constructor;
35 import java.lang.reflect.Field;
36 import java.nio.ByteOrder;
37 import java.util.List;
38 import java.util.Map;
39 import java.util.stream.Stream;
40
41 public interface JavaLangInvokeAccess {
42 /**
43 * Returns the declaring class for the given ResolvedMethodName.
44 * Used by {@code StackFrameInfo}.
45 */
46 Class<?> getDeclaringClass(Object rmname);
47
48 /**
49 * Returns the {@code MethodType} for the given method descriptor
50 * and class loader.
51 * Used by {@code StackFrameInfo}.
52 */
53 MethodType getMethodType(String descriptor, ClassLoader loader);
54
55 /**
56 * Returns true if the given flags has MN_CALLER_SENSITIVE flag set.
57 */
58 boolean isCallerSensitive(int flags);
153 * The invoker class is a hidden class which has the same
154 * defining class loader, runtime package, and protection domain
155 * as the given caller class.
156 */
157 MethodHandle reflectiveInvoker(Class<?> caller);
158
159 /**
160 * A best-effort method that tries to find any exceptions thrown by the given method handle.
161 * @param handle the handle to check
162 * @return an array of exceptions, or {@code null}.
163 */
164 Class<?>[] exceptionTypes(MethodHandle handle);
165
166 /**
167 * Returns a method handle that allocates an instance of the given class
168 * and then invoke the given constructor of one of its superclasses.
169 *
170 * This method should only be used by ReflectionFactory::newConstructorForSerialization.
171 */
172 MethodHandle serializableConstructor(Class<?> decl, Constructor<?> ctorToCall) throws IllegalAccessException;
173 }
|
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
26 package jdk.internal.access;
27
28 import jdk.internal.foreign.abi.NativeEntryPoint;
29
30 import java.lang.classfile.ClassBuilder;
31 import java.lang.foreign.MemoryLayout;
32 import java.lang.invoke.CallSite;
33 import java.lang.invoke.LambdaConversionException;
34 import java.lang.invoke.MethodHandle;
35 import java.lang.invoke.MethodHandles;
36 import java.lang.invoke.MethodType;
37 import java.lang.invoke.VarHandle;
38 import java.lang.reflect.Constructor;
39 import java.lang.reflect.Field;
40 import java.nio.ByteOrder;
41 import java.util.List;
42 import java.util.Map;
43 import java.util.function.Function;
44 import java.util.stream.Stream;
45
46 public interface JavaLangInvokeAccess {
47 /**
48 * Returns the declaring class for the given ResolvedMethodName.
49 * Used by {@code StackFrameInfo}.
50 */
51 Class<?> getDeclaringClass(Object rmname);
52
53 /**
54 * Returns the {@code MethodType} for the given method descriptor
55 * and class loader.
56 * Used by {@code StackFrameInfo}.
57 */
58 MethodType getMethodType(String descriptor, ClassLoader loader);
59
60 /**
61 * Returns true if the given flags has MN_CALLER_SENSITIVE flag set.
62 */
63 boolean isCallerSensitive(int flags);
158 * The invoker class is a hidden class which has the same
159 * defining class loader, runtime package, and protection domain
160 * as the given caller class.
161 */
162 MethodHandle reflectiveInvoker(Class<?> caller);
163
164 /**
165 * A best-effort method that tries to find any exceptions thrown by the given method handle.
166 * @param handle the handle to check
167 * @return an array of exceptions, or {@code null}.
168 */
169 Class<?>[] exceptionTypes(MethodHandle handle);
170
171 /**
172 * Returns a method handle that allocates an instance of the given class
173 * and then invoke the given constructor of one of its superclasses.
174 *
175 * This method should only be used by ReflectionFactory::newConstructorForSerialization.
176 */
177 MethodHandle serializableConstructor(Class<?> decl, Constructor<?> ctorToCall) throws IllegalAccessException;
178
179 CallSite metafactoryInternal(MethodHandles.Lookup caller,
180 String interfaceMethodName,
181 MethodType factoryType,
182 MethodType interfaceMethodType,
183 MethodHandle implementation,
184 MethodType dynamicMethodType,
185 Function<ClassBuilder, Object> finisher) throws LambdaConversionException;
186
187 CallSite altMetafactoryInternal(MethodHandles.Lookup caller,
188 String interfaceMethodName,
189 MethodType factoryType,
190 Function<ClassBuilder, Object> finisher,
191 Object... args) throws LambdaConversionException;
192 }
|