-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HHH-18693 Hibernate Processor does not handle inner types #9098
base: main
Are you sure you want to change the base?
HHH-18693 Hibernate Processor does not handle inner types #9098
Conversation
Some existing test classes were changed to make inner classes non-private. Otherwise such class could not be referenced from meta model class. |
Thanks for working on this @cigaly ! |
965c5f0
to
c20fa62
Compare
I think the Processor is still going to have to be able to elegantly handle So I'm not quit sure what "elegantly" means here ... perhaps it just means "skip them". |
c20fa62
to
a8fb6dd
Compare
Other than disallowing private classes (either inner or top-level) , excluding them from metamodel generation is only solution that will not cause Java compilation errors. And, of course, there is always possibility that private static class could be referenced by either top level class containing private class or other inner class contained by same top level class. Now only one test class has to be changed to avoid compilation errors is
will result in
which is definitely something Java is happy with. Perhaps some mechanism can be added to prevent such duplications, but until then this class should be slightly changed to let tests to run. |
Hurm.... so that's actually a hole in the algorithm defined by the spec, isn't it? We should fix that, in both Processor, and in the spec. For example, we could say that |
This is more like one of those "tricky" questions for entertainment pages of some Java magazine. Something like "how are named getters and setters in a class with int property named abc and String property named Abc". It seems that in current code only problematic are properties with name consisting of single uppercase letter. To fix that (at least, until some other solution) I will change method
(or, maybe, to use underscore as a suffix?) If nothing else, this will allow implement metamodel class generation for inner classes, without touching any core (main or test) code. |
a8fb6dd
to
83e4d1e
Compare
Yeah but you can just use |
Yes, you are right. It seems that I am still sleepy :-) |
….hibernate.processor.util.StringUtil#getUpperUnderscoreCaseFromLowerCamelCase
83e4d1e
to
3d9520b
Compare
…odelClassName(java.lang.String) to handle metamodel classes generated from inner class
See Jira Issue HHH-18693
This is still work in progress, not to be merged with main branch, at least not immediately.
For each (static) inner non-private class one meta-model class will be generated.
Naming is as follows. If we have:
Generated class will be named
A_B_
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.