-
Notifications
You must be signed in to change notification settings - Fork 45
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
Apparent false positive on PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP #257
Comments
something is odd here. it couldn't really be complaining about lastSize.... my guess is it's complaining about new SearchCriteriaBuilder and something confused it.. i'll have to take a look |
javap output:
|
When i use the following mock code, it highlights the line
|
Is there any kind of code generation/augmentation that perhaps is not updating the line number table properly? |
OK, either I was reading it wrong before or it's detecting the line numbers better now. Yes, it's reporting on the Still seems like a false positive, though, since the search criteria are derived from the latest payment time, which is obtained from the last transaction returned. |
while this is splitting hairs, you could pull out of the loop, and just do in the loop |
|
yes no doubt it's a FP, and should be fixed. I'm just saying that in this specific example you could just allocate it once. |
We're hitting
PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP
in code that, as far as I can tell, is not able to allocate the relevant variable outside the loop.The detector complains about the
lastSize
variable, which is updated on each iteration to a) identify when we get less search results (meaning that we're on the last page of results) and b) report on the number of transactions returned if we crash. I don't see a better time to allocate it.The text was updated successfully, but these errors were encountered: