-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b78
-
x86
-
windows_7
-
Verified
FULL PRODUCT VERSION :
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b22)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 Ultimate 64 bits SP1
A DESCRIPTION OF THE PROBLEM :
The access attributes affected the results of the operation.
The results of the below code printed:
i = 3
j = 4
==================================================
public class outer {
public int i = 1;
private int j = 1;
public static void main(String[] args) {
new outer().new inner().Test();
}
class inner {
public void Test() {
i+=i+=1;
j+=j+=1;
System.out.println("i = " + i);
System.out.println("j = " + j);
}
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
If the access attributes of the i and j are public, the results are 3
If the access attributes of the i and j are private, the results are 4
If the access attributes of the i and j are public and private respectively, the results are 3 and 4
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The expected result:
i = 3
j = 3
ACTUAL -
The actual results:
i = 3
j = 4
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class outer {
public int i = 1;
private int j = 1;
public static void main(String[] args) {
new outer().new inner().Test();
}
class inner {
public void Test() {
i+=i+=1;
j+=j+=1;
System.out.println("i = " + i);
System.out.println("j = " + j);
}
}
}
---------- END SOURCE ----------
SUPPORT :
YES
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b22)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 Ultimate 64 bits SP1
A DESCRIPTION OF THE PROBLEM :
The access attributes affected the results of the operation.
The results of the below code printed:
i = 3
j = 4
==================================================
public class outer {
public int i = 1;
private int j = 1;
public static void main(String[] args) {
new outer().new inner().Test();
}
class inner {
public void Test() {
i+=i+=1;
j+=j+=1;
System.out.println("i = " + i);
System.out.println("j = " + j);
}
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
If the access attributes of the i and j are public, the results are 3
If the access attributes of the i and j are private, the results are 4
If the access attributes of the i and j are public and private respectively, the results are 3 and 4
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The expected result:
i = 3
j = 3
ACTUAL -
The actual results:
i = 3
j = 4
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class outer {
public int i = 1;
private int j = 1;
public static void main(String[] args) {
new outer().new inner().Test();
}
class inner {
public void Test() {
i+=i+=1;
j+=j+=1;
System.out.println("i = " + i);
System.out.println("j = " + j);
}
}
}
---------- END SOURCE ----------
SUPPORT :
YES
- relates to
-
JDK-8061329 Minimize generation of access bridges
- Open
-
JDK-8009170 Regression: javac generates redundant bytecode in assignop involving arrays
- Closed
-
JDK-8160156 javac is generating let expressions unnecessarily
- Closed