On Mon, 19 Dec 2022 14:29:09 GMT, Alexey Ivanov <[email protected]> wrote:
>> Means the other constructor is called in two places only and in those places >> null checks are done. So, even if we add assertion inside constructor, it >> will unreachable. > >> Means the other constructor is called in two places only and in those places >> null checks are done. So, even if we add assertion inside constructor, it >> will unreachable. > > It won't be unreachable, _it will prevent such a situation from happening > again_. The code which calls the other constructor could be changed. > > I still think it's reasonable to add the assertion. It's a no-op if > assertions aren't enabled (the default), and it'll catch the broken invariant > in testing since tests are (usually) run with assertions enabled. Yeah, got your point. It's better to add as a preventive measure. ------------- PR: https://git.openjdk.org/jdk/pull/11104
