Skip to content

Commit

Permalink
ExpressionTransformer #1917: use the LHS type if the RHS is null
Browse files Browse the repository at this point in the history
Because otherwise the Java bottom type is stored in java.lang.Object, which is not
of the bottom type, so x = y = null will fail because null is stored in java.lang.Object
and can't be assigned to either y or x
  • Loading branch information
FroMage committed Nov 19, 2014
1 parent 97300e7 commit 863b88c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4526,6 +4526,8 @@ private JCExpression transformAssignment(Node op, Tree.Term leftTerm, Tree.Term
return transformAssignment(op, leftTerm, rhs);
} else {
ProducedType valueType = rightTerm.getTypeModel();
if(isNull(valueType))
valueType = leftTerm.getTypeModel();
return transformAssignAndReturnOperation(op, leftTerm, boxing == BoxingStrategy.BOXED,
leftTerm.getTypeModel(), valueType, new AssignAndReturnOperationFactory(){
@Override
Expand Down

0 comments on commit 863b88c

Please sign in to comment.