Skip to content

被生成类的成员变量类型存在着递归的继承关系,创建被生成的类会导致栈内存溢出 #11

@SpringStudent

Description

@SpringStudent

比如dubbo api接口签名类似
void stackOverflow(TreeNode treeNode,Zhou zhou);
因为方法签名为复杂参数,为了适应rest的接口规范,dubbo-swagge会将TreeNode类型和Zhou类包装为
AbstractRequestBodyParamsWrapper.java类型

Rbpw$AbstractRequestBodyParamsWrapper.java{
     TreeNode treeNode;
     Zhou zhou;
}

但是由于TreeNode类存在着递归的类型继承关系,将会导致创建Rbpw$AbstractRequestBodyParamsWrapper.java类栈溢出
TreeNode.java源码如下

public class TreeNode<T> implements Node<T> {
	private static final long serialVersionUID = 1L;
	private T id;
	private T parentId;
	private CharSequence name;
	private Comparable<?> weight = 0;
	priate Map<String, Object> extra;
	public TreeNode() {
	}
}
 public interface Node<T> extends Comparable<Node<T>>, Serializable {
        T getId();
        Node<T> setId(T id);
        T getParentId();
        Node<T> setParentId(T parentId);
        CharSequence getName();
        Node<T> setName(CharSequence name);
        Comparable<?> getWeight();
        Node<T> setWeight(Comparable<?> weight);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions