89 import java.lang.ref.Reference; |
89 import java.lang.ref.Reference; |
90 import java.lang.ref.WeakReference; |
90 import java.lang.ref.WeakReference; |
91 import java.util.Arrays; |
91 import java.util.Arrays; |
92 import java.util.Collections; |
92 import java.util.Collections; |
93 import java.util.List; |
93 import java.util.List; |
|
94 import java.util.Objects; |
94 import java.util.StringTokenizer; |
95 import java.util.StringTokenizer; |
95 import java.util.WeakHashMap; |
96 import java.util.WeakHashMap; |
96 import jdk.internal.dynalink.CallSiteDescriptor; |
97 import jdk.internal.dynalink.CallSiteDescriptor; |
97 |
98 |
98 /** |
99 /** |
121 * @param methodType the type of the method at the call site. Must not be null. |
122 * @param methodType the type of the method at the call site. Must not be null. |
122 * @return a call site descriptor representing the input. Note that although the method name is "create", it will |
123 * @return a call site descriptor representing the input. Note that although the method name is "create", it will |
123 * in fact return a weakly-referenced canonical instance. |
124 * in fact return a weakly-referenced canonical instance. |
124 */ |
125 */ |
125 public static CallSiteDescriptor create(final Lookup lookup, final String name, final MethodType methodType) { |
126 public static CallSiteDescriptor create(final Lookup lookup, final String name, final MethodType methodType) { |
126 name.getClass(); // NPE check |
127 Objects.requireNonNull(name); |
127 methodType.getClass(); // NPE check |
128 Objects.requireNonNull(methodType); |
128 lookup.getClass(); // NPE check |
129 Objects.requireNonNull(lookup); |
129 final String[] tokenizedName = tokenizeName(name); |
130 final String[] tokenizedName = tokenizeName(name); |
130 if(isPublicLookup(lookup)) { |
131 if(isPublicLookup(lookup)) { |
131 return getCanonicalPublicDescriptor(createPublicCallSiteDescriptor(tokenizedName, methodType)); |
132 return getCanonicalPublicDescriptor(createPublicCallSiteDescriptor(tokenizedName, methodType)); |
132 } |
133 } |
133 return new LookupCallSiteDescriptor(tokenizedName, methodType, lookup); |
134 return new LookupCallSiteDescriptor(tokenizedName, methodType, lookup); |