Closed th3n3rd closed 8 months ago
It will incorrectly implement MutablePersistable, lacking the implementation for the jMoleculesmarkNotNew method
Can you elaborate on that? I don't see how you come to that, as the code you show below checks for the presence of the method, and, if not present, generates it.
it will have an additional default constructor despite the final fields that need initialisation, in the original code
That's correct but mandated by JPA. None of the code generated here will be callable from user code, though.
Can you elaborate on that? I don't see how you come to that, as the code you show below checks for the presence of the method, and, if not present, generates it.
The code that I pasted in there is a possible fix, the current version doesn't look like that.
The latest version available here generates the method conditionally on whether callbackInterface has been provided or not. In cases where the callbackInterface is not provided the method is not getting generated, hence the interface not implemented properly.
The current implementation of
PersistableImplementor
generates byte-code that a typical compiler probably would not.Let's take one of the sample classes part of the test suite:
The above will generate byte-code with the following problems:
__jMolecules__markNotNew
methodSuggestions:
The first problem might be fixable by always generating the missing implementation, instead of being conditional to a given callbackInterface.
e.g.
Not sure how to fix (2) though.