Java Code Examples for jdk.internal.dynalink.support.TypeUtilities#isSubtype()

The following examples show how to use jdk.internal.dynalink.support.TypeUtilities#isSubtype() . 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: ApplicableOverloadedMethods.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isApplicable(final MethodType callSiteType, final SingleDynamicMethod method) {
    final MethodType methodType = method.getMethodType();
    final int methodArity = methodType.parameterCount();
    if(methodArity != callSiteType.parameterCount()) {
        return false;
    }
    // 0th arg is receiver; it doesn't matter for overload
    // resolution.
    for(int i = 1; i < methodArity; ++i) {
        if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
            return false;
        }
    }
    return true;
}
 
Example 2
Source File: ApplicableOverloadedMethods.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isApplicable(MethodType callSiteType, SingleDynamicMethod method) {
    final MethodType methodType = method.getMethodType();
    final int methodArity = methodType.parameterCount();
    if(methodArity != callSiteType.parameterCount()) {
        return false;
    }
    // 0th arg is receiver; it doesn't matter for overload
    // resolution.
    for(int i = 1; i < methodArity; ++i) {
        if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
            return false;
        }
    }
    return true;
}
 
Example 3
Source File: ApplicableOverloadedMethods.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isApplicable(final MethodType callSiteType, final SingleDynamicMethod method) {
    final MethodType methodType = method.getMethodType();
    final int methodArity = methodType.parameterCount();
    if(methodArity != callSiteType.parameterCount()) {
        return false;
    }
    // 0th arg is receiver; it doesn't matter for overload
    // resolution.
    for(int i = 1; i < methodArity; ++i) {
        if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
            return false;
        }
    }
    return true;
}
 
Example 4
Source File: ApplicableOverloadedMethods.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isApplicable(final MethodType callSiteType, final SingleDynamicMethod method) {
    final MethodType methodType = method.getMethodType();
    final int methodArity = methodType.parameterCount();
    if(methodArity != callSiteType.parameterCount()) {
        return false;
    }
    // 0th arg is receiver; it doesn't matter for overload
    // resolution.
    for(int i = 1; i < methodArity; ++i) {
        if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
            return false;
        }
    }
    return true;
}
 
Example 5
Source File: ApplicableOverloadedMethods.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isApplicable(final MethodType callSiteType, final SingleDynamicMethod method) {
    final MethodType methodType = method.getMethodType();
    final int methodArity = methodType.parameterCount();
    if(methodArity != callSiteType.parameterCount()) {
        return false;
    }
    // 0th arg is receiver; it doesn't matter for overload
    // resolution.
    for(int i = 1; i < methodArity; ++i) {
        if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
            return false;
        }
    }
    return true;
}
 
Example 6
Source File: ApplicableOverloadedMethods.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isApplicable(final MethodType callSiteType, final SingleDynamicMethod method) {
    final MethodType methodType = method.getMethodType();
    final int methodArity = methodType.parameterCount();
    if(methodArity != callSiteType.parameterCount()) {
        return false;
    }
    // 0th arg is receiver; it doesn't matter for overload
    // resolution.
    for(int i = 1; i < methodArity; ++i) {
        if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
            return false;
        }
    }
    return true;
}
 
Example 7
Source File: ApplicableOverloadedMethods.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isApplicable(final MethodType callSiteType, final SingleDynamicMethod method) {
    final MethodType methodType = method.getMethodType();
    final int methodArity = methodType.parameterCount();
    if(methodArity != callSiteType.parameterCount()) {
        return false;
    }
    // 0th arg is receiver; it doesn't matter for overload
    // resolution.
    for(int i = 1; i < methodArity; ++i) {
        if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
            return false;
        }
    }
    return true;
}
 
Example 8
Source File: ApplicableOverloadedMethods.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isApplicable(MethodType callSiteType, SingleDynamicMethod method) {
    final MethodType methodType = method.getMethodType();
    final int methodArity = methodType.parameterCount();
    if(methodArity != callSiteType.parameterCount()) {
        return false;
    }
    // 0th arg is receiver; it doesn't matter for overload
    // resolution.
    for(int i = 1; i < methodArity; ++i) {
        if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
            return false;
        }
    }
    return true;
}
 
Example 9
Source File: ApplicableOverloadedMethods.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isApplicable(MethodType callSiteType, SingleDynamicMethod method) {
    final MethodType methodType = method.getMethodType();
    final int methodArity = methodType.parameterCount();
    if(methodArity != callSiteType.parameterCount()) {
        return false;
    }
    // 0th arg is receiver; it doesn't matter for overload
    // resolution.
    for(int i = 1; i < methodArity; ++i) {
        if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
            return false;
        }
    }
    return true;
}
 
Example 10
Source File: MaximallySpecific.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static Comparison compare(final Class<?> c1, final Class<?> c2, final Class<?>[] argTypes, final int i, final LinkerServices cmp) {
    if(cmp != null) {
        final Comparison c = cmp.compareConversion(argTypes[i], c1, c2);
        if(c != Comparison.INDETERMINATE) {
            return c;
        }
    }
    if(TypeUtilities.isSubtype(c1, c2)) {
        return Comparison.TYPE_1_BETTER;
    } if(TypeUtilities.isSubtype(c2, c1)) {
        return Comparison.TYPE_2_BETTER;
    }
    return Comparison.INDETERMINATE;
}
 
