Skip to content

[아이템 90] 직렬화된 인스턴스 대신 직렬화 프록시 사용을 검토하라 #16

@punsoo

Description

@punsoo

마지막 페이지(p. 482)를 보면

두 번째, 객체 그래프에 순환이 있는 클래스에도 적용할 수 없다. 이런 객체의 메서드를 직렬화 프록시의 readResolve 안에서 호출하려 하면 ClassCastException이 발생할 것이다. 직렬화 프록시만 가졌을 뿐 실제 객체는 아직 만들어진 것이 아니기 때문이다.

객체 그래프 순환 (순환 참조를 말하는 거 같습니다?)이랑 readResolve 메소드를 사용함에 있어 실제 객체의 생성이랑 무슨 관련이 있는 것인가요?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions