Java Code Examples for java.lang.invoke.MethodType#getClass()

The following examples show how to use java.lang.invoke.MethodType#getClass() . 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: CallSiteDescriptorFactory.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new call site descriptor instance. The actual underlying class of the instance is dependent on the
 * passed arguments to be space efficient; i.e. if you  only use the public lookup, you'll get back an
 * implementation that doesn't waste space on storing the lookup object.
 * @param lookup the lookup that determines access rights at the call site. If your language runtime doesn't have
 * equivalents of Java access concepts, just use {@link MethodHandles#publicLookup()}. Must not be null.
 * @param name the name of the method at the call site. Must not be null.
 * @param methodType the type of the method at the call site. Must not be null.
 * @return a call site descriptor representing the input. Note that although the method name is "create", it will
 * in fact return a weakly-referenced canonical instance.
 */
public static CallSiteDescriptor create(Lookup lookup, String name, MethodType methodType) {
    name.getClass(); // NPE check
    methodType.getClass(); // NPE check
    lookup.getClass(); // NPE check
    final String[] tokenizedName = tokenizeName(name);
    if(isPublicLookup(lookup)) {
        return getCanonicalPublicDescriptor(createPublicCallSiteDescriptor(tokenizedName, methodType));
    }
    return new LookupCallSiteDescriptor(tokenizedName, methodType, lookup);
}
 
Example 2
Source File: CallSiteDescriptorFactory.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new call site descriptor instance. The actual underlying class of the instance is dependent on the
 * passed arguments to be space efficient; i.e. if you  only use the public lookup, you'll get back an
 * implementation that doesn't waste space on storing the lookup object.
 * @param lookup the lookup that determines access rights at the call site. If your language runtime doesn't have
 * equivalents of Java access concepts, just use {@link MethodHandles#publicLookup()}. Must not be null.
 * @param name the name of the method at the call site. Must not be null.
 * @param methodType the type of the method at the call site. Must not be null.
 * @return a call site descriptor representing the input. Note that although the method name is "create", it will
 * in fact return a weakly-referenced canonical instance.
 */
public static CallSiteDescriptor create(Lookup lookup, String name, MethodType methodType) {
    name.getClass(); // NPE check
    methodType.getClass(); // NPE check
    lookup.getClass(); // NPE check
    final String[] tokenizedName = tokenizeName(name);
    if(isPublicLookup(lookup)) {
        return getCanonicalPublicDescriptor(createPublicCallSiteDescriptor(tokenizedName, methodType));
    }
    return new LookupCallSiteDescriptor(tokenizedName, methodType, lookup);
}
 
Example 3
Source File: CallSiteDescriptorFactory.java    From nashorn with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates a new call site descriptor instance. The actual underlying class of the instance is dependent on the
 * passed arguments to be space efficient; i.e. if you  only use the public lookup, you'll get back an
 * implementation that doesn't waste space on storing the lookup object.
 * @param lookup the lookup that determines access rights at the call site. If your language runtime doesn't have
 * equivalents of Java access concepts, just use {@link MethodHandles#publicLookup()}. Must not be null.
 * @param name the name of the method at the call site. Must not be null.
 * @param methodType the type of the method at the call site. Must not be null.
 * @return a call site descriptor representing the input. Note that although the method name is "create", it will
 * in fact return a weakly-referenced canonical instance.
 */
public static CallSiteDescriptor create(Lookup lookup, String name, MethodType methodType) {
    name.getClass(); // NPE check
    methodType.getClass(); // NPE check
    lookup.getClass(); // NPE check
    final String[] tokenizedName = tokenizeName(name);
    if(isPublicLookup(lookup)) {
        return getCanonicalPublicDescriptor(createPublicCallSiteDescriptor(tokenizedName, methodType));
    }
    return new LookupCallSiteDescriptor(tokenizedName, methodType, lookup);
}