Bug #7329
improve FieldReference resolution of getter/setter/extent accessors
100%
History
#1 Updated by Constantin Asofiei about 3 years ago
- getter
- setter
- index
Also, can getParentBuffer cache the buffer instance?
#2 Updated by Constantin Asofiei about 3 years ago
Constantin Asofiei wrote:
- index
Here I meant 'getExtent'
#3 Updated by Alexandru Lungu about 3 years ago
- Status changed from New to WIP
- Assignee set to Radu Apetrii
Radu, please fix this in 7026d.
#4 Updated by Radu Apetrii about 3 years ago
I've applied the suggested comments. The changes are on 7026d, rev. 14563.
I haven't tested yet with a large customer application, but I will get this done.
#5 Updated by Radu Apetrii about 3 years ago
Radu Apetrii wrote:
I haven't tested yet with a large customer application, but I will get this done.
I have identified a problem when running a customer application. I'm looking into this so that 7026d can be fully functional.
#6 Updated by Radu Apetrii about 3 years ago
Radu Apetrii wrote:
I haven't tested yet with a large customer application, but I will get this done.
I have identified a problem when running a customer application. I'm looking into this so that 7026d can be fully functional.
Done. There was a NPE encountered in FieldReference.getGetter. The new changes are on 7026d, rev. 14564.
#7 Updated by Alexandru Lungu about 3 years ago
- % Done changed from 0 to 60
Review of 7026d 14563-14564:
- Extent can be
null! Don't usenullas a marker to check if it was computed or not. Use some separate variable (extentIsComputed). - Note that having a
nullsetter is also valid state ifisIdAccessoristrue. You only throwIllegalArgumentExceptionif the setter is null and!isIdAccessor. Please use a separatesetterIsComputedto ensure thatnullis actually generated and not just a lazy computation maker. If you want to have everything other control, you can also do agetterIsComputed, but this is optional. - You have
if (getter null) getter = getGetter(); if (getter null). Please reduce it to one single checkgetGetter() null. This also happens forextent. However, I think this is regarded to my last comment. - You have
if (bulk null) bulk = (bulk != null) && (extent != null) && (index == null). This makes the first condition (bulk != null) always true. Note that you have the constructorbulkyou are no longer using. You shouldn't lazily initialize bulk. You can save the constructor value into a "allowBulk" or something like this and use it afterwards. - Inline
if (getter == null) getter = getGetter() return getter.getReturnType()intoreturn getGetter().getReturnType(). The null check is already done in thegetGetter. The same goes forgetSetterandgetExtent. The performance we try to save here is not from a simple native method call (which is already super-fast, especially with no parameters), but from some map look-ups and stuff like this. Now that you also haveextentIsComputedandsetterIsComputed, this whole check gets hard to manage, so leave the lazy checks only ingetGetter,getSetterandgetExtent.
#8 Updated by Radu Apetrii about 3 years ago
I've refactored the code as you suggested. The changes are on 7026d, rev. 14570.
I found no issues while testing (with a customer app), but please let me know if you encounter any problems.
#9 Updated by Alexandru Lungu about 3 years ago
- % Done changed from 60 to 90
Review of 7026d, rev. 14570
The changes are functionally good. I have only some minor suggestions- In
set, can you extractgetSetterresult into a localsettervariable, so thatUtils.invokeuses the local variable and not the class field? I am a bit afraid of accessingsetterclass field directly. Even if it isn't null due to the check, someone may decide to drop thatIllegalStateExceptioncheck and fail to use the rightsetterin the end. The same goes forgetObjectandunknownValue. - In
equals,this.extent = getExtent(); that.extent = that.getExtent();doesn't look quite right. Can you useObjects.equals(getExtent(), that.getExtent())directly? - Please use
!isBulkComputedinstead ofisBulkComputed falseorisBulkComputedinstead ofisBulkComputed true. - For the second constructor, you can set
isSetterComputedontrue, because thesetteris null anyway. The same forbulkandextent.
#10 Updated by Radu Apetrii about 3 years ago
Alexandru Lungu wrote:
The changes are functionally good. I have only some minor suggestions
- In
set, can you extractgetSetterresult into a localsettervariable, so thatUtils.invokeuses the local variable and not the class field? I am a bit afraid of accessingsetterclass field directly. Even if it isn't null due to the check, someone may decide to drop thatIllegalStateExceptioncheck and fail to use the rightsetterin the end. The same goes forgetObjectandunknownValue.- In
equals,this.extent = getExtent(); that.extent = that.getExtent();doesn't look quite right. Can you useObjects.equals(getExtent(), that.getExtent())directly?- Please use
!isBulkComputedinstead ofisBulkComputed falseorisBulkComputedinstead ofisBulkComputed true.- For the second constructor, you can set
isSetterComputedontrue, because thesetteris null anyway. The same forbulkandextent.
Done. I applied the suggested changes. The commit is on 7026d, rev. 14574.
#11 Updated by Alexandru Lungu about 3 years ago
- Status changed from WIP to Review
- % Done changed from 90 to 100
Review of 7026d/rev. 14574
I am OK with the changes. Have you tested the latest version (rev. 14574) of 7026d with a large customer application? I want to know if all the changes of 7026d are still doing fine now and we are on track with a stable 7026d.
#12 Updated by Radu Apetrii about 3 years ago
Alexandru Lungu wrote:
Review of 7026d/rev. 14574
I am OK with the changes. Have you tested the latest version (rev. 14574) of 7026d with a large customer application? I want to know if all the changes of 7026d are still doing fine now and we are on track with a stable 7026d.
Yes, I have. Everything was fine, I just forgot to mention it.
#13 Updated by Alexandru Lungu about 3 years ago
- Status changed from Review to Test
Merged 7026d to trunk as rev. 14587.
This can be closed.
#14 Updated by Alexandru Lungu almost 2 years ago
Alexandru Lungu wrote:
This can be closed.
#15 Updated by Greg Shah almost 2 years ago
- Status changed from Test to Closed