code: protected ClassNode storeInferredReturnType(final ASTNode node, final ClassNode type) {
          if (!(node instanceof ClosureExpression)) {
              throw new IllegalArgumentException("Storing inferred return type is only allowed on closures but found " + node.getClass());
          }
          return (ClassNode) node.putNodeMetaData(StaticTypesMarker.INFERRED_RETURN_TYPE, type);
      }
docs: Stores the inferred return type of a closure or a method. We are using a separate key to store
  inferred return type because the inferred type of a closure is {@link Closure}, which is different
  from the inferred type of the code of the closure.
  
  @param node a {@link ClosureExpression} or a {@link MethodNode}
  @param type the inferred return type of the code
  @return the old value of the inferred type