Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0, 1.1-beta-1
-
Fix Version/s: 1.1-beta-2
-
Component/s: bytecode
-
Labels:None
-
Environment:Windows XP
Java SE 6
-
Testcase included:yes
-
Number of attachments :
Description
Assigning a value to an array element yields null instead of the assigned value.
int[] a = new int[1]
assert (a[0] = 42) == null // current behavior
assert (a[0] = 42) == 42 // expected behavior
I suggest to keep putAt() a "void" method and just make a[0]=42 evaluate to 42 rather than null. This is consistent with properties, where setters have return type void and therefore a.setX(42) evaluates to null, whereas a.x=42 evaluates to 42.