Example 11
Source File: MaximallySpecific.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static Comparison compare(Class<?> c1, Class<?> c2, Class<?>[] argTypes, int i, LinkerServices cmp) {
    if(cmp != null) {
        final Comparison c = cmp.compareConversion(argTypes[i], c1, c2);
        if(c != Comparison.INDETERMINATE) {
            return c;
        }
    }
    if(TypeUtilities.isSubtype(c1, c2)) {
        return Comparison.TYPE_1_BETTER;
    } if(TypeUtilities.isSubtype(c2, c1)) {
        return Comparison.TYPE_2_BETTER;
    }
    return Comparison.INDETERMINATE;
}
 
Example 12
Source File: MaximallySpecific.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static Comparison compare(final Class<?> c1, final Class<?> c2, final Class<?>[] argTypes, final int i, final LinkerServices cmp) {
    if(cmp != null) {
        final Comparison c = cmp.compareConversion(argTypes[i], c1, c2);
        if(c != Comparison.INDETERMINATE) {
            return c;
        }
    }
    if(TypeUtilities.isSubtype(c1, c2)) {
        return Comparison.TYPE_1_BETTER;
    } if(TypeUtilities.isSubtype(c2, c1)) {
        return Comparison.TYPE_2_BETTER;
    }
    return Comparison.INDETERMINATE;
}
 
Example 13
Source File: MaximallySpecific.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Comparison compare(Class<?> c1, Class<?> c2, Class<?>[] argTypes, int i, LinkerServices cmp) {
    if(cmp != null) {
        final Comparison c = cmp.compareConversion(argTypes[i], c1, c2);
        if(c != Comparison.INDETERMINATE) {
            return c;
        }
    }
    if(TypeUtilities.isSubtype(c1, c2)) {
        return Comparison.TYPE_1_BETTER;
    } if(TypeUtilities.isSubtype(c2, c1)) {
        return Comparison.TYPE_2_BETTER;
    }
    return Comparison.INDETERMINATE;
}
 
Example 14
Source File: MaximallySpecific.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static Comparison compare(Class<?> c1, Class<?> c2, Class<?>[] argTypes, int i, LinkerServices cmp) {
    if(cmp != null) {
        final Comparison c = cmp.compareConversion(argTypes[i], c1, c2);
        if(c != Comparison.INDETERMINATE) {
            return c;
        }
    }
    if(TypeUtilities.isSubtype(c1, c2)) {
        return Comparison.TYPE_1_BETTER;
    } if(TypeUtilities.isSubtype(c2, c1)) {
        return Comparison.TYPE_2_BETTER;
    }
    return Comparison.INDETERMINATE;
}
 
Example 15
Source File: MaximallySpecific.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static Comparison compare(final Class<?> c1, final Class<?> c2, final Class<?>[] argTypes, final int i, final LinkerServices cmp) {
    if(cmp != null) {
        final Comparison c = cmp.compareConversion(argTypes[i], c1, c2);
        if(c != Comparison.INDETERMINATE) {
            return c;
        }
    }
    if(TypeUtilities.isSubtype(c1, c2)) {
        return Comparison.TYPE_1_BETTER;
    } if(TypeUtilities.isSubtype(c2, c1)) {
        return Comparison.TYPE_2_BETTER;
    }
    return Comparison.INDETERMINATE;
}
 
Example 16
Source File: MaximallySpecific.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static Comparison compare(final Class<?> c1, final Class<?> c2, final Class<?>[] argTypes, final int i, final LinkerServices cmp) {
    if(cmp != null) {
        final Comparison c = cmp.compareConversion(argTypes[i], c1, c2);
        if(c != Comparison.INDETERMINATE) {
            return c;
        }
    }
    if(TypeUtilities.isSubtype(c1, c2)) {
        return Comparison.TYPE_1_BETTER;
    } if(TypeUtilities.isSubtype(c2, c1)) {
        return Comparison.TYPE_2_BETTER;
    }
    return Comparison.INDETERMINATE;
}
 
Example 17
Source File: MaximallySpecific.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static Comparison compare(final Class<?> c1, final Class<?> c2, final Class<?>[] argTypes, final int i, final LinkerServices cmp) {
    if(cmp != null) {
        final Comparison c = cmp.compareConversion(argTypes[i], c1, c2);
        if(c != Comparison.INDETERMINATE) {
            return c;
        }
    }
    if(TypeUtilities.isSubtype(c1, c2)) {
        return Comparison.TYPE_1_BETTER;
    } if(TypeUtilities.isSubtype(c2, c1)) {
        return Comparison.TYPE_2_BETTER;
    }
    return Comparison.INDETERMINATE;
}
 
Example 18
Source File: MaximallySpecific.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Comparison compare(final Class<?> c1, final Class<?> c2, final Class<?>[] argTypes, final int i, final LinkerServices cmp) {
    if(cmp != null) {
        final Comparison c = cmp.compareConversion(argTypes[i], c1, c2);
        if(c != Comparison.INDETERMINATE) {
            return c;
        }
    }
    if(TypeUtilities.isSubtype(c1, c2)) {
        return Comparison.TYPE_1_BETTER;
    } if(TypeUtilities.isSubtype(c2, c1)) {
        return Comparison.TYPE_2_BETTER;
    }
    return Comparison.INDETERMINATE;
}