CFG: Missing boxing added (EA-125425 - ISE: DfaMemoryStateImpl.addToMap)

This commit is contained in:
Tagir Valeev
2018-07-26 17:32:15 +07:00
parent dc471282d9
commit ea7ac9eec7
3 changed files with 16 additions and 1 deletions
@@ -726,6 +726,7 @@ public class CFGBuilder {
push(factory.getConstFactory().getSentinel());
for (PsiExpression expression : expressions) {
pushExpression(expression);
boxUnbox(expression, targetVariable.getVariableType());
}
// Revert order
add(new SpliceInstruction(expressions.length, IntStreamEx.ofIndices(expressions).toArray()));
@@ -712,8 +712,10 @@ public class StreamChainInliner implements CallInliner {
}
if (single) {
// exactly single element
PsiExpression arg = sourceCall.getArgumentList().getExpressions()[0];
builder
.pushExpression(sourceCall.getArgumentList().getExpressions()[0])
.pushExpression(arg)
.boxUnbox(arg, inType)
.chain(firstStep::before)
.chain(firstStep::iteration);
return;
@@ -238,4 +238,16 @@ public class StreamInlining {
void testToArray(List<String> list) {
list.stream().toArray(size -> <warning descr="Function may return null, but it's not allowed here">null</warning>);
}
Object testBoxingExplicit() {
return String.join("\n",
Stream.of(12, 22)
.map(Object::toString)
.collect(Collectors.toList())
);
}
public static void testBoxingExplicit2() {
double s = Stream.of(1).mapToDouble(x -> x * x).sum();
}
}