Abstract class with fields implementing ValueObject

Frederic Parain frederic.parain at oracle.com
Wed Feb 9 21:50:01 UTC 2022


There's a weird case that seems to be allowed by the Value Objects JVMS 
draft:

An abstract class can declare non-static fields, which means it won't
have the ACC_PERMITS_VALUE flag set, but also declare that it implements
the ValueObject interface.

The combination looks just wrong, because no class can subclass such class:
   - identity classes are not allowed because of the presence  of
     the ValueObject interface
   - value classes are not allowed because of the absence of
     ACC_PERMITS_VALUE

I've looked for a rule that would prohibit such combination in the
JVMS draft but couldn't find one.

Did I miss something?

Fred


More information about the valhalla-spec-experts mailing list