| In my opinion, the ideal solution would be to disallow using @IndexedEmbedded this way, and introduce a separate annotation (see
HSEARCH-2554 Pull Request Sent and the related PR). But that's a breaking change, and ideally we'd want JDK9 compatibility in 5.8 (it's in the roadmap). So we have to find something else. We could simply exclude java.lang from the types to be introspected, but this hardly seems like an ideal solution: what if someone used programmatic mapping to put an annotation on Integer.doubleValue(), for instance? Or some other java.lang type where it would make more sense? The only two real solutions I can think of are:
- Avoid to call setAccessible unless we actually find out that a member is to be taken into consideration (@Field, @IndexedEmbedded, ...). We can only do this if inspecting annotations doesn't require to call setAccessible first. I think it's the case, but I'll have to try.
- When using introspection, totally ignore properties that cannot be made accessible. I find this solution a bit more error-prone, but if the previous one is impossible, that could do the trick...
|