-
Bug
-
Resolution: Not an Issue
-
P3
-
10
FULL PRODUCT VERSION :
java version "10-ea"
Java(TM) SE Runtime Environment (build 10-ea+35)
Java HotSpot(TM) 64-Bit Server VM (build 10-ea+35, mixed mode)
A DESCRIPTION OF THE PROBLEM :
JDK-8192885 is marked as resolved in b35, I did a test and think that fix is incomplete / incorrect: compiler in JDK 10-ea+35 produces multiple entries in LineNumberTable for a last line of a foreach loop. Due to this in case if body of loop is not executed, debugger will misleadingly show that a step after loop - is the last line of the loop body.
Background information: I'm one of developers of the JaCoCo code coverage tool. This tool relies on line number debug information within class files to provide code coverage highlighting. We have a regression test suite which uncovered the defect reported here.
And due to this issue in the same case code coverage tool such as JaCoCo will highlight misleadingly last line of a body of foreach loop as partially executed.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the same source file as inJDK-8192885, which is also provided here.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Single entry for line 4 (without "line 4: 32") in LineNumberTable as this is the case with JDK 1.8.0_152-b16 , 9.0.1+11 and 10-ea+30.
ACTUAL -
LineNumberTable:
line 3: 0
line 4: 25
line 5: 29
line 4: 32
line 6: 34
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class Example {
static void example() {
for (Object o : java.util.Collections.emptyList()) {
nop(o);
}
}
static void nop(Object o) {
}
}
---------- END SOURCE ----------
java version "10-ea"
Java(TM) SE Runtime Environment (build 10-ea+35)
Java HotSpot(TM) 64-Bit Server VM (build 10-ea+35, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Background information: I'm one of developers of the JaCoCo code coverage tool. This tool relies on line number debug information within class files to provide code coverage highlighting. We have a regression test suite which uncovered the defect reported here.
And due to this issue in the same case code coverage tool such as JaCoCo will highlight misleadingly last line of a body of foreach loop as partially executed.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the same source file as in
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Single entry for line 4 (without "line 4: 32") in LineNumberTable as this is the case with JDK 1.8.0_152-b16 , 9.0.1+11 and 10-ea+30.
ACTUAL -
LineNumberTable:
line 3: 0
line 4: 25
line 5: 29
line 4: 32
line 6: 34
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class Example {
static void example() {
for (Object o : java.util.Collections.emptyList()) {
nop(o);
}
}
static void nop(Object o) {
}
}
---------- END SOURCE ----------
- relates to
-
JDK-8192885 Compiler in JDK 10-ea+33 misses to include entry in LineNumberTable for goto instruction of foreach loop
- Closed
-
JDK-8194836 delta apply changesets for JDK-8192885 and JDK-8175883
- Resolved