Bug #7329
improve FieldReference resolution of getter/setter/extent accessors
100%
History
#1 Updated by Constantin Asofiei about 1 year ago
- getter
- setter
- index
Also, can getParentBuffer
cache the buffer instance?
#2 Updated by Constantin Asofiei about 1 year ago
Constantin Asofiei wrote:
- index
Here I meant 'getExtent'
#3 Updated by Alexandru Lungu about 1 year ago
- Status changed from New to WIP
- Assignee set to Radu Apetrii
Radu, please fix this in 7026d.
#4 Updated by Radu Apetrii about 1 year 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 1 year 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 1 year 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 1 year ago
- % Done changed from 0 to 60
Review of 7026d 14563-14564:
- Extent can be
null
! Don't usenull
as a marker to check if it was computed or not. Use some separate variable (extentIsComputed
). - Note that having a
null
setter is also valid state ifisIdAccessor
istrue
. You only throwIllegalArgumentException
if the setter is null and!isIdAccessor
. Please use a separatesetterIsComputed
to ensure thatnull
is 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 constructorbulk
you 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 forgetSetter
andgetExtent
. 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 haveextentIsComputed
andsetterIsComputed
, this whole check gets hard to manage, so leave the lazy checks only ingetGetter
,getSetter
andgetExtent
.
#8 Updated by Radu Apetrii 12 months 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 12 months 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 extractgetSetter
result into a localsetter
variable, so thatUtils.invoke
uses the local variable and not the class field? I am a bit afraid of accessingsetter
class field directly. Even if it isn't null due to the check, someone may decide to drop thatIllegalStateException
check and fail to use the rightsetter
in the end. The same goes forgetObject
andunknownValue
. - In
equals
,this.extent = getExtent(); that.extent = that.getExtent();
doesn't look quite right. Can you useObjects.equals(getExtent(), that.getExtent())
directly? - Please use
!isBulkComputed
instead ofisBulkComputed false
orisBulkComputed
instead ofisBulkComputed true
. - For the second constructor, you can set
isSetterComputed
ontrue
, because thesetter
is null anyway. The same forbulk
andextent
.
#10 Updated by Radu Apetrii 12 months ago
Alexandru Lungu wrote:
The changes are functionally good. I have only some minor suggestions
- In
set
, can you extractgetSetter
result into a localsetter
variable, so thatUtils.invoke
uses the local variable and not the class field? I am a bit afraid of accessingsetter
class field directly. Even if it isn't null due to the check, someone may decide to drop thatIllegalStateException
check and fail to use the rightsetter
in the end. The same goes forgetObject
andunknownValue
.- In
equals
,this.extent = getExtent(); that.extent = that.getExtent();
doesn't look quite right. Can you useObjects.equals(getExtent(), that.getExtent())
directly?- Please use
!isBulkComputed
instead ofisBulkComputed false
orisBulkComputed
instead ofisBulkComputed true
.- For the second constructor, you can set
isSetterComputed
ontrue
, because thesetter
is null anyway. The same forbulk
andextent
.
Done. I applied the suggested changes. The commit is on 7026d, rev. 14574.
#11 Updated by Alexandru Lungu 12 months 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 12 months 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 12 months ago
- Status changed from Review to Test
Merged 7026d to trunk as rev. 14587.
This can be closed.