Missing LineNumberTable entries with JDK8?

Joel Borggren-Franck joel.franck at oracle.com
Mon Aug 19 01:50:28 PDT 2013


Hi Marc,

Thanks for the report. Bug id 8023214.

Should show up here: http://bugs.sun.com/view_bug.do?bug_id=8023214

cheers
/Joel

In-Reply-To: <51E3B136.4030800 at mountainminds.com>

On 2013-07-15, Marc R. Hoffmann wrote:
> Hi,
> 
> I'm currently working on a Java 8 version of the code coverage tool
> JaCoCo. This tool relies on line number information within class
> files. Some of our integration tests fail with JDK8, probably due to
> incomplete line number information.
> 
> STEPS TO REPRODUCE
> 
> Compile the source file attached with the lates JDK8 build
> (1.8.0-ea-b97). Compiled class is also attached.
> 
> EXPECTED
> 
> The compiled class files has a LineNumberTable entry for the method
> invocation b() in line 10.
> 
> ACTUAL
> 
> There is no separate LineNumberTable entry for the invocation of
> b(). So b() appears to be invoked in line 8 instead of 10. See javap
> output below.
> 
> The problem seems to be specific to static methods. Line numbers are
> reported correctly if method b() is an instance method.
> 
> Best regards,
> -marc
> 
> 
>   static void m(boolean);
>     descriptor: (Z)V
>     flags: ACC_STATIC
>     Code:
>       stack=1, locals=1, args_size=1
>          0: iload_0
>          1: ifeq          10
>          4: invokestatic  #2                  // Method a:()V
>          7: goto          13
>         10: invokestatic  #3                  // Method b:()V
>         13: return
>       LineNumberTable:
>         line 7: 0
>         line 8: 4
>         line 12: 13
>       StackMapTable: number_of_entries = 2
>            frame_type = 10 /* same */
>            frame_type = 2 /* same */
> 

> /**
>  * Reproducer for Java 8 compiler issue where wrong line numbers are reported..
>  */
> public class Target01 {
> 
> 	static void m(boolean flag) {
> 		if (flag) {
> 			a();
> 		} else {
> 			b(); // Wrong line number for this invocation (8 instead of 10)
> 		}
> 	}
> 
> 	static void a() {
> 	}
> 
> 	static void b() {
> 	}
> 
> }




More information about the compiler-dev mailing list