-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
generic
-
generic
-
Verified
Name: poR10007 Date: 07/20/2001
Javac (jdk1.4.0beta-b72) when running in -Xjcov mode misses some
CharacterRangeTable branch entries if the conditional operator
is used as a flow controlling expression.
The following test demonstrates the bug:
--Test.java---------------------------------------
public class Test {
public static void main (String[] args) {
boolean t = true, b = false, c = true;
if (t ? b : c) ;
}
}
--------------------------------------------------
For the if-statement of the test javac produces bytecodes with three
branches:
6: iload_1; // flow controller 't'
7: ifeq 17; // branch for the condition 't'
10: iload_2; // flow target 'b' (in a sense, 'b' also is
// a flow controller for the if-statement)
11: ifeq 21; // branch for the condition 'b' (missed in
// CharacterRangeTable !!!)
14: goto 21; // bypass false part of the expression
17: iload_3; // flow target 'c' (in a sense, 'c' also is
// a flow controller for the if-statement)
18: ifeq 21; // branch for the condition 'c'
but CharacterRangeTable attribute contains only two entries of CRT_BRANCH_xxx
type - one per each CRT_FLOW_CONTROLLER entry: 't' and 't ? b : c'.
======================================================================