On Thu, 12 Jan 2023 10:32:19 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

> If we have a class with a private constructor and public static factory 
> invoking said constructor, and the constructor makes this escape, isn't that 
> an issue we should detect?

A static factory method will not create a subclassed instance, so there's no 
'this' escape problem.

But I admit I completely missed factory methods as a potential thing to worry 
about.

Is it possible for a leak to be missed due to the use of a factory method?

Hmm. I can't immediately think of how, but if you can come up with an example 
please share.

-------------

PR: https://git.openjdk.org/jdk/pull/11874

Reply via email to