JDK-8193449 : Fix for JDK-8192885 resulted in extra entry in LineNumberTable
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 10
  • Priority: P3
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2017-12-12
  • Updated: 2018-01-10
  • Resolved: 2018-01-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorResolved
Related Reports
Relates :  
Relates :  
Description
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 in JDK-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 ----------


Comments
JDK-8194836 has delta applied the patch that introduced the issue
10-01-2018

This is an regression started in 10 b35 Line number table information in 10 b32 == LineNumberTable: line 3: 0 line 4: 25 line 5: 29 line 6: 32 == Problem started from 10 ea b33 onwards... There was a fix JDK-8175883 in 10 ea b33 created another JDK-8192885 resulting in missing line number entry Line number table information in 10 b33 with missing entry for line 5 LineNumberTable: line 3: 0 line 4: 25 line 6: 36 JDK-8192885 issue is fixed in 10 b35 resulting in an extra line Line number table information in 10 b35 with extra entry for line 4 == line 3: 0 line 4: 25 line 5: 29 line 4: 32 line 6: 34
13-12-2017