Java Code Examples for jdk.internal.dynalink.beans.GuardedInvocationComponent.ValidationType#IS_ARRAY

The following examples show how to use jdk.internal.dynalink.beans.GuardedInvocationComponent.ValidationType#IS_ARRAY . 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: BeanLinker.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
    assertParameterCount(callSiteDescriptor, 1);
    final MethodType callSiteType = callSiteDescriptor.getMethodType();
    final Class<?> declaredType = callSiteType.parameterType(0);
    // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
    // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
    // they're dealing with an array, collection, or map, but hey...
    if(declaredType.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
    } else if(Collection.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
    } else if(Map.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
    }

    // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
    if(clazz.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
                callSiteType), ValidationType.IS_ARRAY);
    } if(Collection.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
                COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
    } if(Map.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
                callSiteType), Map.class, ValidationType.INSTANCE_OF);
    }
    // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
    return null;
}
 
Example 2
Source File: BeanLinker.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
    assertParameterCount(callSiteDescriptor, 1);
    final MethodType callSiteType = callSiteDescriptor.getMethodType();
    final Class<?> declaredType = callSiteType.parameterType(0);
    // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
    // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
    // they're dealing with an array, collection, or map, but hey...
    if(declaredType.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
    } else if(Collection.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
    } else if(Map.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
    }

    // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
    if(clazz.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
                callSiteType), ValidationType.IS_ARRAY);
    } if(Collection.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
                COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
    } if(Map.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
                callSiteType), Map.class, ValidationType.INSTANCE_OF);
    }
    // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
    return null;
}
 
Example 3
Source File: BeanLinker.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
    assertParameterCount(callSiteDescriptor, 1);
    final MethodType callSiteType = callSiteDescriptor.getMethodType();
    final Class<?> declaredType = callSiteType.parameterType(0);
    // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
    // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
    // they're dealing with an array, collection, or map, but hey...
    if(declaredType.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
    } else if(Collection.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
    } else if(Map.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
    }

    // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
    if(clazz.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
                callSiteType), ValidationType.IS_ARRAY);
    } if(Collection.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
                COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
    } if(Map.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
                callSiteType), Map.class, ValidationType.INSTANCE_OF);
    }
    // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
    return null;
}
 
Example 4
Source File: BeanLinker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
    assertParameterCount(callSiteDescriptor, 1);
    final MethodType callSiteType = callSiteDescriptor.getMethodType();
    final Class<?> declaredType = callSiteType.parameterType(0);
    // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
    // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
    // they're dealing with an array, collection, or map, but hey...
    if(declaredType.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
    } else if(Collection.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
    } else if(Map.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
    }

    // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
    if(clazz.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
                callSiteType), ValidationType.IS_ARRAY);
    } if(Collection.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
                COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
    } if(Map.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
                callSiteType), Map.class, ValidationType.INSTANCE_OF);
    }
    // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
    return null;
}
 
Example 5
Source File: BeanLinker.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
    assertParameterCount(callSiteDescriptor, 1);
    final MethodType callSiteType = callSiteDescriptor.getMethodType();
    final Class<?> declaredType = callSiteType.parameterType(0);
    // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
    // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
    // they're dealing with an array, collection, or map, but hey...
    if(declaredType.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
    } else if(Collection.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
    } else if(Map.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
    }

    // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
    if(clazz.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
                callSiteType), ValidationType.IS_ARRAY);
    } if(Collection.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
                COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
    } if(Map.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
                callSiteType), Map.class, ValidationType.INSTANCE_OF);
    }
    // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
    return null;
}
 
Example 6
Source File: BeanLinker.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private GuardedInvocationComponent getLengthGetter(CallSiteDescriptor callSiteDescriptor) {
    assertParameterCount(callSiteDescriptor, 1);
    final MethodType callSiteType = callSiteDescriptor.getMethodType();
    final Class<?> declaredType = callSiteType.parameterType(0);
    // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
    // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
    // they're dealing with an array, collection, or map, but hey...
    if(declaredType.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
    } else if(Collection.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
    } else if(Map.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
    }

    // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
    if(clazz.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
                callSiteType), ValidationType.IS_ARRAY);
    } if(Collection.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
                COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
    } if(Map.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
                callSiteType), Map.class, ValidationType.INSTANCE_OF);
    }
    // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
    return null;
}
 
Example 7
Source File: BeanLinker.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private GuardedInvocationComponent getLengthGetter(CallSiteDescriptor callSiteDescriptor) {
    assertParameterCount(callSiteDescriptor, 1);
    final MethodType callSiteType = callSiteDescriptor.getMethodType();
    final Class<?> declaredType = callSiteType.parameterType(0);
    // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
    // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
    // they're dealing with an array, collection, or map, but hey...
    if(declaredType.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
    } else if(Collection.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
    } else if(Map.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
    }

    // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
    if(clazz.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
                callSiteType), ValidationType.IS_ARRAY);
    } if(Collection.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
                COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
    } if(Map.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
                callSiteType), Map.class, ValidationType.INSTANCE_OF);
    }
    // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
    return null;
}
 
Example 8
Source File: BeanLinker.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
    assertParameterCount(callSiteDescriptor, 1);
    final MethodType callSiteType = callSiteDescriptor.getMethodType();
    final Class<?> declaredType = callSiteType.parameterType(0);
    // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
    // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
    // they're dealing with an array, collection, or map, but hey...
    if(declaredType.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
    } else if(Collection.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
    } else if(Map.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
    }

    // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
    if(clazz.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
                callSiteType), ValidationType.IS_ARRAY);
    } if(Collection.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
                COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
    } if(Map.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
                callSiteType), Map.class, ValidationType.INSTANCE_OF);
    }
    // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
    return null;
}
 
Example 9
Source File: BeanLinker.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private GuardedInvocationComponent getLengthGetter(CallSiteDescriptor callSiteDescriptor) {
    assertParameterCount(callSiteDescriptor, 1);
    final MethodType callSiteType = callSiteDescriptor.getMethodType();
    final Class<?> declaredType = callSiteType.parameterType(0);
    // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
    // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
    // they're dealing with an array, collection, or map, but hey...
    if(declaredType.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
    } else if(Collection.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
    } else if(Map.class.isAssignableFrom(declaredType)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
    }

    // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
    if(clazz.isArray()) {
        return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
                callSiteType), ValidationType.IS_ARRAY);
    } if(Collection.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
                COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
    } if(Map.class.isAssignableFrom(clazz)) {
        return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
                callSiteType), Map.class, ValidationType.INSTANCE_OF);
    }
    // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
    return null;
}