Java Code Examples for jdk.internal.dynalink.linker.GuardedInvocation#asType()
The following examples show how to use
jdk.internal.dynalink.linker.GuardedInvocation#asType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NashornLinker.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public GuardedTypeConversion convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); if(gi != null) { return new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true); } gi = getSamTypeConverter(sourceType, targetType); if(gi != null) { return new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), false); } return null; }
Example 2
Source File: NashornLinker.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public GuardedTypeConversion convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); if(gi != null) { return new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true); } gi = getSamTypeConverter(sourceType, targetType); if(gi != null) { return new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), false); } return null; }
Example 3
Source File: NashornLinker.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@Override public GuardedTypeConversion convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); if(gi != null) { return new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true); } gi = getSamTypeConverter(sourceType, targetType); if(gi != null) { return new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), false); } return null; }
Example 4
Source File: NashornBottomLinker.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public GuardedTypeConversion convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); return gi == null ? null : new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true); }
Example 5
Source File: NashornBottomLinker.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public GuardedTypeConversion convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); return gi == null ? null : new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true); }
Example 6
Source File: NashornLinker.java From nashorn with GNU General Public License v2.0 | 4 votes |
@Override public GuardedInvocation convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); return gi == null ? null : gi.asType(MH.type(targetType, sourceType)); }
Example 7
Source File: DefaultPrelinkFilter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public GuardedInvocation filter(final GuardedInvocation inv, final LinkRequest request, final LinkerServices linkerServices) { return inv.asType(linkerServices, request.getCallSiteDescriptor().getMethodType()); }
Example 8
Source File: WithObject.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static GuardedInvocation fixReceiverType(final GuardedInvocation link, final MethodHandle filter) { // The receiver may be an Object or a ScriptObject. final MethodType invType = link.getInvocation().type(); final MethodType newInvType = invType.changeParameterType(0, filter.type().returnType()); return link.asType(newInvType); }
Example 9
Source File: NashornBottomLinker.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public GuardedTypeConversion convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); return gi == null ? null : new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true); }
Example 10
Source File: WithObject.java From nashorn with GNU General Public License v2.0 | 4 votes |
private static GuardedInvocation fixReceiverType(final GuardedInvocation link, final MethodHandle filter) { // The receiver may be an Object or a ScriptObject. final MethodType invType = link.getInvocation().type(); final MethodType newInvType = invType.changeParameterType(0, filter.type().returnType()); return link.asType(newInvType); }
Example 11
Source File: DefaultPrelinkFilter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public GuardedInvocation filter(final GuardedInvocation inv, final LinkRequest request, final LinkerServices linkerServices) { return inv.asType(linkerServices, request.getCallSiteDescriptor().getMethodType()); }
Example 12
Source File: WithObject.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static GuardedInvocation fixReceiverType(final GuardedInvocation link, final MethodHandle filter) { // The receiver may be an Object or a ScriptObject. final MethodType invType = link.getInvocation().type(); final MethodType newInvType = invType.changeParameterType(0, filter.type().returnType()); return link.asType(newInvType); }
Example 13
Source File: NashornBottomLinker.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public GuardedTypeConversion convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); return gi == null ? null : new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true); }
Example 14
Source File: NashornBottomLinker.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public GuardedTypeConversion convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); return gi == null ? null : new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true); }
Example 15
Source File: WithObject.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
private static GuardedInvocation fixReceiverType(final GuardedInvocation link, final MethodHandle filter) { // The receiver may be an Object or a ScriptObject. final MethodType invType = link.getInvocation().type(); final MethodType newInvType = invType.changeParameterType(0, filter.type().returnType()); return link.asType(newInvType); }
Example 16
Source File: NashornBottomLinker.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
@Override public GuardedTypeConversion convertToType(final Class<?> sourceType, final Class<?> targetType) throws Exception { final GuardedInvocation gi = convertToTypeNoCast(sourceType, targetType); return gi == null ? null : new GuardedTypeConversion(gi.asType(MH.type(targetType, sourceType)), true); }
Example 17
Source File: WithObject.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static GuardedInvocation fixReceiverType(final GuardedInvocation link, final MethodHandle filter) { // The receiver may be an Object or a ScriptObject. final MethodType invType = link.getInvocation().type(); final MethodType newInvType = invType.changeParameterType(0, filter.type().returnType()); return link.asType(newInvType); }
Example 18
Source File: Bootstrap.java From nashorn with GNU General Public License v2.0 | 2 votes |
/** * Takes a guarded invocation, and ensures its method and guard conform to the type of the call descriptor, using * all type conversions allowed by the linker's services. This method is used by Nashorn's linkers as a last step * before returning guarded invocations to the callers. Most of the code used to produce the guarded invocations * does not make an effort to coordinate types of the methods, and so a final type adjustment before a guarded * invocation is returned is the responsibility of the linkers themselves. * @param inv the guarded invocation that needs to be type-converted. Can be null. * @param linkerServices the linker services object providing the type conversions. * @param desc the call site descriptor to whose method type the invocation needs to conform. * @return the type-converted guarded invocation. If input is null, null is returned. If the input invocation * already conforms to the requested type, it is returned unchanged. */ static GuardedInvocation asType(final GuardedInvocation inv, final LinkerServices linkerServices, final CallSiteDescriptor desc) { return inv == null ? null : inv.asType(linkerServices, desc.getMethodType()); }
Example 19
Source File: Bootstrap.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Takes a guarded invocation, and ensures its method and guard conform to the type of the call descriptor, using * all type conversions allowed by the linker's services. This method is used by Nashorn's linkers as a last step * before returning guarded invocations to the callers. Most of the code used to produce the guarded invocations * does not make an effort to coordinate types of the methods, and so a final type adjustment before a guarded * invocation is returned is the responsibility of the linkers themselves. * @param inv the guarded invocation that needs to be type-converted. Can be null. * @param linkerServices the linker services object providing the type conversions. * @param desc the call site descriptor to whose method type the invocation needs to conform. * @return the type-converted guarded invocation. If input is null, null is returned. If the input invocation * already conforms to the requested type, it is returned unchanged. */ static GuardedInvocation asType(final GuardedInvocation inv, final LinkerServices linkerServices, final CallSiteDescriptor desc) { return inv == null ? null : inv.asType(linkerServices, desc.getMethodType()); }
Example 20
Source File: Bootstrap.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * Takes a guarded invocation, and ensures its method and guard conform to the type of the call descriptor, using * all type conversions allowed by the linker's services. This method is used by Nashorn's linkers as a last step * before returning guarded invocations to the callers. Most of the code used to produce the guarded invocations * does not make an effort to coordinate types of the methods, and so a final type adjustment before a guarded * invocation is returned is the responsibility of the linkers themselves. * @param inv the guarded invocation that needs to be type-converted. Can be null. * @param linkerServices the linker services object providing the type conversions. * @param desc the call site descriptor to whose method type the invocation needs to conform. * @return the type-converted guarded invocation. If input is null, null is returned. If the input invocation * already conforms to the requested type, it is returned unchanged. */ static GuardedInvocation asType(final GuardedInvocation inv, final LinkerServices linkerServices, final CallSiteDescriptor desc) { return inv == null ? null : inv.asType(linkerServices, desc.getMethodType()); }