Beispiel #1
0
 /**
  * Creates a method handle representation of the given method for an explicit special method
  * invocation of an otherwise virtual method.
  *
  * @param methodDescription The method ro represent.
  * @param typeDescription The type on which the method is to be invoked on as a special method
  *     invocation.
  * @return A method handle representing the given method as special method invocation.
  */
 public static MethodHandle ofSpecial(
     MethodDescription methodDescription, TypeDescription typeDescription) {
   if (!methodDescription.isSpecializableFor(typeDescription)) {
     throw new IllegalArgumentException(
         "Cannot specialize " + methodDescription + " for " + typeDescription);
   }
   return new MethodHandle(
       HandleType.ofSpecial(methodDescription),
       typeDescription,
       methodDescription.getInternalName(),
       methodDescription.getReturnType().asRawType(),
       methodDescription.getParameters().asTypeList().asRawTypes());
 }