Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

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 8cde7ad commit d31a628
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 d31a628

Please sign in to comment.