> On May 7, 2021, at 4:38 PM, Brian Goetz <brian.go...@oracle.com> wrote:
> 
> I think the question is: "cleaner for whom."  The parenthetical remarks 
> "except for Object" are mostly our mess to corral; "new Object()" working, 
> even when Object is seen to be abstract, will be extremely confusing for new 
> developers learning what abstract means.  It's not just that reflection would 
> expose this, but the source code and Javadoc would to.  User mental models 
> are a stakeholder in Object too.

It's a cleaner mental model for developers, too. For example, "primitive 
classes may only extend abstract classes" is a simple rule to remember. So is 
"concrete classes always extend IdentityObject or PrimitiveObject".

I would strongly discourage new developers from saying "new Object()", and I 
think javac/IDEs should warn about it. It's allowed purely for compatibility. 
If developers insist on using it, then whether we've decreed that Object is 
abstract or not, they're going to need to learn that "new Object()" is a 
special case that doesn't behave the way they expect "new Foo()" to behave.

Reply via email to