Classes final by default

This post in russian is about many world frameworks and technologies, based on JavaBeans spec. The most recent requirements are default constructor, class should be not final and has no final get/set methods bacause of instrumentation to be still available, i.e. inheritance (for correct instanceof) and overriding (for inject framework logic). We use in our project similar based on javassist library technique for class extending in runtime and PropertyChangeSupport injecting (we inherit classes and override setters with super.setXXX calls, but after super call we add throwing change event code). I want NOT specify open, because its a workaround of kotlin restctions, as using agent too. Kotlin’s position is “Better than in Java”, but with primitive task of standard JavaBean generation we have an problem!!! For me, more easy to create regular java class with private members and click “Generate setters and Setters” or include Lombok in project and specify get and set generation annotations without any kotlin`s or other restrictions. For now we are not using kotlin, because our environment instruments is based on POJO and JavaBeans contract, kotlin not privides it “Out of the box”, data classes hard final, for regular class we need to submit “open class” workaround.

1 Like