Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When boxing primitive values, an artificial call like
Integer.valueOf(arg)
is created in the CFG.The tree
arg
then maps to the post-conversion node.The first iteration to the CFG will not find a value for
arg
and the previous change togetValue
then uses the pre-conversion node instead.In the test case, this only happens in simple CFGs and switching pre- and post-conversion nodes has no impact.
However, if a fix-point iteration is necessary, this can lead to using the post-conversion value as argument to
valueOf
, which is wrong.This PR introduces a new temporary variable to hold the argument to
valueOf
, to ensure they are not mixed up.However, this has a large performance overhead:
checker/tests/all-systems/Issue301.java
on my system now takes more than double the time to check, with both the Nullness and Signedness Checkers.Items:
Integer.valueOf
takes one type and returns an incompatible different type. Write a test case that requires a fix-point iteration and see whether this exposes the problem with the original code.CFGTranslationPhaseOne
is very similar to other code for new temporary variables. See how to extract this into a helper function.