Object-oriented languages provide little support for encapsulating
objects. Reference semantics allows objects to escape their defining scope,
and the pervasive aliasing that ensues remains a major source of software
defects. This paper presents Kacheck/J a tool for inferring object
encapsulation properties of large Java programs. Our goal is to develop
practical tools to assist software engineers, thus we focus on simple and
scalable techniques. Kacheck/J is able to infer confinement -- the
property that all instances of a given type are encapsulated in their
defining package. This simple property can be used to identify accidental
leaks of sensitive objects, as well as for compiler optimizations. We report
on the analysis of a large body of code and discuss language support
and refactoring for confinement.