docs: @SuppressWarnings("unchecked")
      public static Object coerceToSAM(Closure argument, Method method, Class clazz, boolean isInterface) {
          if (argument!=null && clazz.isAssignableFrom(argument.getClass())) {
              return argument;
          }
          if (isInterface) {
              if (Traits.isTrait(clazz)) {
                  Map<String,Closure> impl = Collections.singletonMap(
                          method.getName(),
                          argument
                  );
                  return ProxyGenerator.INSTANCE.instantiateAggregate(impl,Collections.singletonList(clazz));
              }
              return Proxy.newProxyInstance(
                      clazz.getClassLoader(),
                      new Class[]{clazz},
                      new ConvertedClosure(argument));
          } else {
              Map<String, Object> m = new HashMap<String,Object>();
              m.put(method.getName(), argument);
              return ProxyGenerator.INSTANCE.
                      instantiateAggregateFromBaseClass(m, clazz);
          }
      }