Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对象存在环形引用时会出现栈溢出 #11

Open
wf-xian opened this issue Aug 7, 2024 · 0 comments
Open

对象存在环形引用时会出现栈溢出 #11

wf-xian opened this issue Aug 7, 2024 · 0 comments

Comments

@wf-xian
Copy link

wf-xian commented Aug 7, 2024

对象存在环形引用时会出现栈溢出,示例代码如下:

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;  
@Getter
@Setter
@ToString
public class EntityFirst {
	private EntitySecond second;
}
import lombok.Getter;
import lombok.Setter;
import lombok.ToString; 
@Getter
@Setter
@ToString
public class EntityFirst {
    private EntitySecond second;
}
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class EntityLoop {
    private EntityLoop loop;
}
public class FakerObjectTest {
    public static void main(String[] args) {
        User user = DataUtil.build(User.class);
        System.out.println(user.toString());
        EntityFirst first = DataUtil.build(EntityFirst.class);
        System.out.println(first.toString());
        EntityLoop loop = DataUtil.build(EntityLoop.class);
        System.out.println(loop.toString());
    }
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant