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
Generated PropertyAccessor fails lookup of setter accepting a primitive type [DATACMNS-916] #1371
Comments
Oliver Drotbohm commented Although the class' structure is rather unconventional, I wonder why we're actually trying to look up the setter in the first place as we should use field access by default, shouldn't we? |
Artem Bilan commented Guys, don't mix please. The code for IO Brussels is here: https://github.com/spring-projects/spring-integration/blob/4.3.x/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java#L851. We are talking about Spring Integration 4.3.x and Spring Data Ingalls support. public void set_Sequence(int sequence) Since that is a When I remove Another thought, looking at the StackTrace one more time:
Really, there is no such a method because it is like: public void setSequence(int sequence) {
this.sequence = sequence;
} If I change it to accept WDYT? |
Mark Paluch commented I will investigate the issue to find the cause. Thanks for clarifying the, I was on the wrong branch |
Oliver Drotbohm commented Artem Bilan — Can you elaborate on the weird property names and especially the non-JavaBeans convention following Mark Paluch — Two things: shouldn't we ignore |
Mark Paluch commented Non-accessible types are accessed using |
Oliver Drotbohm commented That's merged into master. Ingalls snapshots should be available in a few seconds |
Artem Bilan commented Thank you, guys, for such a quick turnaround! Re. non-JavaBeans convention. Let me know if switching it to the JavaBeans convention makes the stuff faster and I'll fix that issue! |
Oliver Drotbohm commented Unless you explicitly activate property access, we now use the fields in the first place (just like the reflection based bean wrapper we have used in Hopper did) |
Artem Bilan commented I guess you mean Well, since we have a couple domain entities which are actively used in the Spring Integration, I think that will be good idea to optimize there as well. Thank you for the help! |
Oliver Drotbohm commented Well, we default to field access as we actually think property access is too invasive regarding class design. With it active, you need accessor methods for everything that's supposed to be persisted. That however might conflict with the API you want to expose. Generally speaking, the state of an object consists of its fields. Hence using those directly for persistence seems to be the better option. With the new code in place (i.e. the stuff that Mark just fixed) we're now using method handles instead of reflection to access the field's values which gives us some performance gains in that area |
Mark Paluch opened DATACMNS-916 and commented
Class:
https://github.com/spring-projects/spring-integration/blob/master/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java#L841
Update: Generated property accessors initialize field and property accessors as far as possible upon class initialization. Although setter initialization is not required for this case, it revealed a bug in setter lookup. The call to
getDeclaredMethod
usedjava.lang.Integer
as argument type instead ofjava.lang.Integer#TYPE
. The root cause is that a setter lookup uses wrapped types instead of the primitive type forgetDeclaredMethod
lookupAffects: 1.13 M1 (Ingalls)
Reference URL: https://build.spring.io/browse/PLATFORM-COM-JOB1-232/test/case/202163589
Issue Links:
@AccessType
(PROPERTY) for better performanceReferenced from: pull request #178
The text was updated successfully, but these errors were encountered: